From: Jean-Philippe André Date: Fri, 4 Jun 2010 11:11:39 +0000 (+0800) Subject: Lua: update Allociné script & remove debug X-Git-Tag: 1.2.0-pre1~6308 X-Git-Url: https://git.sesse.net/?p=vlc;a=commitdiff_plain;h=a1ad237835102a5468facf62c3e6c5584bb4f933 Lua: update Allociné script & remove debug --- 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, '