[vlc-commits] lua: tighten URL probe functions of playlist scripts

Pierre Ynard git at videolan.org
Wed Nov 2 02:21:10 CET 2016


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Wed Nov  2 02:17:59 2016 +0100| [d88cf188930c5d636fdaed4e8f2cb56b1362b3be] | committer: Pierre Ynard

lua: tighten URL probe functions of playlist scripts

These scripts are possibly still otherwise outdated and broken.

Ref. #17488

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d88cf188930c5d636fdaed4e8f2cb56b1362b3be
---

 share/lua/playlist/bbc_co_uk.lua | 3 ++-
 share/lua/playlist/break.lua     | 4 ++--
 share/lua/playlist/canalplus.lua | 2 +-
 share/lua/playlist/jamendo.lua   | 2 +-
 share/lua/playlist/katsomo.lua   | 2 +-
 share/lua/playlist/lelombrik.lua | 3 ++-
 share/lua/playlist/metacafe.lua  | 3 ++-
 share/lua/playlist/pinkbike.lua  | 3 ++-
 8 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/share/lua/playlist/bbc_co_uk.lua b/share/lua/playlist/bbc_co_uk.lua
index 3e5cdef..799545a 100644
--- a/share/lua/playlist/bbc_co_uk.lua
+++ b/share/lua/playlist/bbc_co_uk.lua
@@ -22,8 +22,9 @@
 
 -- Probe function.
 function probe()
+    local path = vlc.path:gsub("^www%.", "")
     return vlc.access == "http"
-        and string.match( vlc.path, "bbc.co.uk/iplayer/" )
+        and string.match( path, "^bbc%.co%.uk/iplayer/.+" )
 end
 
 -- Parse function.
diff --git a/share/lua/playlist/break.lua b/share/lua/playlist/break.lua
index ad3367f..d760d6b 100644
--- a/share/lua/playlist/break.lua
+++ b/share/lua/playlist/break.lua
@@ -20,9 +20,9 @@
 
 -- Probe function.
 function probe()
+    local path = vlc.path:gsub("^www%.", "")
     return vlc.access == "http"
-        and ( string.match( vlc.path, "^break.com" )
-           or string.match( vlc.path, "^www.break.com" ) )
+           and string.match( path, "^break%.com/video/.+" )
 end
 
 -- Parse function.
diff --git a/share/lua/playlist/canalplus.lua b/share/lua/playlist/canalplus.lua
index 0b0af9a..bcaf7de 100644
--- a/share/lua/playlist/canalplus.lua
+++ b/share/lua/playlist/canalplus.lua
@@ -20,7 +20,7 @@
 
 -- Probe function.
 function probe()
-    return vlc.access == "http" and string.match( vlc.path, "www.canalplus.fr" )
+    return vlc.access == "http" and string.match( vlc.path, "^www%.canalplus%.fr/.+" )
 end
 
 -- Parse function.
diff --git a/share/lua/playlist/jamendo.lua b/share/lua/playlist/jamendo.lua
index 9edbccf..7fae914 100644
--- a/share/lua/playlist/jamendo.lua
+++ b/share/lua/playlist/jamendo.lua
@@ -25,7 +25,7 @@ require "simplexml"
 -- Probe function.
 function probe()
     return vlc.access == "http"
-        and string.match( vlc.path, "api.jamendo.com/" )
+        and string.match( vlc.path, "^api%.jamendo%.com/" )
         and string.match( vlc.path, "get2" )
         and string.match( vlc.path, "track" )
         and string.match( vlc.path, "xml" )
diff --git a/share/lua/playlist/katsomo.lua b/share/lua/playlist/katsomo.lua
index d3b15c6..e7130f7 100644
--- a/share/lua/playlist/katsomo.lua
+++ b/share/lua/playlist/katsomo.lua
@@ -23,7 +23,7 @@
 -- Probe function.
 function probe()
     return vlc.access == "http"
-        and string.match( vlc.path, "www.katsomo.fi" )
+        and string.match( vlc.path, "^www%.katsomo%.fi/" )
         and ( string.match( vlc.path, "treeId" ) or string.match( vlc.path, "progId" ) )
 end
 
diff --git a/share/lua/playlist/lelombrik.lua b/share/lua/playlist/lelombrik.lua
index 6972dd6..ef4e2c5 100644
--- a/share/lua/playlist/lelombrik.lua
+++ b/share/lua/playlist/lelombrik.lua
@@ -22,8 +22,9 @@
 
 -- Probe function.
 function probe()
+    local path = vlc.path:gsub("^www%.", "")
     return vlc.access == "http"
-        and string.match( vlc.path, "lelombrik.net/videos" ) 
+        and string.match( path, "^lelombrik%.net/videos" )
 end
 
 -- Parse function.
diff --git a/share/lua/playlist/metacafe.lua b/share/lua/playlist/metacafe.lua
index 89a9a34..63415a7 100644
--- a/share/lua/playlist/metacafe.lua
+++ b/share/lua/playlist/metacafe.lua
@@ -20,8 +20,9 @@
 
 -- Probe function.
 function probe()
+    local path = vlc.path:gsub("^www%.", "")
     return vlc.access == "http"
-        and string.match( vlc.path, "metacafe.com" ) 
+        and string.match( vlc.path, "^metacafe%.com/" )
         and (  string.match( vlc.path, "watch/" )
             or string.match( vlc.path, "mediaURL=" ) )
 end
diff --git a/share/lua/playlist/pinkbike.lua b/share/lua/playlist/pinkbike.lua
index f6787c8..673893e 100644
--- a/share/lua/playlist/pinkbike.lua
+++ b/share/lua/playlist/pinkbike.lua
@@ -22,8 +22,9 @@
 
 -- Probe function.
 function probe()
+    local path = vlc.path:gsub("^www%.", "")
     return vlc.access == "http"
-        and string.match( vlc.path, "pinkbike.com/video/%d+" )
+        and string.match( path, "^pinkbike%.com/video/%d+" )
 end
 
 -- Parse function.



More information about the vlc-commits mailing list