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

Pierre Ynard git at videolan.org
Thu Jan 14 01:42:41 CET 2016


vlc/vlc-2.2 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Thu Oct 29 03:46:11 2015 +0100| [3254200fc85a91e537f532c6b72acb022e27c492] | committer: Felix Paul Kühne

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.

(cherry picked from commit d2d4277c62582aeb6c0ff829f0b4149e50cf798d)
Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

 share/lua/playlist/dailymotion.lua |   14 +-------------
 share/lua/playlist/extreme.lua     |   13 +------------
 share/lua/playlist/vimeo.lua       |   14 +-------------
 share/lua/playlist/youtube.lua     |   13 +------------
 share/lua/playlist/zapiks.lua      |   13 +------------
 5 files changed, 5 insertions(+), 62 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 e8501f6..00ef98b 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,8 +49,7 @@ function parse()
 
     else -- API URL
 
-        local prefres = get_prefres()
-        local bestres = nil
+        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 ad2b591..611543c 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