Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NAME = 'helloworldplugin'
- SEARCH_URL = 'http://example.com/api.php'
- ####################################################################################################
- def Start():
- ObjectContainer.title1 = NAME
- # HTTP.CacheTime = CACHE_1HOUR
- ####################################################################################################
- @handler('/video/helloworldplugin', NAME)
- def MainMenu():
- ObjectContainer(header="Empty", message="Search something")2
- return oc
- ####################################################################################################
- @route('/video/helloworldplugin/search', allow_sync = True)
- def Search(query = 'video'):
- return ProcessRequest(title = query)
- ####################################################################################################
- @route('/video/helloworldplugin/{title}', params = dict, offset = int, allow_sync = True)
- def ProcessRequest(title, params, offset = 0, id = -1, type = "default"):
- oc = ObjectContainer(title2 = title)
- data = JSON.ObjectFromURL(SEARCH_URL+'?search='+title)
- for elements in data:
- oc.add(
- DirectoryObject(
- key = Callback(Streams, title=elements['title'], href=elements['href']),
- title = title
- )
- )
- return oc
- ####################################################################################################
- @route('/video/helloworldplugin/Streams')
- def Streams(title, href):
- print(title);
- print(href);
- return oc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement