[vlc-commits] lua: remove obsolete preferred-resolution safeguards

Pierre Ynard git at videolan.org
Thu Oct 29 03:59:21 CET 2015


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Thu Oct 29 03:46:11 2015 +0100| [d2d4277c62582aeb6c0ff829f0b4149e50cf798d] | committer: Pierre Ynard

lua: remove obsolete preferred-resolution safeguards

These checked for the availability of vlc.var.inherit and
preferred-resolution at the time they were introduced, for script
compatibility with older VLC versions. By now it should be safe to
assume it's always available.

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

 share/lua/playlist/dailymotion.lua |   14 +-------------
 share/lua/playlist/extreme.lua     |   13 +------------
 share/lua/playlist/vimeo.lua       |   13 +------------
 share/lua/playlist/youtube.lua     |   13 +------------
 share/lua/playlist/zapiks.lua      |   13 +------------
 5 files changed, 5 insertions(+), 61 deletions(-)

diff --git a/share/lua/playlist/dailymotion.lua b/share/lua/playlist/dailymotion.lua
index b985fea..db64855 100644
--- a/share/lua/playlist/dailymotion.lua
+++ b/share/lua/playlist/dailymotion.lua
@@ -21,18 +21,6 @@
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 --]]
 
-function get_prefres()
-    local prefres = -1
-    if vlc.var and vlc.var.inherit then
-        prefres = vlc.var.inherit(nil, "preferred-resolution")
-        if prefres == nil then
-            prefres = -1
-        end
-    end
-
-    return prefres
-end
-
 -- Probe function.
 function probe()
 	if vlc.access ~= "http" and vlc.access ~= "https" then
@@ -44,7 +32,7 @@ end
 
 -- Parse function.
 function parse()
-	prefres = get_prefres()
+	prefres = vlc.var.inherit(nil, "preferred-resolution")
 
 
 	while true
diff --git a/share/lua/playlist/extreme.lua b/share/lua/playlist/extreme.lua
index f5949ce..21bcb05 100644
--- a/share/lua/playlist/extreme.lua
+++ b/share/lua/playlist/extreme.lua
@@ -20,17 +20,6 @@
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 --]]
 
-function get_prefres()
-    local prefres = -1
-    if vlc.var and vlc.var.inherit then
-        prefres = vlc.var.inherit(nil, "preferred-resolution")
-        if prefres == nil then
-            prefres = -1
-        end
-    end
-    return prefres
-end
-
 -- Probe function.
 function probe()
     return vlc.access == "http"
@@ -55,7 +44,7 @@ function parse()
     end
 
     if string.match( vlc.path, "player%.extreme%.com/info/." ) then
-        prefres = get_prefres()
+        prefres = vlc.var.inherit(nil, "preferred-resolution")
         gostraight = true
         while true do
             line = vlc.readline()
diff --git a/share/lua/playlist/vimeo.lua b/share/lua/playlist/vimeo.lua
index 9bd41b7..58f645a 100644
--- a/share/lua/playlist/vimeo.lua
+++ b/share/lua/playlist/vimeo.lua
@@ -22,17 +22,6 @@
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 --]]
 
-function get_prefres()
-    local prefres = -1
-    if vlc.var and vlc.var.inherit then
-        prefres = vlc.var.inherit(nil, "preferred-resolution")
-        if prefres == nil then
-            prefres = -1
-        end
-    end
-    return prefres
-end
-
 -- Probe function.
 function probe()
     return ( vlc.access == "http" or vlc.access == "https" )
@@ -60,7 +49,7 @@ function parse()
 
     else -- API URL
 
-        local prefres = get_prefres()
+        local prefres = vlc.var.inherit(nil, "preferred-resolution")
         local line = vlc.readline() -- data is on one line only
 
         for stream in string.gmatch( line, "{([^}]*\"profile\":[^}]*)}" ) do
diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index e10bdfe..5b2790c 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -36,20 +36,9 @@ function get_arturl()
     return vlc.access.."://img.youtube.com/vi/"..video_id.."/default.jpg"
 end
 
-function get_prefres()
-    local prefres = -1
-    if vlc.var and vlc.var.inherit then
-        prefres = vlc.var.inherit(nil, "preferred-resolution")
-        if prefres == nil then
-            prefres = -1
-        end
-    end
-    return prefres
-end
-
 -- Pick the most suited format available
 function get_fmt( fmt_list )
-    local prefres = get_prefres()
+    local prefres = vlc.var.inherit(nil, "preferred-resolution")
     if prefres < 0 then
         return nil
     end
diff --git a/share/lua/playlist/zapiks.lua b/share/lua/playlist/zapiks.lua
index 3c46bd0..b46e67d 100644
--- a/share/lua/playlist/zapiks.lua
+++ b/share/lua/playlist/zapiks.lua
@@ -20,17 +20,6 @@
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 --]]
 
-function get_prefres()
-    local prefres = -1
-    if vlc.var and vlc.var.inherit then
-        prefres = vlc.var.inherit(nil, "preferred-resolution")
-        if prefres == nil then
-            prefres = -1
-        end
-    end
-    return prefres
-end
-
 -- Probe function.
 function probe()
     return vlc.access == "http"
@@ -58,7 +47,7 @@ function parse()
     end
 
     if string.match ( vlc.path, "zapiks.fr/view/." ) then
-        prefres = get_prefres()
+        prefres = vlc.var.inherit(nil, "preferred-resolution")
         while true do
             line = vlc.readline()
             if not line then break end



More information about the vlc-commits mailing list