def menu(filter=''): show_info = GetShowInfo(filter) show_total = len(show_info) for show_name, name, tvdbid, thumbnail_path, fanart_path, paused in show_info: context_menu_items = [] context_menu_items.append(('Show Info', 'XBMC.Action(Info)')) context_menu_items.append( ('ExtendedInfo', 'XBMC.RunPlugin(plugin://plugin.video.sickrage?tvdb_id=' + urllib.quote_plus(str(tvdbid)) + '&mode=10&show_name=' + urllib.quote_plus(show_name.encode("utf-8")) + ')')) context_menu_items.append( ('Episode List', 'XBMC.Container.Update(plugin://plugin.video.sickrage?tvdb_id=' + urllib.quote_plus(str(tvdbid)) + '&mode=4&show_name=' + urllib.quote_plus(show_name.encode("utf-8")) + ')')) context_menu_items.append(( 'Add New Show', 'XBMC.RunScript(special://home/addons/plugin.video.sickrage/resources/lib/addshow.py, new)' )) context_menu_items.append(( 'Delete Show', 'XBMC.RunScript(special://home/addons/plugin.video.sickrage/resources/lib/deleteshow.py, ' + tvdbid + ', ' + show_name + ')')) context_menu_items.append(( 'Force Update', 'XBMC.RunScript(special://home/addons/plugin.video.sickrage/resources/lib/forcesearch.py, ' + tvdbid + ')')) context_menu_items.append(( paused + ' Show', 'XBMC.RunScript(special://home/addons/plugin.video.sickrage/resources/lib/setpausestate.py, ' + paused + ', ' + tvdbid + ')')) context_menu_items.append( ('Update Show Images', 'XBMC.RunPlugin(plugin://plugin.video.sickrage?tvdb_id=' + urllib.quote_plus(str(tvdbid)) + '&mode=13&show_name=' + urllib.quote_plus(show_name.encode("utf-8")) + ')')) if xbmc.getCondVisibility( 'System.HasAddon(context.videolookup.dialog)'): context_menu_items.append( ('Video Lookup', 'XBMC.RunScript(context.videolookup.dialog)')) context_menu_items.append(( 'Refresh List', 'XBMC.RunScript(special://home/addons/plugin.video.sickrage/resources/lib/refresh.py)' )) context_menu_items.append(('Go Back', 'XBMC.Action(back)')) addShowDirectory(show_name, name, tvdbid, 4, thumbnail_path, fanart_path, show_total, context_menu_items) xbmcplugin.addSortMethod( handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE) xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') common.CreateNotification(header='Show List', message=str(show_total) + ' Shows in list', icon=xbmcgui.NOTIFICATION_INFO, time=5000, sound=False)
def menu(tvdbid, show_name, season): list = GetSeasonEpisodes(tvdbid, season) total_items = len(list) season_numbers = [] for ep_number, name, status, airdate, ep_tvdbid, ep_season in list: season_numbers.append(str(ep_number)) season_status_args = ", " + ep_tvdbid + ", " + ep_season + ", " + "|".join( season_numbers) episode_status_args = ", " + ep_tvdbid + ", " + ep_season + ", " + ep_number context_items = [] context_items.append(('Show Info', 'XBMC.Action(Info)')) context_items.append( ('Open Show Folder', 'XBMC.RunPlugin(plugin://{0}?mode={1}&tvdb_id={2}&show_name={3})'. format(pluginID, 15, tvdbid, urllib.quote_plus(show_name.encode("utf-8"))))) if xbmc.getCondVisibility('System.HasAddon(script.extendedinfo)'): context_items.append(( 'ExtendedInfo', 'XBMC.RunScript(script.extendedinfo, info=extendedtvinfo, tvdb_id={0})' .format(tvdbid))) context_items.append(( 'Set Episode Status', 'XBMC.RunScript(special://home/addons/{0}/resources/lib/setstatus.py{1})' .format(pluginID, episode_status_args))) context_items.append(( 'Set Season Status', 'XBMC.RunScript(special://home/addons/{0}/resources/lib/setstatus.py{1})' .format(pluginID, season_status_args))) context_items.append(( 'Download Episode', 'XBMC.RunScript(special://home/addons/{0}/resources/lib/manualsearch.py{1})' .format(pluginID, episode_status_args))) context_items.append(( 'Update Cache from TVdb', 'XBMC.RunScript(special://home/addons/{0}/resources/lib/cache.py, {1}, {2}, {3})' .format(pluginID, tvdbid, season, ep_number))) context_items.append(('Refresh List', 'XBMC.Container.Refresh')) context_items.append(('Go Back', 'XBMC.Action(back)')) thumbnail_path = Sickbeard.GetShowPoster(tvdbid) fanart_path = Sickbeard.GetShowFanArt(tvdbid) banner_path = Sickbeard.GetShowBanner(tvdbid) addDirectory(show_name, season, ep_number, name, status, airdate, tvdbid, thumbnail_path, fanart_path, banner_path, total_items, context_items) xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_DATE) xbmcplugin.addSortMethod( handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE) xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') xbmcplugin.endOfDirectory(int(sys.argv[1])) common.CreateNotification(header='Show List', message=str(total_items) + ' Shows in list', icon=xbmcgui.NOTIFICATION_INFO, time=3000, sound=False)
def AddShow(show_name=''): text = showSearchDialog(show_name) if (text == ''): exit() # Search for the show using SB search API. OK = True while OK: try: xbmc.executebuiltin("ActivateWindow(busydialog)") search_results = Sickbeard.SearchShowName(urllib.quote_plus(text)) if not search_results: xbmc.executebuiltin("Dialog.Close(busydialog)") common.CreateNotification(header="Show Search", message="No results for that query.", icon=xbmcgui.NOTIFICATION_INFO, time=4000, sound=True) exit() finally: xbmc.executebuiltin("Dialog.Close(busydialog)") # Create dir list of possible shows to view and select from. selected_show = ShowSelectMenu(search_results) if (selected_show == -1): exit() tvdbid = str(search_results[selected_show]['tvdbid']) show_name = search_results[selected_show]['name'] first_aired = search_results[selected_show]['first_aired'] DisplayShow(tvdbid, show_name, first_aired) if common.selectNoYes( 'Add this show? [ {0} ]'.format(show_name[:25] + ' (' + first_aired + ')'), 'No', 'Yes') == 1: #ShowMessage('Selected Title', search_results[selected_show]['name']) AddShowDetails(tvdbid, show_name) exit()
def menu(filter='All'): show_info = GetShowInfo(filter) total_items = len(show_info) for show_name, name, tvdbid, paused, next_airdate in show_info: # This is intended for general show info, so we force the use of Season 1, Episode 1 for generic reasons. We can assume that all shows have at least 1 episode. season = 1 episode = 1 context_items = [] context_items.append(('Show Info', 'XBMC.Action(Info)')) context_items.append( ('Open Show Folder', 'XBMC.RunPlugin(plugin://{0}?mode={1}&tvdb_id={2}&show_name={3})'. format(pluginID, 15, tvdbid, urllib.quote_plus(show_name.encode("utf-8"))))) if xbmc.getCondVisibility('System.HasAddon(script.extendedinfo)'): context_items.append(( 'ExtendedInfo', 'XBMC.RunScript(script.extendedinfo, info=extendedtvinfo, tvdb_id={0})' .format(tvdbid))) context_items.append(( 'Episode List', 'XBMC.Container.Update(plugin://{0}?mode={1}&tvdb_id={2}&show_name={3})' .format(pluginID, 4, tvdbid, urllib.quote_plus(show_name.encode("utf-8"))))) context_items.append(( 'Add New Show', 'XBMC.RunScript(special://home/addons/{0}/resources/lib/addshow.py)' .format(pluginID))) context_items.append(( 'Delete Show', 'XBMC.RunScript(special://home/addons/{0}/resources/lib/deleteshow.py, {1}, {2})' .format(pluginID, tvdbid, show_name))) context_items.append(( paused + ' Show', 'XBMC.RunScript(special://home/addons/{0}/resources/lib/setpausestate.py, {1}, {2})' .format(pluginID, paused, tvdbid))) context_items.append(( 'Force Server Update', 'XBMC.RunScript(special://home/addons/{0}/resources/lib/forcesearch.py, {1})' .format(pluginID, tvdbid))) context_items.append(( 'Update Cache from TVdb', 'XBMC.RunScript(special://home/addons/{0}/resources/lib/cache.py, {1}, {2}, {3})' .format(pluginID, tvdbid, season, episode))) context_items.append(('Refresh List', 'XBMC.Container.Refresh')) context_items.append(('Go Back', 'XBMC.Action(back)')) thumbnail_path = Sickbeard.GetShowPoster(tvdbid) fanart_path = Sickbeard.GetShowFanArt(tvdbid) banner_path = Sickbeard.GetShowBanner(tvdbid) addDirectory(show_name, name, tvdbid, season, episode, next_airdate, thumbnail_path, fanart_path, banner_path, total_items, context_items) xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_DATE) xbmcplugin.addSortMethod( handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE) xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') xbmcplugin.endOfDirectory(int(sys.argv[1])) common.CreateNotification(header='Show List', message=str(total_items) + ' Shows in list', icon=xbmcgui.NOTIFICATION_INFO, time=3000, sound=False)
except Exception, e: common.messageWindow(diag_title, 'ERROR Saving show images: ' + str(e)) # Save actor images to cache: try: pass #actors = data.get('Actors', []) #actors = TvdbApi.CacheActorImages(actors, actor_cache_dir, force) except Exception, e: common.messageWindow(diag_title, 'ERROR Saving actor meta data: ' + str(e)) if force: show_name = TvdbApi.getFromDict(data, ['Show', 'seriesName'], 'Unknown') title = TvdbApi.getFromDict(data, ['Details', 'episodeName'], 'Unknown') msg = u'{0}[CR]{1}[CR]Season: {2} Epsiode: {3}[CR]TVdb: {4}'.format(show_name, title, season, episode, tvdbid) common.CreateNotification(header=diag_title, message=msg, icon=xbmcgui.NOTIFICATION_INFO, time=3000, sound=False) # Clear image file cache. def ClearImages(): # Show images. path = image_cache_dir if os.path.exists(path): for file in os.listdir(path): if file.lower().endswith(".jpg"): os.unlink(os.path.join(path, file)) for file in os.listdir(path): if file.lower().endswith(".png"): os.unlink(os.path.join(path, file)) # Actor images. path = actor_cache_dir