Commit 19d9676f authored by Pierre Ynard's avatar Pierre Ynard

dailymotion.lua: re-enable HD and convert to --preferred-resolution

parent bcd48040
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
$Id$ $Id$
Copyright © 2007 the VideoLAN team Copyright © 2007-2011 the VideoLAN team
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -21,6 +21,17 @@ ...@@ -21,6 +21,17 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 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. -- Probe function.
function probe() function probe()
return vlc.access == "http" return vlc.access == "http"
...@@ -35,13 +46,12 @@ end ...@@ -35,13 +46,12 @@ end
-- Parse function. -- Parse function.
function parse() function parse()
prefres = get_prefres()
while true while true
do do
line = vlc.readline() line = vlc.readline()
if not line if not line then
then break
vlc.msg.err("Couldn't extract the video URL from dailymotion")
return { }
end end
if string.match( line, "\"sequence\",") if string.match( line, "\"sequence\",")
then then
...@@ -57,24 +67,30 @@ function parse() ...@@ -57,24 +67,30 @@ function parse()
description = string.gsub( description, "+", " " ) description = string.gsub( description, "+", " " )
end end
--[[ we get a list of different streams available, at various codecs for _,param in ipairs({ "hd1080URL", "hd720URL", "hqURL", "sdURL" }) do
and resolutions: path = string.match( line, "\""..param.."\":\"([^\"]*)\"" )
if path then
Ideally, VLC would propose the different streams available, if prefres < 0 then
codecs and resolutions (the resolutions are part of the URL) break
end
For now we just built a list of preferred codecs : lowest value height = string.match( path, "/cdn/%w+%-%d+x(%d+)/video/" )
means highest priority if not height then
]]-- height = string.match( param, "(%d+)" )
end
-- FIXME: the hd/hq versions (in mp4) cause a lot of seeks, if not height or tonumber(height) <= prefres then
-- for now we only get the sd (in flv) URL break
end
end
end
-- if not path then path = find( line, "\"hqURL\":\"([^\"]*)\"") end if not path then
-- if not path then path = find( line, "\"hdURL\":\"([^\"]*)\"") end break
if not path then path = find( line, "\"sdURL\":\"([^\"]*)\"") end end
return { { path = path; name = name; description = description; url = vlc.path; arturl = arturl } } return { { path = path; name = name; description = description; url = vlc.path; arturl = arturl } }
end end
end end
vlc.msg.err("Couldn't extract the video URL from dailymotion")
return { }
end end
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