From f34b625610efe40eb9f1da4d3a734b975dcbf2ce Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Fri, 8 Feb 2013 18:38:57 +0200 Subject: [PATCH] ard.lua: Ard.to_s: Use service internal stream ID Since the service provides an ID (1,2,3,...), use it in the media stream ID to make them unique. Otherwise we'll end up with identical media stream IDs in some cases. Use 'i' for the lack of a better prefix. This is similar to that of youtube.lua (0.9) and the use of the "itag" value in YouTube the media stream IDs. Signed-off-by: Toni Gundogdu --- share/lua/website/ard.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/share/lua/website/ard.lua b/share/lua/website/ard.lua index 7a3a8ac..5afb3ba 100644 --- a/share/lua/website/ard.lua +++ b/share/lua/website/ard.lua @@ -114,9 +114,9 @@ function Ard.choose_default(t) end function Ard.to_s(t) - return string.format("%s_%s%s%s", + return string.format("%s_%s_i%02d%s%s", (t.quality) and t.quality or 'sd', - t.container, + t.container, t.stream_id, (t.encoding) and '_'..t.encoding or '', (t.height) and '_'..t.height or '') end @@ -147,9 +147,9 @@ end function Ard.iter_formats(page) local r = {} local s = 'mediaCollection%.addMediaStream' - .. '%(0, %d+, "(.-)", "(.-)", "%w+"%);' + .. '%(0, (%d+), "(.-)", "(.-)", "%w+"%);' - for prefix, suffix in page:gmatch(s) do + for s_id, prefix, suffix in page:gmatch(s) do local u = prefix .. suffix u = u:match('^(.-)?') or u -- remove querystring local t = { @@ -157,6 +157,7 @@ function Ard.iter_formats(page) encoding = suffix:match('%.(h264)%.'), quality = Ard.quality_from(suffix), height = Ard.height_from(suffix), + stream_id = s_id, -- internally (by service) used stream ID url = u } table.insert(r,t) -- 2.11.4.GIT