def tv_add_to_library(id): import_tvdb() library_folder = setup_library(plugin.get_setting(SETTING_TV_LIBRARY_FOLDER)) show = tvdb[int(id)] imdb = show['imdb_id'] # get active players players = active_players("tvshows", filters = {'network': show.get('network')}) # get selected player if plugin.get_setting(SETTING_TV_DEFAULT_AUTO_ADD, bool) == True: player = plugin.get_setting(SETTING_TV_DEFAULT_PLAYER_FROM_LIBRARY, unicode) else: players.insert(0, ADDON_SELECTOR) players.insert(0, ADDON_DEFAULT) selection = dialogs.select(_("Play with..."), [p.title for p in players]) if selection == -1: return player = players[selection] # setup library folder library_folder = setup_library(plugin.get_setting(SETTING_TV_LIBRARY_FOLDER)) # add to library if plugin.get_setting('tv_default_auto_add', bool): if add_tvshow_to_library(library_folder, show, player): set_property("clean_library", 1) else: if add_tvshow_to_library(library_folder, show, player.id): set_property("clean_library", 1) # start scan scan_library(type="video")
def tv_add_to_library(id): import_tvdb() show = tvdb[int(id)] # get active players players = active_players("tvshows", filters = {'network': show.get('network')}) # add default and selector options players.insert(0, ADDON_SELECTOR) players.insert(0, ADDON_DEFAULT) # let the user select one player selection = dialogs.select(_("Play with..."), [p.title for p in players]) if selection == -1: return # get selected player player = players[selection] # setup library folder library_folder = setup_library(plugin.get_setting(SETTING_TV_LIBRARY_FOLDER)) # add to library if add_tvshow_to_library(library_folder, show, player.id): set_property("clean_library", 1) # start scan scan_library()
def tv_add_to_library(id): import_tvdb() show = tvdb[int(id)] # get active players players = active_players("tvshows", filters={'network': show.get('network')}) # add default and selector options players.insert(0, ADDON_SELECTOR) players.insert(0, ADDON_DEFAULT) # let the user select one player selection = dialogs.select(_("Play with..."), [p.title for p in players]) if selection == -1: return # get selected player player = players[selection] # setup library folder library_folder = setup_library( plugin.get_setting(SETTING_TV_LIBRARY_FOLDER)) # add to library if add_tvshow_to_library(library_folder, show, player.id): set_property("clean_library", 1) # start scan scan_library()
def tv_batch_add_to_library(): """ Batch add tv shows to library """ tv_batch_file = plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH) if xbmcvfs.exists(tv_batch_file): try: f = open(xbmc.translatePath(tv_batch_file), 'r') r = f.read() f.close() ids = r.split('\n') except: return plugin.notify(msg='TVShows Batch Add File', title='Not found', delay=3000, image=get_icon_path("tv")) library_folder = setup_library(plugin.get_setting(SETTING_TV_LIBRARY_FOLDER)) import_tvdb() for id in ids: if "," in id: csvs = id.split(',') for csv in csvs: if str(csv).startswith("tt") and csv != "": tvdb_id = get_tvdb_id_from_imdb_id(csv) else: tvdb_id = csv show = tvdb[int(tvdb_id)] batch_add_tvshows_to_library(library_folder, show) else: if str(id).startswith("tt") and id != "": tvdb_id = get_tvdb_id_from_imdb_id(id) else: tvdb_id = id if tvdb_id != "" and tvdb_id != None: show = tvdb[int(tvdb_id)] batch_add_tvshows_to_library(library_folder, show) os.remove(xbmc.translatePath(tv_batch_file)) plugin.notify(msg='Adding tvshow strm-files', title='Starting library scan afterwards', delay=3000, image=get_icon_path("tv")) update_library() return True
def tv_add_all_to_library(items): import_tvdb() # setup library folder library_folder = setup_library(plugin.get_setting(SETTING_TV_LIBRARY_FOLDER)) # add to library for item in items: ids = item["show"]["ids"] tvdb_id = ids.get('tvdb') if not tvdb_id: continue show = tvdb[int(tvdb_id)] if add_tvshow_to_library(library_folder, show, ADDON_DEFAULT.id): set_property("clean_library", 1) # start scan scan_library()
def tv_add_all_to_library(items): import_tvdb() # setup library folder library_folder = setup_library(plugin.get_setting(SETTING_TV_LIBRARY_FOLDER)) # add to library for item in items: ids = item["show"]["ids"] tvdb_id = ids.get('tvdb') if not tvdb_id: continue show = tvdb[int(tvdb_id)] if plugin.get_setting(SETTING_TV_DEFAULT_AUTO_ADD, bool) == True: if add_tvshow_to_library(library_folder, show, plugin.get_setting(SETTING_TV_DEFAULT_PLAYER_FROM_LIBRARY, unicode)): set_property("clean_library", 1) else: if add_tvshow_to_library(library_folder, show, ADDON_DEFAULT.id): set_property("clean_library", 1) # start scan scan_library(type="video")