def router(): mode = ARGS.get('mode', None) instance = module = classname = None if mode is not None and mode[0] != 'globalsearch' and mode[ 0] != 'doglobalsearch' and mode[0] != 'clearsearch': instance, module, classname = get_plugin(ARGS) if mode is None: onInit() elif mode[0] == 'category': print("*********************** Display category") if 'subcategory' in ARGS: list_category(cats=json.loads(ARGS.get('subcategory')[0]), module=module, classname=classname) else: cats, movies = instance().getCategory() list_category(cats=cats, movies=movies, module=module, classname=classname) elif mode[0] == 'movies': link = ARGS.get('url')[0] page = int(ARGS.get('page')[0]) print("*********************** Display {} page {}".format(link, page)) movies = instance().getChannel(link, page) list_movie(movies, link, page, module, classname) elif mode[0] == 'movie': # id = ARGS.get('url')[0] movie_item = json.loads(ARGS.get('movie_item')[0]) movie = instance().getMovie(movie_item.get('id')) print("*********************** Display movie {}".format( movie_item.get('title').encode('utf8'))) if len(movie['episode']) > 0 or len(movie['group']) > 0: print("*********************** Display movie episode") show_episode(movie, movie_item, module, classname) else: print("*********************** Display movie links") show_links(movie, movie_item, module, classname) elif mode[0] == 'server': server = ARGS.get('server')[0] items = json.loads(ARGS.get('items')[0]) movie_item = json.loads(ARGS.get('movie_item')[0]) print("*********************** Display movie server link group") show_server_links(items, movie_item, server, module, classname) elif mode[0] == 'links': url = ARGS.get('url')[0] title = ARGS.get('title')[0] thumb = ARGS.get('thumb')[0] print("*********************** Get Movie Link {}".format(url)) movie = instance().getLink(url) show_links(movie, title, thumb, module, classname) elif mode[0] == 'play': print("*********************** Play movie") url = ARGS.get('url')[0] direct = int(ARGS.get('direct')[0]) movie_item = json.loads(ARGS.get('movie_item')[0]) if direct is 0: movie = instance().getLink(json.loads(url)) else: movie = json.loads(url) play(movie, movie_item, direct) elif mode[0] == 'search': search(module, classname) elif mode[0] == 'globalsearch': global_search() elif mode[0] == 'doglobalsearch': text = ARGS.get('url') and ARGS.get('url')[0] or None do_global_search(text) elif mode[0] == 'dosearch': text = ARGS.get('url') and ARGS.get('url')[0] or None dosearch(instance, module, classname, text) elif mode[0] == 'clearsearch': XbmcHelper.search_history_clear() return
def router(): mode = ARGS.get('mode', None) instance = module = classname = None if mode is not None: instance, module, classname = get_plugin(ARGS) if mode is None: onInit() elif mode[0] == 'category': if 'subcategory' in ARGS: list_category(json.loads(ARGS.get('subcategory')[0]), module, classname) else: list_category(instance().getCategory(), module, classname) elif mode[0] == 'movies': link = ARGS.get('url')[0] page = int(ARGS.get('page')[0]) print("*********************** Display %s page %s" % (link, page)) movies = instance().getChannel(link, page) list_movie(movies, link, page, module, classname) elif mode[0] == 'movie': id = ARGS.get('url')[0] thumb = ARGS.get('thumb')[0] title = ARGS.get('title')[0] movie = instance().getMovie(id) print("*********************** Display movie %s %s" % (title, id)) if len(movie['episode']) > 0 or len(movie['group']) > 0: show_episode(movie, thumb, title, module, classname) else: show_links(movie, title, thumb, module, classname) elif mode[0] == 'server': thumb = ARGS.get('thumb')[0] title = ARGS.get('title')[0] server = ARGS.get('server')[0] items = json.loads(ARGS.get('items')[0]) show_server_links(items, title, thumb, server, module, classname) elif mode[0] == 'links': url = ARGS.get('url')[0] title = ARGS.get('title')[0] thumb = ARGS.get('thumb')[0] print("*********************** Get Movie Link %s" % url) movie = instance().getLink(url) show_links(movie, title, thumb, module, classname) elif mode[0] == 'play': print("*********************** Play movie") url = ARGS.get('url')[0] title = ARGS.get('title')[0] thumb = ARGS.get('thumb')[0] direct = int(ARGS.get('direct')[0]) if direct is 0: movie = instance().getLink(json.loads(url)) else: movie = json.loads(url) play(movie, title, thumb, direct) elif mode[0] == 'search': search(module, classname) elif mode[0] == 'dosearch': text = ARGS.get('url') and ARGS.get('url')[0] or None dosearch(instance, module, classname, text) elif mode[0] == 'clearsearch': XbmcHelper.search_history_clear() return
def router(): mode = ARGS.get('mode', None) instance = module = classname = None if mode is not None and mode[0] != 'globalsearch' and mode[ 0] != 'doglobalsearch' and mode[0] != 'clearsearch': instance, module, classname = get_plugin(ARGS) if mode is None: onInit() elif mode[0] == 'category': if 'subcategory' in ARGS: list_category(json.loads(ARGS.get('subcategory')[0]), module, classname) else: list_category(instance().getCategory(), module, classname) elif mode[0] == 'movies': link = ARGS.get('url')[0] page = int(ARGS.get('page')[0]) print("*********************** Display %s page %s" % (link, page)) movies = instance().getChannel(link, page) list_movie(movies, link, page, module, classname) elif mode[0] == 'movie': id = ARGS.get('url')[0] thumb = ARGS.get('thumb')[0] title = ARGS.get('title')[0] movie = instance().getMovie(id) print("*********************** Display movie %s %s" % (title, id)) if len(movie['episode']) > 0 or len(movie['group']) > 0: show_episode(movie, thumb, title, module, classname) else: show_links(movie, title, thumb, module, classname) elif mode[0] == 'server': thumb = ARGS.get('thumb')[0] title = ARGS.get('title')[0] server = ARGS.get('server')[0] items = json.loads(ARGS.get('items')[0]) show_server_links(items, title, thumb, server, module, classname) elif mode[0] == 'links': url = ARGS.get('url')[0] title = ARGS.get('title')[0] thumb = ARGS.get('thumb')[0] print("*********************** Get Movie Link %s" % url) movie = instance().getLink(url) show_links(movie, title, thumb, module, classname) elif mode[0] == 'play': print("*********************** Play movie") url = ARGS.get('url')[0] title = ARGS.get('title')[0] thumb = ARGS.get('thumb')[0] direct = int(ARGS.get('direct')[0]) if direct is 0: movie = instance().getLink(json.loads(url)) else: movie = json.loads(url) play(movie, title, thumb, direct) elif mode[0] == 'search': search(module, classname) elif mode[0] == 'globalsearch': global_search() elif mode[0] == 'doglobalsearch': text = ARGS.get('url') and ARGS.get('url')[0] or None do_global_search(text) elif mode[0] == 'dosearch': text = ARGS.get('url') and ARGS.get('url')[0] or None dosearch(instance, module, classname, text) elif mode[0] == 'clearsearch': XbmcHelper.search_history_clear() return
def clear_search(): helper.search_history_clear() return