def subtitleMissed(self, whichSubs=None): t = PageTemplate(rh=self, filename='manage_subtitleMissed.mako') if not whichSubs: return t.render(whichSubs=whichSubs, topmenu='manage', show_names=None, ep_counts=None, sorted_show_ids=None, controller='manage', action='subtitleMissed') main_db_con = db.DBConnection() status_results = main_db_con.select( b'SELECT show_name, tv_shows.show_id, tv_shows.indexer, ' b'tv_shows.indexer_id as indexer_id, tv_episodes.subtitles subtitles ' b'FROM tv_episodes, tv_shows ' b'WHERE tv_shows.subtitles = 1 ' b'AND tv_episodes.status LIKE \'%4\' ' b'AND tv_episodes.season != 0 ' b'AND tv_episodes.location != \'\' ' b'AND tv_episodes.showid = tv_shows.indexer_id ' b'AND tv_episodes.indexer = tv_shows.indexer ' b'ORDER BY show_name') ep_counts = {} show_names = {} sorted_show_ids = [] for cur_status_result in status_results: if whichSubs == 'all': if not frozenset(subtitles.wanted_languages()).difference( cur_status_result[b'subtitles'].split(',')): continue elif whichSubs in cur_status_result[b'subtitles']: continue # FIXME: This will cause multi-indexer results where series_id overlaps for different indexers. # Fix by using tv_shows.show_id in stead. cur_indexer_id = int(cur_status_result[b'indexer']) cur_series_id = int(cur_status_result[b'indexer_id']) if (cur_indexer_id, cur_series_id) not in ep_counts: ep_counts[(cur_indexer_id, cur_series_id)] = 1 else: ep_counts[(cur_indexer_id, cur_series_id)] += 1 show_names[(cur_indexer_id, cur_series_id)] = cur_status_result[b'show_name'] if (cur_indexer_id, cur_series_id) not in sorted_show_ids: sorted_show_ids.append((cur_indexer_id, cur_series_id)) return t.render(whichSubs=whichSubs, show_names=show_names, ep_counts=ep_counts, sorted_show_ids=sorted_show_ids, title='Missing Subtitles', header='Missing Subtitles', topmenu='manage', controller='manage', action='subtitleMissed')
def episodeStatuses(self, whichStatus=None): if whichStatus: status_list = [int(whichStatus)] if status_list[0] == SNATCHED: status_list = Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST else: status_list = [] t = PageTemplate(rh=self, filename='manage_episodeStatuses.mako') # if we have no status then this is as far as we need to go if not status_list: return t.render(title='Episode Overview', header='Episode Overview', topmenu='manage', show_names=None, whichStatus=whichStatus, ep_counts=None, sorted_show_ids=None, controller='manage', action='episodeStatuses') main_db_con = db.DBConnection() status_results = main_db_con.select( b'SELECT show_name, tv_shows.indexer, tv_shows.show_id, tv_shows.indexer_id AS indexer_id ' b'FROM tv_episodes, tv_shows ' b'WHERE season != 0 ' b'AND tv_episodes.showid = tv_shows.indexer_id ' b'AND tv_episodes.indexer = tv_shows.indexer ' b'AND tv_episodes.status IN ({statuses}) ' b'ORDER BY show_name'.format(statuses=','.join(['?'] * len(status_list))), status_list) ep_counts = {} show_names = {} sorted_show_ids = [] for cur_status_result in status_results: cur_indexer = int(cur_status_result[b'indexer']) cur_series_id = int(cur_status_result[b'indexer_id']) if (cur_indexer, cur_series_id) not in ep_counts: ep_counts[(cur_indexer, cur_series_id)] = 1 else: ep_counts[(cur_indexer, cur_series_id)] += 1 show_names[(cur_indexer, cur_series_id)] = cur_status_result[b'show_name'] if (cur_indexer, cur_series_id) not in sorted_show_ids: sorted_show_ids.append((cur_indexer, cur_series_id)) return t.render(title='Episode Overview', header='Episode Overview', topmenu='manage', whichStatus=whichStatus, show_names=show_names, ep_counts=ep_counts, sorted_show_ids=sorted_show_ids, controller='manage', action='episodeStatuses')
def subtitleMissed(self, whichSubs=None): t = PageTemplate(rh=self, filename='manage_subtitleMissed.mako') if not whichSubs: return t.render(whichSubs=whichSubs, show_names=None, ep_counts=None, sorted_show_ids=None, controller='manage', action='subtitleMissed') main_db_con = db.DBConnection() status_results = main_db_con.select( 'SELECT show_name, tv_shows.show_id, tv_shows.indexer, ' 'tv_shows.indexer_id as indexer_id, tv_episodes.subtitles subtitles ' 'FROM tv_episodes, tv_shows ' 'WHERE tv_shows.subtitles = 1 ' 'AND tv_episodes.status = ? ' 'AND tv_episodes.season != 0 ' "AND tv_episodes.location != '' " 'AND tv_episodes.showid = tv_shows.indexer_id ' 'AND tv_episodes.indexer = tv_shows.indexer ' 'ORDER BY show_name', [DOWNLOADED] ) ep_counts = {} show_names = {} sorted_show_ids = [] for cur_status_result in status_results: if whichSubs == 'all': if not frozenset(subtitles.wanted_languages()).difference(cur_status_result['subtitles'].split(',')): continue elif whichSubs in cur_status_result['subtitles']: continue # FIXME: This will cause multi-indexer results where series_id overlaps for different indexers. # Fix by using tv_shows.show_id in stead. cur_indexer_id = int(cur_status_result['indexer']) cur_series_id = int(cur_status_result['indexer_id']) if (cur_indexer_id, cur_series_id) not in ep_counts: ep_counts[(cur_indexer_id, cur_series_id)] = 1 else: ep_counts[(cur_indexer_id, cur_series_id)] += 1 show_names[(cur_indexer_id, cur_series_id)] = cur_status_result['show_name'] if (cur_indexer_id, cur_series_id) not in sorted_show_ids: sorted_show_ids.append((cur_indexer_id, cur_series_id)) return t.render(whichSubs=whichSubs, show_names=show_names, ep_counts=ep_counts, sorted_show_ids=sorted_show_ids, title='Missing Subtitles', header='Missing Subtitles', controller='manage', action='subtitleMissed')
def episodeStatuses(self, whichStatus=None): if whichStatus: status_list = [int(whichStatus)] if status_list[0] == SNATCHED: status_list = [SNATCHED, SNATCHED_PROPER, SNATCHED_BEST] else: status_list = [] t = PageTemplate(rh=self, filename='manage_episodeStatuses.mako') # if we have no status then this is as far as we need to go if not status_list: return t.render( show_names=None, whichStatus=whichStatus, ep_counts=None, sorted_show_ids=None, controller='manage', action='episodeStatuses') main_db_con = db.DBConnection() status_results = main_db_con.select( 'SELECT show_name, tv_shows.indexer, tv_shows.show_id, tv_shows.indexer_id AS indexer_id ' 'FROM tv_episodes, tv_shows ' 'WHERE season != 0 ' 'AND tv_episodes.showid = tv_shows.indexer_id ' 'AND tv_episodes.indexer = tv_shows.indexer ' 'AND tv_episodes.status IN ({statuses}) ' 'ORDER BY show_name'.format(statuses=','.join(['?'] * len(status_list))), status_list ) ep_counts = {} show_names = {} sorted_show_ids = [] for cur_status_result in status_results: cur_indexer = int(cur_status_result['indexer']) cur_series_id = int(cur_status_result['indexer_id']) if (cur_indexer, cur_series_id) not in ep_counts: ep_counts[(cur_indexer, cur_series_id)] = 1 else: ep_counts[(cur_indexer, cur_series_id)] += 1 show_names[(cur_indexer, cur_series_id)] = cur_status_result['show_name'] if (cur_indexer, cur_series_id) not in sorted_show_ids: sorted_show_ids.append((cur_indexer, cur_series_id)) return t.render( title='Episode Overview', header='Episode Overview', whichStatus=whichStatus, show_names=show_names, ep_counts=ep_counts, sorted_show_ids=sorted_show_ids, controller='manage', action='episodeStatuses')
def index(self): """Render the Provider configuration page.""" t = PageTemplate(rh=self, filename='config_providers.mako') return t.render(submenu=self.ConfigMenu(), title='Config - Providers', header='Search Providers', topmenu='config', controller='config', action='providers')
def popularAnime(self, list_type=REQUEST_HOT): """ Fetches list recommeded shows from anidb.info. """ t = PageTemplate(rh=self, filename="addShows_recommended.mako") e = None try: recommended_shows = AnidbPopular().fetch_popular_shows(list_type) except Exception as e: # print traceback.format_exc() recommended_shows = None return t.render(title="Popular Anime Shows", header="Popular Anime Shows", recommended_shows=recommended_shows, exception=e, groups=[], topmenu="home", enable_anime_options=True, blacklist=[], whitelist=[], controller="addShows", action="recommendedShows", realpage="popularAnime")
def getTrendingShows(self, traktList=None): """ Display the new show page which collects a tvdb id, folder, and extra options and posts them to addNewShow """ error = None t = PageTemplate(rh=self, filename='addShows_recommended.mako') trakt_blacklist = False recommended_shows = None removed_from_medusa = None if traktList is None: traktList = '' trakt_list = traktList.lower() try: (trakt_blacklist, recommended_shows, removed_from_medusa ) = TraktPopular().fetch_popular_shows(trakt_list) except Exception as e: error = e return t.render(trakt_blacklist=trakt_blacklist, recommended_shows=recommended_shows, removed_from_medusa=removed_from_medusa, exception=error, enable_anime_options=False, blacklist=[], whitelist=[], realpage='getTrendingShows')
def index(self): t = PageTemplate(rh=self, filename='config_backuprestore.mako') return t.render(submenu=self.ConfigMenu(), topmenu='config', controller='config', action='backupRestore')
def existingShows(self): """ Prints out the page to add existing shows from a root dir """ t = PageTemplate(rh=self, filename='addShows_addExistingShow.mako') return t.render(enable_anime_options=True, blacklist=[], whitelist=[], groups=[], controller='addShows', action='addExistingShow')
def index(self): t = PageTemplate(rh=self, filename='IRC.mako') return t.render(header='IRC', title='IRC', controller='IRC', action='index')
def index(self): t = PageTemplate(rh=self, filename='manage.mako') return t.render(title='Mass Update', header='Mass Update', topmenu='manage', controller='manage', action='index')
def index(self): """ Render the Subtitle Search configuration page """ t = PageTemplate(rh=self, filename='config_subtitles.mako') return t.render(controller='config', action='subtitlesPage')
def index(self): t = PageTemplate(rh=self, filename='addShows.mako') return t.render(title='Add Shows', header='Add Shows', topmenu='home', controller='addShows', action='index')
def failedDownloads(self, limit=100, toRemove=None): failed_db_con = db.DBConnection('failed.db') if int(limit): sql_results = failed_db_con.select( b'SELECT * ' b'FROM failed ' b'LIMIT ?', [limit]) else: sql_results = failed_db_con.select(b'SELECT * ' b'FROM failed') sql_results = sql_results[::-1] to_remove = toRemove.split('|') if toRemove is not None else [] for release in to_remove: failed_db_con.action( b'DELETE FROM failed ' b'WHERE failed.release = ?', [release]) if to_remove: return self.redirect('/manage/failedDownloads/') t = PageTemplate(rh=self, filename='manage_failedDownloads.mako') return t.render(limit=limit, failedResults=sql_results, controller='manage', action='failedDownloads')
def index(self): t = PageTemplate(rh=self, filename='config_general.mako') return t.render(topmenu='config', submenu=self.ConfigMenu(), controller='config', action='index')
def failedDownloads(self, limit=100, toRemove=None): failed_db_con = db.DBConnection('failed.db') if int(limit): sql_results = failed_db_con.select( 'SELECT * ' 'FROM failed ' 'LIMIT ?', [limit] ) else: sql_results = failed_db_con.select( 'SELECT * ' 'FROM failed' ) sql_results = sql_results[::-1] to_remove = toRemove.split('|') if toRemove is not None else [] for release in to_remove: failed_db_con.action( 'DELETE FROM failed ' 'WHERE failed.release = ?', [release] ) if to_remove: return self.redirect('/manage/failedDownloads/') t = PageTemplate(rh=self, filename='manage_failedDownloads.mako') return t.render(limit=limit, failedResults=sql_results, controller='manage', action='failedDownloads')
def trendingShows(self, traktList=None): """ Display the new show page which collects a tvdb id, folder, and extra options and posts them to addNewShow """ trakt_list = traktList if traktList else '' trakt_list = trakt_list.lower() if trakt_list == 'trending': page_title = 'Trakt Trending Shows' elif trakt_list == 'popular': page_title = 'Trakt Popular Shows' elif trakt_list == 'anticipated': page_title = 'Trakt Most Anticipated Shows' elif trakt_list == 'collected': page_title = 'Trakt Most Collected Shows' elif trakt_list == 'watched': page_title = 'Trakt Most Watched Shows' elif trakt_list == 'played': page_title = 'Trakt Most Played Shows' elif trakt_list == 'recommended': page_title = 'Trakt Recommended Shows' elif trakt_list == 'newshow': page_title = 'Trakt New Shows' elif trakt_list == 'newseason': page_title = 'Trakt Season Premieres' else: page_title = 'Trakt Most Anticipated Shows' t = PageTemplate(rh=self, filename='addShows_trendingShows.mako') return t.render(title=page_title, header=page_title, enable_anime_options=True, blacklist=[], whitelist=[], groups=[], traktList=traktList, controller='addShows', action='trendingShows', realpage='trendingShows')
def index(self): """ Render the notification configuration page """ t = PageTemplate(rh=self, filename='config_notifications.mako') return t.render(controller='config', action='notifications')
def index(self): """ Render the Anime configuration page """ t = PageTemplate(rh=self, filename='config_anime.mako') return t.render(controller='config', action='anime')
def index(self): """ Render the Help & Info page. [Converted to VueRouter] """ t = PageTemplate(rh=self, filename='index.mako') return t.render(submenu=self.ConfigMenu())
def index(self): """ Render the addShows page. [Converted to VueRouter] """ t = PageTemplate(rh=self, filename='index.mako') return t.render(controller='addShows', action='index')
def index(self): """Render template for route /home/addRecommeded.""" t = PageTemplate(rh=self, filename="addRecommended.mako") return t.render(title='Add Recommended Shows', header='Add Recommended Shows', topmenu='home', controller="addShows", action="index")
def index(self): """ Render the IRC page. [Converted to VueRouter] """ t = PageTemplate(rh=self, filename='index.mako') return t.render()
def index(self): """ Render the Post Processing configuration page. [Converted to VueRouter] """ t = PageTemplate(rh=self, filename='index.mako') return t.render()
def index(self): """ Render the Search configuration page """ t = PageTemplate(rh=self, filename='config_search.mako') return t.render(submenu=self.ConfigMenu(), controller='config', action='search')
def index(self): """ Render template for route /home/addRecommended. [Converted to VueRouter] """ t = PageTemplate(rh=self, filename='index.mako') return t.render(controller='addShows', action='recommendedShows')
def index(self): """ Route to the manage-mass-update.vue component. [Converted to VueRouter] """ t = PageTemplate(rh=self, filename='index.mako') return t.render()
def index(self): """ Render the notification configuration page """ t = PageTemplate(rh=self, filename='config_notifications.mako') return t.render(submenu=self.ConfigMenu(), controller='config', action='notifications')
def index(self): """ Render template for route /home/addRecommended. [Converted to VueRouter] """ t = PageTemplate(rh=self, filename='index.mako') return t.render(controller='addShows', action='index')
def index(self): """ Render the notification configuration page """ t = PageTemplate(rh=self, filename='config_notifications.mako') return t.render(submenu=self.ConfigMenu(), title='Config - Notifications', header='Notifications', topmenu='config', controller='config', action='notifications')
def index(self): """ Render the Post Processor configuration page """ t = PageTemplate(rh=self, filename='config_postProcessing.mako') return t.render(submenu=self.ConfigMenu(), controller='config', action='postProcessing')
def index(self): """ Render the Anime configuration page """ t = PageTemplate(rh=self, filename='config_anime.mako') return t.render(submenu=self.ConfigMenu(), controller='config', action='anime')
def index(self): """ Render the Search configuration page """ t = PageTemplate(rh=self, filename='config_search.mako') return t.render(submenu=self.ConfigMenu(), title='Config - Episode Search', header='Search Settings', topmenu='config', controller='config', action='search')
def subtitleMissedPP(self): t = PageTemplate(rh=self, filename='manage_subtitleMissedPP.mako') app.RELEASES_IN_PP = [] for root, _, files in os.walk(app.TV_DOWNLOAD_DIR, topdown=False): # Skip folders that are being used for unpacking if u'_UNPACK' in root.upper(): continue for filename in sorted(files): if not is_media_file(filename): continue video_path = os.path.join(root, filename) video_date = datetime.datetime.fromtimestamp(os.stat(video_path).st_ctime) video_age = datetime.datetime.today() - video_date tv_episode = Episode.from_filepath(video_path) if not tv_episode: logger.log(u"Filename '{0}' cannot be parsed to an episode".format(filename), logger.DEBUG) continue ep_status = tv_episode.status if ep_status in (SNATCHED, SNATCHED_PROPER, SNATCHED_BEST): status = 'snatched' elif ep_status == DOWNLOADED: status = 'downloaded' else: continue if not tv_episode.series.subtitles: continue related_files = PostProcessor(video_path).list_associated_files(video_path, subtitles_only=True) if related_files: continue age_hours = divmod(video_age.seconds, 3600)[0] age_minutes = divmod(video_age.seconds, 60)[0] if video_age.days > 0: age_unit = 'd' age_value = video_age.days elif age_hours > 0: age_unit = 'h' age_value = age_hours else: age_unit = 'm' age_value = age_minutes app.RELEASES_IN_PP.append({'release': video_path, 'seriesid': tv_episode.series.indexerid, 'show_name': tv_episode.series.name, 'season': tv_episode.season, 'episode': tv_episode.episode, 'status': status, 'age': age_value, 'age_unit': age_unit, 'date': video_date, 'indexername': tv_episode.series.indexer_name}) return t.render(releases_in_pp=app.RELEASES_IN_PP, controller='manage', action='subtitleMissedPP')
def index(self): """ Render the Anime configuration page """ t = PageTemplate(rh=self, filename='config_anime.mako') return t.render(submenu=self.ConfigMenu(), title='Config - Anime', header='Anime', topmenu='config', controller='config', action='anime')
def getTrendingShows(self, traktList=None): """ Display the new show page which collects a tvdb id, folder, and extra options and posts them to addNewShow """ error = None t = PageTemplate(rh=self, filename='addShows_recommended.mako') trakt_blacklist = False recommended_shows = None removed_from_medusa = None if traktList is None: traktList = '' traktList = traktList.lower() if traktList == 'trending': page_url = 'shows/trending' elif traktList == 'popular': page_url = 'shows/popular' elif traktList == 'anticipated': page_url = 'shows/anticipated' elif traktList == 'collected': page_url = 'shows/collected' elif traktList == 'watched': page_url = 'shows/watched' elif traktList == 'played': page_url = 'shows/played' elif traktList == 'recommended': page_url = 'recommendations/shows' elif traktList == 'newshow': page_url = 'calendars/all/shows/new/%s/30' % datetime.date.today( ).strftime('%Y-%m-%d') elif traktList == 'newseason': page_url = 'calendars/all/shows/premieres/%s/30' % datetime.date.today( ).strftime('%Y-%m-%d') else: page_url = 'shows/anticipated' try: (trakt_blacklist, recommended_shows, removed_from_medusa) = TraktPopular().fetch_popular_shows( page_url=page_url, trakt_list=traktList) except Exception as e: error = e return t.render(trakt_blacklist=trakt_blacklist, recommended_shows=recommended_shows, removed_from_medusa=removed_from_medusa, exception=error, enable_anime_options=False, blacklist=[], whitelist=[], realpage='getTrendingShows')
def index(self): t = PageTemplate(rh=self, filename='manage_manageSearches.mako') # t.backlogPI = api.backlog_search_scheduler.action.get_progress_indicator() return t.render(backlogPaused=app.search_queue_scheduler.action.is_backlog_paused(), backlogRunning=app.search_queue_scheduler.action.is_backlog_in_progress(), dailySearchStatus=app.daily_search_scheduler.action.amActive, findPropersStatus=app.proper_finder_scheduler.action.amActive, searchQueueLength=app.search_queue_scheduler.action.queue_length(), forcedSearchQueueLength=app.forced_search_queue_scheduler.action.queue_length(), subtitlesFinderStatus=app.subtitles_finder_scheduler.action.amActive, controller='manage', action='manageSearches')
def index(self): news = app.version_check_scheduler.action.check_for_new_news(force=True) if not news: news = 'Could not load news from the repository. [Click here for news.md]({url})'.format(url=app.NEWS_URL) app.NEWS_LAST_READ = app.NEWS_LATEST app.NEWS_UNREAD = 0 app.instance.save_config() t = PageTemplate(rh=self, filename='markdown.mako') data = markdown2.markdown(news if news else 'The was a problem connecting to GitHub, please refresh and try again', extras=['header-ids']) return t.render(title='News', header='News', data=data, controller='news', action='index')
def popularAnime(self, list_type=REQUEST_HOT): """ Fetches list recommeded shows from anidb.info. """ t = PageTemplate(rh=self, filename='addShows_recommended.mako') recommended_shows = None error = None try: recommended_shows = AnidbPopular().fetch_popular_shows(list_type) except Exception as e: error = e return t.render(title='Popular Anime Shows', header='Popular Anime Shows', recommended_shows=recommended_shows, exception=error, groups=[], enable_anime_options=True, blacklist=[], whitelist=[], controller='addShows', action='recommendedShows', realpage='popularAnime')
def popularShows(self): """ Fetches data from IMDB to show a list of popular shows. """ t = PageTemplate(rh=self, filename='addShows_recommended.mako') recommended_shows = None error = None try: recommended_shows = ImdbPopular().fetch_popular_shows() except (RequestException, Exception) as e: error = e return t.render(title='Popular Shows', header='Popular Shows', recommended_shows=recommended_shows, exception=error, groups=[], enable_anime_options=True, blacklist=[], whitelist=[], controller='addShows', action='recommendedShows', realpage='popularShows')
def getTrendingShows(self, traktList=None): """ Display the new show page which collects a tvdb id, folder, and extra options and posts them to addNewShow """ error = None t = PageTemplate(rh=self, filename='addShows_recommended.mako') trakt_blacklist = False recommended_shows = None removed_from_medusa = None if traktList is None: traktList = '' traktList = traktList.lower() if traktList == 'trending': page_url = 'shows/trending' elif traktList == 'popular': page_url = 'shows/popular' elif traktList == 'anticipated': page_url = 'shows/anticipated' elif traktList == 'collected': page_url = 'shows/collected' elif traktList == 'watched': page_url = 'shows/watched' elif traktList == 'played': page_url = 'shows/played' elif traktList == 'recommended': page_url = 'recommendations/shows' elif traktList == 'newshow': page_url = 'calendars/all/shows/new/%s/30' % datetime.date.today().strftime('%Y-%m-%d') elif traktList == 'newseason': page_url = 'calendars/all/shows/premieres/%s/30' % datetime.date.today().strftime('%Y-%m-%d') else: page_url = 'shows/anticipated' try: (trakt_blacklist, recommended_shows, removed_from_medusa) = TraktPopular().fetch_popular_shows(page_url=page_url, trakt_list=traktList) except Exception as e: error = e return t.render(trakt_blacklist=trakt_blacklist, recommended_shows=recommended_shows, removed_from_medusa=removed_from_medusa, exception=error, enable_anime_options=False, blacklist=[], whitelist=[], realpage='getTrendingShows')
def newShow(self, show_to_add=None, other_shows=None, search_string=None): """ Display the new show page which collects a tvdb id, folder, and extra options and posts them to addNewShow """ t = PageTemplate(rh=self, filename='addShows_newShow.mako') indexer, show_dir, indexer_id, show_name = self.split_extra_show(show_to_add) use_provided_info = bool(indexer_id and indexer and show_name) # use the given show_dir for the indexer search if available if not show_dir: if search_string: default_show_name = search_string else: default_show_name = '' elif not show_name: default_show_name = re.sub(r' \(\d{4}\)', '', os.path.basename(os.path.normpath(show_dir))) else: default_show_name = show_name # carry a list of other dirs if given if not other_shows: other_shows = [] elif not isinstance(other_shows, list): other_shows = [other_shows] other_shows = decode_shows(other_shows) provided_indexer_id = int(indexer_id or 0) provided_indexer_name = show_name provided_indexer = int(indexer or app.INDEXER_DEFAULT) return t.render( enable_anime_options=True, use_provided_info=use_provided_info, default_show_name=default_show_name, other_shows=other_shows, provided_show_dir=show_dir, provided_indexer_id=provided_indexer_id, provided_indexer_name=provided_indexer_name, provided_indexer=provided_indexer, indexers=indexerApi().indexers, whitelist=[], blacklist=[], groups=[], controller='addShows', action='newShow' )
def massEdit(self, toEdit=None): t = PageTemplate(rh=self, filename='manage_massEdit.mako') if not toEdit: return self.redirect('/manage/') series_slugs = toEdit.split('|') show_list = [] show_names = [] for slug in series_slugs: identifier = SeriesIdentifier.from_slug(slug) series_obj = Series.find_by_identifier(identifier) if series_obj: show_list.append(series_obj) show_names.append(series_obj.name) season_folders_all_same = True last_season_folders = None paused_all_same = True last_paused = None default_ep_status_all_same = True last_default_ep_status = None anime_all_same = True last_anime = None sports_all_same = True last_sports = None quality_all_same = True last_quality = None subtitles_all_same = True last_subtitles = None scene_all_same = True last_scene = None air_by_date_all_same = True last_air_by_date = None dvd_order_all_same = True last_dvd_order = None root_dir_list = [] for cur_show in show_list: cur_root_dir = os.path.dirname(cur_show._location) # pylint: disable=protected-access if cur_root_dir not in root_dir_list: root_dir_list.append(cur_root_dir) # if we know they're not all the same then no point even bothering if paused_all_same: # if we had a value already and this value is different then they're not all the same if last_paused not in (None, cur_show.paused): paused_all_same = False else: last_paused = cur_show.paused if default_ep_status_all_same: if last_default_ep_status not in (None, cur_show.default_ep_status): default_ep_status_all_same = False else: last_default_ep_status = cur_show.default_ep_status if anime_all_same: # if we had a value already and this value is different then they're not all the same if last_anime not in (None, cur_show.is_anime): anime_all_same = False else: last_anime = cur_show.anime if season_folders_all_same: if last_season_folders not in (None, cur_show.season_folders): season_folders_all_same = False else: last_season_folders = cur_show.season_folders if quality_all_same: if last_quality not in (None, cur_show.quality): quality_all_same = False else: last_quality = cur_show.quality if subtitles_all_same: if last_subtitles not in (None, cur_show.subtitles): subtitles_all_same = False else: last_subtitles = cur_show.subtitles if scene_all_same: if last_scene not in (None, cur_show.scene): scene_all_same = False else: last_scene = cur_show.scene if sports_all_same: if last_sports not in (None, cur_show.sports): sports_all_same = False else: last_sports = cur_show.sports if air_by_date_all_same: if last_air_by_date not in (None, cur_show.air_by_date): air_by_date_all_same = False else: last_air_by_date = cur_show.air_by_date if dvd_order_all_same: if last_dvd_order not in (None, cur_show.dvd_order): dvd_order_all_same = False else: last_dvd_order = cur_show.dvd_order default_ep_status_value = last_default_ep_status if default_ep_status_all_same else None paused_value = last_paused if paused_all_same else None anime_value = last_anime if anime_all_same else None season_folders_value = last_season_folders if season_folders_all_same else None quality_value = last_quality if quality_all_same else None subtitles_value = last_subtitles if subtitles_all_same else None scene_value = last_scene if scene_all_same else None sports_value = last_sports if sports_all_same else None air_by_date_value = last_air_by_date if air_by_date_all_same else None dvd_order_value = last_dvd_order if dvd_order_all_same else None root_dir_list = root_dir_list return t.render(showList=toEdit, showNames=show_names, default_ep_status_value=default_ep_status_value, dvd_order_value=dvd_order_value, paused_value=paused_value, anime_value=anime_value, season_folders_value=season_folders_value, quality_value=quality_value, subtitles_value=subtitles_value, scene_value=scene_value, sports_value=sports_value, air_by_date_value=air_by_date_value, root_dir_list=root_dir_list)
def index(self): t = PageTemplate(rh=self, filename='config_general.mako') return t.render(submenu=self.ConfigMenu(), controller='config', action='index')
def index(self): """Render the Provider configuration page.""" t = PageTemplate(rh=self, filename='config_providers.mako') return t.render(submenu=self.ConfigMenu(), controller='config', action='providers')
def backlogOverview(self): t = PageTemplate(rh=self, filename='manage_backlogOverview.mako') show_counts = {} show_cats = {} show_sql_results = {} backlog_periods = { 'all': None, 'one_day': datetime.timedelta(days=1), 'three_days': datetime.timedelta(days=3), 'one_week': datetime.timedelta(days=7), 'one_month': datetime.timedelta(days=30), } backlog_period = backlog_periods.get(app.BACKLOG_PERIOD) backlog_status = { 'all': [Overview.QUAL, Overview.WANTED], 'quality': [Overview.QUAL], 'wanted': [Overview.WANTED] } selected_backlog_status = backlog_status.get(app.BACKLOG_STATUS) main_db_con = db.DBConnection() for cur_show in app.showList: if cur_show.paused: continue ep_counts = { Overview.WANTED: 0, Overview.QUAL: 0, } ep_cats = {} sql_results = main_db_con.select( """ SELECT e.status, e.quality, e.season, e.episode, e.name, e.airdate, e.manually_searched FROM tv_episodes as e WHERE e.season IS NOT NULL AND e.indexer = ? AND e.showid = ? ORDER BY e.season DESC, e.episode DESC """, [cur_show.indexer, cur_show.series_id] ) filtered_episodes = [] for cur_result in sql_results: cur_ep_cat = cur_show.get_overview(cur_result['status'], cur_result['quality'], backlog_mode=True, manually_searched=cur_result['manually_searched']) if cur_ep_cat: if cur_ep_cat in selected_backlog_status and cur_result['airdate'] != 1: air_date = datetime.datetime.fromordinal(cur_result['airdate']) if air_date.year >= 1970 or cur_show.network: air_date = sbdatetime.sbdatetime.convert_to_setting( network_timezones.parse_date_time(cur_result['airdate'], cur_show.airs, cur_show.network)) if backlog_period and air_date < datetime.datetime.now(app_timezone) - backlog_period: continue else: air_date = None episode_string = u'{ep}'.format(ep=(episode_num(cur_result['season'], cur_result['episode']) or episode_num(cur_result['season'], cur_result['episode'], numbering='absolute'))) ep_cats[episode_string] = cur_ep_cat ep_counts[cur_ep_cat] += 1 cur_result['airdate'] = air_date cur_result['episode_string'] = episode_string filtered_episodes.append(cur_result) show_counts[(cur_show.indexer, cur_show.series_id)] = ep_counts show_cats[(cur_show.indexer, cur_show.series_id)] = ep_cats show_sql_results[(cur_show.indexer, cur_show.series_id)] = filtered_episodes return t.render( showCounts=show_counts, showCats=show_cats, showSQLResults=show_sql_results, controller='manage', action='backlogOverview')
def index(self): t = PageTemplate(rh=self, filename='home_postprocess.mako') return t.render(controller='home', action='postProcess')
def index(self): t = PageTemplate(rh=self, filename='manage.mako') return t.render(controller='manage', action='index')
def index(self): t = PageTemplate(rh=self, filename='config_backuprestore.mako') return t.render(submenu=self.ConfigMenu(), controller='config', action='backupRestore')