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():
- oc = ObjectContainer(header="Empty", message="Search something")
- oc.add(InputDirectoryObject(key = Callback(Search), title = "Stream Search...", prompt = "Search for Streams"))
- 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):
- 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 = elements['title']
- )
- )
- return oc
- ####################################################################################################
- @route('/video/helloworldplugin/Streams')
- def Streams(title, href):
- oc = ObjectContainer(header="Empty", message="title: "+title+"\n href: "+href)
- # print(title);
- # print(href);
- return oc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement