def tv_add_all_to_library(items, noscan=False): library_folder = lib_tvshows.setup_library( plugin.get_setting('tv_library_folder', unicode)) ids = '' if 'results' in items: preids = [] for tvdb_show, tmdb_show in executor.execute(tmdb_to_tvdb, items['results'], workers=10): if tvdb_show is not None: preids.append(tvdb_show['id']) ids = '\n'.join(preids) else: ids = '\n'.join([ str(i['show']['ids']['tvdb']) if i['show']['ids']['tvdb'] != None and i['show']['ids']['tvdb'] != '' else i['show']['ids']['imdb'] for i in items ]) shows_batch_add_file = plugin.get_setting('tv_batch_add_file_path', unicode) if xbmcvfs.exists(shows_batch_add_file): batch_add_file = xbmcvfs.File(shows_batch_add_file) pre_ids = batch_add_file.read() xids = pre_ids.split('\n') for id in xids: if id != '' and id != None and id not in ids: ids = ids + str(id) + '\n' batch_add_file.close() xbmcvfs.delete(shows_batch_add_file) batch_add_file = xbmcvfs.File(shows_batch_add_file, 'w') batch_add_file.write(str(ids)) batch_add_file.close() xbmc.executebuiltin( 'RunPlugin(plugin://plugin.video.openmeta/tv/batch_add_to_library)')
def list_tvshows(response): items = [] results = response['results'] for tvdb_show, tmdb_show in executor.execute(tmdb_to_tvdb, results, workers=10): if tvdb_show is not None: info = build_tvshow_info(tvdb_show, tmdb_show) items.append(make_tvshow_item(info)) if xbmc.Monitor().abortRequested(): return if 'page' in response: page = response['page'] args = nav_base.caller_args() if page < response['total_pages']: args['page'] = str(page + 1) items.append({ 'label': '%s/%s [I]Next page[/I] >>' % (page + 1, response['total_pages']), 'path': plugin.url_for(nav_base.caller_name(), **args), 'thumbnail': plugin.get_media_icon('item_next'), 'fanart': plugin.get_addon_fanart() }) return items
def list_tvshows(response): items = [] results = response['results'] for tvdb_show, tmdb_show in executor.execute(tmdb_to_tvdb, results, workers=10): if tvdb_show is not None: try: info = build_tvshow_info(tvdb_show, tmdb_show) except Exception as e: xbmc.log('Failed to parse show, tvdbID: {}'.format(tvdb_show.get('id')), xbmc.LOGERROR) xbmc.log('Error: {}'.format(e), xbmc.LOGERROR) continue else: items.append(make_tvshow_item(info)) if xbmc.Monitor().abortRequested(): return if 'page' in response: page = response['page'] args = nav_base.caller_args() if page < response['total_pages']: args['page'] = str(page + 1) items.append( { 'label': '%s/%s [I]Next page[/I] >>' % (page + 1, response['total_pages']), 'path': plugin.url_for(nav_base.caller_name(), **args), 'thumbnail': plugin.get_media_icon('item_next'), 'fanart': plugin.get_addon_fanart() }) return items
def tvdb_tv_search_term(term, page): search_results = TVDB.search(term, language='en') items = [] load_full_tvshow = lambda tvshow : TVDB.get_show(tvshow['id'], full=True) for tvdb_show in executor.execute(load_full_tvshow, search_results, workers=10): info = build_tvshow_info(tvdb_show) items.append(make_tvshow_item(info)) return items