def get_channels(self): live = [] threads = [] if control.is_globoplay_available(): threads.append(workers.Thread(self.append_result, globoplay.Indexer().get_live_channels, live)) if control.is_globosat_available(): threads.append(workers.Thread(self.append_result, globosat.Indexer().get_live, live)) if control.show_adult_content: threads.append(workers.Thread(self.append_result, sexyhotplay.Indexer().get_live_channels, live)) if control.is_oiplay_available(): threads.append(workers.Thread(self.append_result, oiplay.get_live_channels, live)) if control.is_tntplay_available(): threads.append(workers.Thread(self.append_result, tntplay.get_live_channels, live)) if control.is_nowonline_available(): threads.append(workers.Thread(self.append_result, netnow.get_live_channels, live)) [i.start() for i in threads] [i.join() for i in threads] live = sorted(live, key=lambda k: k['sorttitle']) # live = sorted(live, key=lambda k: '1' if 'isFolder' in k and k['isFolder'] == 'true' else '0') live = sorted(live, key=lambda k: k['dateadded'] if 'dateadded' in k else None, reverse=True) # shuffle(live) self.channel_directory(live) return live
def root(self): if control.is_globosat_available() or control.is_globoplay_available( ) or control.is_oiplay_available() or control.is_tntplay_available(): self.add_directory_item(32001, 'liveChannels', 'live.png', 'live.png') if control.is_globosat_available( ) or control.is_globoplay_available(): self.add_directory_item(32002, 'vodChannels', 'ondemand.png', 'ondemand.png') else: self.add_directory_item(32005, 'settings', 'tools.png', 'tools.png') if control.is_globosat_available(): self.add_directory_item(32080, 'featured', 'featured.png', 'featured.png') self.add_directory_item(32090, 'favorites', 'favorites.png', 'favorites.png') self.add_directory_item(32095, 'watchlater', 'userlists.png', 'userlists.png') self.add_directory_item(32096, 'watchhistory', 'years.png', 'years.png') if control.is_globosat_available() or control.is_globoplay_available(): self.add_directory_item(32010, 'searchMenu', 'search.png', 'search.png') # control.addSortMethod(int(sys.argv[1]), control.SORT_METHOD_LABEL_IGNORE_FOLDERS) control.content(syshandle, 'files') self.end_directory()
def get_channels(): live = [] threads = [] if control.is_globoplay_available(): threads.append(workers.Thread(globoplay.get_live_channels)) if control.is_globosat_available(): threads.append(workers.Thread(globosat.get_live_channels)) if control.show_adult_content: threads.append(workers.Thread(sexyhotplay.get_broadcast)) if control.is_oiplay_available(): threads.append(workers.Thread(oiplay.get_live_channels)) if control.is_tntplay_available(): threads.append(workers.Thread(tntplay.get_live_channels)) if control.is_nowonline_available(): threads.append(workers.Thread(netnow.get_live_channels)) if control.is_sbt_available(): threads.append(workers.Thread(sbt.get_live_channels)) if control.is_pluto_available(): threads.append(workers.Thread(pluto.get_live_channels)) [i.start() for i in threads] [i.join() for i in threads] [live.extend(i.get_result()) for i in threads if i.get_result()] control.log(live) for channel in live: channel.update({ 'sort': [ control.SORT_METHOD_DATEADDED, (control.SORT_METHOD_LABEL_IGNORE_FOLDERS, '%U'), (control.SORT_METHOD_VIDEO_SORT_TITLE, '%U'), (control.SORT_METHOD_STUDIO, '%L') ], 'overlay': 4, 'playcount': 0, 'content': 'tvshows', # 'content': 'tvshows', # content: files, songs, artists, albums, movies, tvshows, episodes, musicvideos 'mediatype': 'episode', # 'mediatype': "video", "movie", "tvshow", "season", "episode" or "musicvideo" }) properties = channel.get('properties', {}) if not properties: channel['properties'] = properties properties.update({'ResumeTime': 0.0}) return live
def root(): if control.is_live_available(): handler = live.__name__ method = 'get_channels' yield add_directory_item(handler, method, 32001, 'live.png') if control.is_vod_available(): handler = vod.__name__ method = 'get_vod_channels_directory' yield add_directory_item(handler, method, 32002, 'ondemand.png') if not control.is_live_available() and not control.is_vod_available(): handler = __name__ method = 'open_settings' yield add_directory_item(handler, method, 32005, 'tools.png') if control.is_globosat_available() or control.is_globoplay_available( ) or control.is_telecine_available() or control.is_oiplay_available( ) or control.is_nowonline_available() or control.is_tntplay_available(): handler = __name__ method = 'search' yield add_directory_item(handler, method, 32010, 'search.png')
def get_vod_channels_directory(): channels = [] if control.is_globosat_available(): channels.extend(globosat.get_authorized_channels()) if control.show_adult_content: channels.extend(sexyhot.get_channels()) if control.is_globoplay_available(): channels.extend(globoplay.get_globoplay_channels()) if control.is_tntplay_available(): channels.extend(tnt_vod.get_channels()) if control.is_nowonline_available(): channels.extend(netnow.get_channels()) if control.is_telecine_available(): channels.extend(telecine.get_channels()) if control.is_oiplay_available(): channels.extend(oiplay.get_channels()) if control.is_pluto_available(): channels.extend(pluto.get_channels()) if not control.show_adult_content: channels = [ channel for channel in channels if not channel.get("adult", False) ] for channel in channels: channel.update({'sort': control.SORT_METHOD_LABEL}) yield channel
def search(query, page=1): if not query: yield control.run_plugin_url() return print('[BRplay] - search: %s | %s' % (query, page)) threads = [] if control.is_globoplay_available(): threads.append( workers.Thread(convert_to_list, globoplay.search, query, page)) if control.is_globosat_available(): threads.append( workers.Thread(convert_to_list, globosat.search, query, page)) if control.is_telecine_available(): threads.append( workers.Thread(convert_to_list, telecine.search, query, page)) if control.is_oiplay_available(): threads.append( workers.Thread(convert_to_list, oiplay.search, query, page)) if control.is_nowonline_available(): threads.append( workers.Thread(convert_to_list, netnow.search, query, page)) if control.is_tntplay_available(): threads.append( workers.Thread(convert_to_list, tnt_vod.search, query, page)) [i.start() for i in threads] [i.join() for i in threads] random.shuffle(threads) all_results = (thread.get_result() for thread in threads) control.log(all_results) combined = list(roundrobin(*all_results)) # combined = chain(*all_results) has_next_page = False if not combined: control.okDialog(line1=control.lang(34141).encode('utf-8'), heading=control.lang(32010).encode('utf-8')) yield control.run_plugin_url() return rank = 1 for result in combined: if result.get('page'): has_next_page = True continue result.update({ 'sort': [(control.SORT_METHOD_UNSORTED, '%U'), control.SORT_METHOD_STUDIO], # 'sort': [(control.SORT_METHOD_TRACKNUM, '%U'), control.SORT_METHOD_STUDIO, (control.SORT_METHOD_LABEL_IGNORE_FOLDERS, '%U')], 'tracknumber': rank, 'sorttitle': '%04d' % (rank, ), 'content': 'episodes', 'mediatype': 'video' }) rank += 1 yield result if has_next_page: yield { 'handler': __name__, 'method': 'search', 'query': query, 'page': page + 1, 'label': '%s (%s)' % (control.lang(34136).encode('utf-8'), page + 1), 'art': { 'poster': control.addonNext(), 'fanart': control.addonFanart() }, 'properties': { 'SpecialSort': 'bottom' } }