I write this code
`@handler(PREFIX, TITLE, thumb=ICON, art=ART)
def MainMenu():
oc = ObjectContainer()
content = HTTP.Request(BASE)
page = HTML.ElementFromString(content)
group_category = page.xpath(’//li/a[starts-with(@href , “http://www.phim.media/tim-kiem-phim-the-loai- ”)]/text()’)
oc.add(DirectoryObject(key=Callback(Group, title=u’Thể loại’, items=group_category), title=u’Thể loại’, thumb=R(ICON)))
return oc
@route (PREFIX + ‘/Group’)
def Group(title, items):
oc = ObjectContainer(title1=u’Danh sách phim’, title2=title, art=ObjectContainer.art)
for item in items[‘items’]:
oc.add(DirectoryObject(key=Callback(Page, title=item, page=1), title=item, thumb=R(ICON)))
return oc
`
I’m sure that group_category is a list ob string by accessing group_category’s elements.
However, when callback happen, the variable items I have in the Group function is type of ‘str’.
rols1
April 9, 2018, 6:55am
2
@“06.USA LIVE TV”
Hi again,
the callback is executed as http-call - so the parameters must be strings. To “feed” your function Group you can
use a url and build the list via xpath in function Group or
use a Dict to store the list, pass the Dict-key to the Callback and restore the Dict in function Group, e.g.:
...
content = HTTP.Request(BASE)
page = HTML.ElementFromString(content)
Dict['group_category'] = page.xpath(...).
oc.add(DirectoryObject(key=Callback(Group, title=u'Thể loại', key='group_category'), title=u'Thể loại', thumb=R(ICON)))
return oc
@route(PREFIX + '/Group')
def Group(title, key):
oc = ObjectContainer(title1=u'Danh sách phim', title2=title, art=ObjectContainer.art)
items = Dict[key]
for item in items:
oc.add(DirectoryObject(key=Callback(Page, title=item, page=1), title=item, thumb=R(ICON)))
return oc
/R
######Plugins: ARDMediathek2016 , Plex-Plugin-KIKA_und_tivi , Plex-Plugin-3Sat_Mediathek , Plex-Plugin-Flickr , Plex-Plugin-TagesschauXL , Plex-Plugin-Phoenix_Mediathek , TuneIn2017 , Shoutcast2017 , Plex-Plugin-ZDFmobile