Commit c827b4b4 authored by Pierre Ynard's avatar Pierre Ynard

vimeo.lua: remove tabs and debug output

(cherry picked from commit ecddf0b63594b62dfb6c89c0a73ccf669f1f581b)
Signed-off-by: default avatarPierre Ynard <linkfanel@yahoo.fr>
parent c5c797b1
...@@ -36,19 +36,18 @@ end ...@@ -36,19 +36,18 @@ end
function probe() function probe()
return vlc.access == "http" return vlc.access == "http"
and string.match( vlc.path, "vimeo.com/%d+$" ) and string.match( vlc.path, "vimeo.com/%d+$" )
-- do not match other addresses, -- do not match other addresses,
-- else we'll also try to decode the actual video url -- else we'll also try to decode the actual video url
end end
-- Parse function. -- Parse function.
function parse() function parse()
if string.match ( vlc.path, "vimeo.com/%d+$" ) then if string.match ( vlc.path, "vimeo.com/%d+$" ) then
vlc.msg.warn("matched "..vlc.path)
_,_,id = string.find( vlc.path, "vimeo.com/([0-9]*)") _,_,id = string.find( vlc.path, "vimeo.com/([0-9]*)")
prefres = get_prefres() prefres = get_prefres()
ishd = false ishd = false
quality = "sd" quality = "sd"
codec = nil codec = nil
while true do while true do
line = vlc.readline() line = vlc.readline()
if not line then break end if not line then break end
...@@ -80,32 +79,32 @@ function parse() ...@@ -80,32 +79,32 @@ function parse()
end end
-- Try to find the available codecs -- Try to find the available codecs
if string.match( line, "{config:.*,\"files\":{\"vp6\":" ) then if string.match( line, "{config:.*,\"files\":{\"vp6\":" ) then
codec = "vp6" codec = "vp6"
end end
if string.match( line, "{config:.*,\"files\":{\"vp8\":" ) then if string.match( line, "{config:.*,\"files\":{\"vp8\":" ) then
codec = "vp8" codec = "vp8"
end end
if string.match( line, "{config:.*,\"files\":{\"h264\":" ) then if string.match( line, "{config:.*,\"files\":{\"h264\":" ) then
codec = "h264" codec = "h264"
end end
-- Try to find whether video is HD actually -- Try to find whether video is HD actually
if string.match( line, "{config:.*,\"hd\":1" ) then if string.match( line, "{config:.*,\"hd\":1" ) then
ishd = true ishd = true
end end
if string.match( line, "{config:.*\"height\":" ) then if string.match( line, "{config:.*\"height\":" ) then
_,_,height = string.find (line, "\"height\":([0-9]*)," ) _,_,height = string.find (line, "\"height\":([0-9]*)," )
end end
end end
if not codec then if not codec then
vlc.msg.warn("unable to find codec info") vlc.msg.warn("unable to find codec info")
return nil return nil
end end
if ishd and ( not height or prefres < 0 or prefres >= tonumber(height) ) then if ishd and ( not height or prefres < 0 or prefres >= tonumber(height) ) then
quality = "hd" quality = "hd"
end end
path = "http://player.vimeo.com/play_redirect?quality="..quality.."&codecs="..codec.."&clip_id="..id.."&time="..tstamp.."&sig="..rsig.."&type=html5_desktop_local" path = "http://player.vimeo.com/play_redirect?quality="..quality.."&codecs="..codec.."&clip_id="..id.."&time="..tstamp.."&sig="..rsig.."&type=html5_desktop_local"
return { { path = path; name = name; arturl = arturl, duration = duration } } return { { path = path; name = name; arturl = arturl, duration = duration } }
end end
return {} return {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment