[vlc-devel] [PATCH 1/3] soundcloud.lua: Improve URL probe function

Marvin Scholz epirat07 at gmail.com
Tue Oct 25 09:47:50 CEST 2016


Improve the URL probe function to not match URLs like
http://example.org/foo/soundcloud.com/example/example as
those should not be handled by this script.

Ref. #17488
---
 share/lua/playlist/soundcloud.lua | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/share/lua/playlist/soundcloud.lua b/share/lua/playlist/soundcloud.lua
index 8dfbe7e..19df833 100644
--- a/share/lua/playlist/soundcloud.lua
+++ b/share/lua/playlist/soundcloud.lua
@@ -23,8 +23,11 @@
 
 -- Probe function.
 function probe()
+    local path = vlc.path
+    path = path:gsub("^www%.", "")
     return ( vlc.access == "http" or vlc.access == "https" )
-        and string.match( vlc.path, "soundcloud%.com/.+/.+" )
+        and ( string.match( path, "^soundcloud%.com/.+/.+") or
+            string.match( path, "^soundcloud%.com/.+/.+"))
 end
 
 function fix_quotes( value )
-- 
2.8.4 (Apple Git-73)



More information about the vlc-devel mailing list