From ca986886cdcb1d5369ba3401460887ee806dcc80 Mon Sep 17 00:00:00 2001 From: Ilkka Ollakka Date: Tue, 20 Apr 2010 12:28:13 +0300 Subject: [PATCH] appletrailers_iphone: add play-and-stop to optionlist, not sure they work corretly in this form Also check that hd is true and add different hd-resolutions (with albumart) to playlist. --- share/lua/playlist/appletrailers_iphone.lua | 19 +++++++++++++++---- share/lua/sd/appletrailers.lua | 4 ++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/share/lua/playlist/appletrailers_iphone.lua b/share/lua/playlist/appletrailers_iphone.lua index 5cb27e26c8..0797a6d7e3 100644 --- a/share/lua/playlist/appletrailers_iphone.lua +++ b/share/lua/playlist/appletrailers_iphone.lua @@ -34,14 +34,20 @@ end -- Parse function. function parse() p = {} + path="" + arturl="" + title="" + description="" while true do line = vlc.readline() if not line then break end - for path in string.gmatch( line, "http://trailers.apple.com/movies/.-%.mov" ) do - path = vlc.strings.decode_uri( path ) - path = string.gsub( path, "r320i.mov","h480p.mov") - table.insert( p, { path=path; name=title; description=description; options={"http-user-agent=Quicktime/7.2.0 vlc lua edition","input-fast-seek";};} ) + for urli in string.gmatch( line, "http://trailers.apple.com/movies/.-%.mov" ) do + path = vlc.strings.decode_uri( urli ) + vlc.msg.err(path) + end + for urli in string.gmatch( line, "http://.-%/poster.jpg") do + arturl = vlc.strings.decode_uri( urli ) end if string.match( line, "" ) then @@ -52,5 +58,10 @@ function parse() description = vlc.strings.resolve_xml_special_chars( find( line, "name=\"Description\" content=\"(.-)\"" ) ) end end + for index,resolution in ipairs({"480p","720p","1080p"}) do + path = string.gsub( path, "r320i.mov","h"..resolution..".mov") + vlc.msg.err(arturl) + table.insert( p, { path=path; name=title.." ("..resolution..")"; arturl=arturl; description=description; options={":http-user-agent=Quicktime/7.2.0 vlc lua edition",":input-fast-seek",":play-and-stop"};} ) + end return p end diff --git a/share/lua/sd/appletrailers.lua b/share/lua/sd/appletrailers.lua index b4ae05c04b..eea68cf94a 100644 --- a/share/lua/sd/appletrailers.lua +++ b/share/lua/sd/appletrailers.lua @@ -32,12 +32,12 @@ end function main() fd = vlc.stream( "http://trailers.apple.com/trailers/iphone/home/feeds/just_added.json" ) if not fd then return nil end - options = {"http-user-agent='iPhone'"} + options = {":http-user-agent='iPhone'"} while true do line = fd:readline() if not line then break end - if string.match( line, "title" ) then + if string.match( line, "title" ) and string.match( line, "hd\":true")then title = vlc.strings.resolve_xml_special_chars( find( line, "title\":\"(.-)\"")) art = find( line, "poster\":\"(.-)\"") url = find( line, "url\":\"(.-)\"") -- 2.39.2