From a1ad237835102a5468facf62c3e6c5584bb4f933 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Andr=C3=A9?= Date: Fri, 4 Jun 2010 19:11:39 +0800 Subject: [PATCH] =?utf8?q?Lua:=20update=20Allocin=C3=A9=20script=20&=20rem?= =?utf8?q?ove=20debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- share/lua/extensions/allocine-fr.lua | 83 ++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 16 deletions(-) diff --git a/share/lua/extensions/allocine-fr.lua b/share/lua/extensions/allocine-fr.lua index 5d154a2ecd..e095cda925 100644 --- a/share/lua/extensions/allocine-fr.lua +++ b/share/lua/extensions/allocine-fr.lua @@ -37,7 +37,7 @@ films = {} function descriptor() return { title = "Allociné (France)" ; version = "1.0" ; - author = "Jean-Philippe André" ; + author = "VideoLAN" ; url = 'http://www.allocine.fr/'; shortdesc = "Allocine.com"; description = "
ALLOCINE.COM
" @@ -171,9 +171,6 @@ function click_chercher() if category == "Films" or category == "Séries TV" then -- Read tag as xml local substring = string.sub(data, first, last or -1) - print("\n") - print(substring) - print("\n") local xml = simplexml.parse_string(substring) for _, tr in ipairs(xml.children) do @@ -254,13 +251,9 @@ function click_okay() local selection = list:get_selection() if not selection then return end - local sel = nil - for idx, selectedItem in pairs(selection) do - sel = idx - break - end - + local sel, _ = next(selection, nil) if not sel then return end + message_text = "
" .. films[sel].title .. "
" message:set_text(message_text) dlg:update() @@ -287,14 +280,72 @@ function open_fiche(url) local s = vlc.stream(url) local data = s:read(65535) - -- HACK: use directly HTML data from webpage - local first, _ = string.find(data, '
') + -- Buffer & temp variables + local first = nil + local last = nil + local page = nil + local sub = nil + local name = nil + + first, _ = string.find(data, '
') + + if not first then + message:set_text("

Erreur !

Désolé, une erreur est survenue pendant le chargement de la fiche.
" + .. "Cliquez ici pour consulter la page sur Allociné.fr.") + dlg:del_widget(html) + return + end + + -- Extract information local last, _ = string.find(data, '