From 364ad53c0cda4baf6e1d508e0a46b679bce80c45 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Sat, 28 Sep 2013 23:18:29 +0300 Subject: [PATCH] FIX: media/funnyordie.lua: Media stream URL pattern This was fixed by 41a7516647, which removed the pattern that appears to work again. Keep both patterns. Other changes: * Insert only those media URLs that match the quality-container pattern Signed-off-by: Toni Gundogdu --- share/media/funnyordie.lua | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/share/media/funnyordie.lua b/share/media/funnyordie.lua index be2d783..45fe2a3 100644 --- a/share/media/funnyordie.lua +++ b/share/media/funnyordie.lua @@ -61,10 +61,15 @@ end function FunnyOrDie.iter_streams(p) local t = {} - for u in p:gmatch('type: "video/mp4", src: "(.-)"') do - table.insert(t, u) + + -- 41a7516647: added the pattern in the next line, and removed... + for u in p:gmatch('type: "video/mp4", src: "(.-)"') do table.insert(t,u) end + for u in p:gmatch('source src="(.-)"') do table.insert(t,u) end -- ... This. + -- Keep both of them. + + if #t ==0 then + error('no match: media stream URL') end - if #t ==0 then error('no match: media stream URL') end local S = require 'quvi/stream' local r = {} @@ -72,11 +77,13 @@ function FunnyOrDie.iter_streams(p) -- nostd is a dictionary used by this script only. libquvi ignores it. for _,u in pairs(t) do local q,c = u:match('/(%w+)%.(%w+)$') - local s = S.stream_new(u) - s.nostd = {quality=q} - s.container = c - s.id = FunnyOrDie.to_id(s) - table.insert(r,s) + if q and c then + local s = S.stream_new(u) + s.nostd = {quality=q} + s.container = c + s.id = FunnyOrDie.to_id(s) + table.insert(r,s) + end end if #r >1 then -- 2.11.4.GIT