def config_metadata(monkeypatch, app_config): # initialize metadata_providers default_config = ['0'] * 10 providers = [(default_config, metadata.kodi), (default_config, metadata.kodi_12plus), (default_config, metadata.media_browser), (default_config, metadata.ps3), (default_config, metadata.wdtv), (default_config, metadata.tivo), (default_config, metadata.mede8er)] metadata_provider_dict = app_config('metadata_provider_dict', metadata.get_metadata_generator_dict()) for cur_metadata_tuple in providers: (cur_metadata_config, cur_metadata_class) = cur_metadata_tuple tmp_provider = cur_metadata_class.metadata_class() tmp_provider.set_config(cur_metadata_config) monkeypatch.setitem(metadata_provider_dict, tmp_provider.name, tmp_provider) section_data = NonEmptyDict() section_data['metadataProviders'] = NonEmptyDict() for provider in itervalues(app.metadata_provider_dict): json_repr = provider.to_json() section_data['metadataProviders'][json_repr['id']] = json_repr return section_data
def data_metadata(): """Metadata.""" section_data = NonEmptyDict() section_data['metadataProviders'] = NonEmptyDict() for provider in itervalues(app.metadata_provider_dict): json_repr = provider.to_json() section_data['metadataProviders'][json_repr['id']] = json_repr return section_data
def data_qualities(): """Qualities.""" section_data = NonEmptyDict() section_data['values'] = NonEmptyDict() section_data['values']['na'] = common.Quality.NA section_data['values']['unknown'] = common.Quality.UNKNOWN section_data['values']['sdtv'] = common.Quality.SDTV section_data['values']['sddvd'] = common.Quality.SDDVD section_data['values']['hdtv'] = common.Quality.HDTV section_data['values']['rawhdtv'] = common.Quality.RAWHDTV section_data['values']['fullhdtv'] = common.Quality.FULLHDTV section_data['values']['hdwebdl'] = common.Quality.HDWEBDL section_data['values']['fullhdwebdl'] = common.Quality.FULLHDWEBDL section_data['values']['hdbluray'] = common.Quality.HDBLURAY section_data['values']['fullhdbluray'] = common.Quality.FULLHDBLURAY section_data['values']['uhd4ktv'] = common.Quality.UHD_4K_TV section_data['values']['uhd4kwebdl'] = common.Quality.UHD_4K_WEBDL section_data['values']['uhd4kbluray'] = common.Quality.UHD_4K_BLURAY section_data['values']['uhd8ktv'] = common.Quality.UHD_8K_TV section_data['values']['uhd8kwebdl'] = common.Quality.UHD_8K_WEBDL section_data['values']['uhd8kbluray'] = common.Quality.UHD_8K_BLURAY section_data['values']['hevc'] = common.Quality.HEVC section_data['values']['fullhevc'] = common.Quality.FULLHEVC section_data['values']['hevcwebdl'] = common.Quality.HEVCWEBDL section_data['values']['fullhevcwebdl'] = common.Quality.FULLHEVCWEBDL section_data['anySets'] = NonEmptyDict() section_data['anySets']['anyhdtv'] = common.Quality.ANYHDTV section_data['anySets']['anywebdl'] = common.Quality.ANYWEBDL section_data['anySets']['anybluray'] = common.Quality.ANYBLURAY section_data['anySets']['anyhevc'] = common.Quality.ANYHEVC section_data['presets'] = NonEmptyDict() section_data['presets']['any'] = common.ANY section_data['presets']['sd'] = common.SD section_data['presets']['hd'] = common.HD section_data['presets']['hd720p'] = common.HD720p section_data['presets']['hd1080p'] = common.HD1080p section_data['presets']['uhd'] = common.UHD section_data['presets']['uhd4k'] = common.UHD_4K section_data['presets']['uhd8k'] = common.UHD_8K section_data['presets']['hevc720p'] = common.HEVC720p section_data['presets']['hevc1080p'] = common.HEVC1080p section_data['strings'] = NonEmptyDict() section_data['strings']['values'] = common.Quality.qualityStrings section_data['strings'][ 'anySets'] = common.Quality.combinedQualityStrings section_data['strings']['presets'] = common.qualityPresetStrings section_data['strings']['cssClass'] = common.Quality.cssClassStrings return section_data
def data_search(): """Search filters.""" section_data = NonEmptyDict() section_data['general'] = NonEmptyDict() section_data['general']['randomizeProviders'] = bool( app.RANDOMIZE_PROVIDERS) section_data['general']['downloadPropers'] = bool(app.DOWNLOAD_PROPERS) section_data['general'][ 'checkPropersInterval'] = app.CHECK_PROPERS_INTERVAL # This can be moved to the frontend. No need to keep in config. The selected option is stored in CHECK_PROPERS_INTERVAL. # {u'45m': u'45 mins', u'15m': u'15 mins', u'4h': u'4 hours', u'daily': u'24 hours', u'90m': u'90 mins'} # section_data['general']['propersIntervalLabels'] = app.PROPERS_INTERVAL_LABELS section_data['general']['propersSearchDays'] = int( app.PROPERS_SEARCH_DAYS) section_data['general']['backlogDays'] = int(app.BACKLOG_DAYS) section_data['general']['backlogFrequency'] = int( app.BACKLOG_FREQUENCY) section_data['general']['minBacklogFrequency'] = int( app.MIN_BACKLOG_FREQUENCY) section_data['general']['dailySearchFrequency'] = int( app.DAILYSEARCH_FREQUENCY) section_data['general']['minDailySearchFrequency'] = int( app.MIN_DAILYSEARCH_FREQUENCY) section_data['general']['removeFromClient'] = bool( app.REMOVE_FROM_CLIENT) section_data['general']['torrentCheckerFrequency'] = int( app.TORRENT_CHECKER_FREQUENCY) section_data['general']['minTorrentCheckerFrequency'] = int( app.MIN_TORRENT_CHECKER_FREQUENCY) section_data['general']['usenetRetention'] = int(app.USENET_RETENTION) section_data['general']['trackersList'] = app.TRACKERS_LIST section_data['general']['allowHighPriority'] = bool( app.ALLOW_HIGH_PRIORITY) section_data['general']['useFailedDownloads'] = bool( app.USE_FAILED_DOWNLOADS) section_data['general']['deleteFailed'] = bool(app.DELETE_FAILED) section_data['general']['cacheTrimming'] = bool(app.CACHE_TRIMMING) section_data['general']['maxCacheAge'] = int(app.MAX_CACHE_AGE) section_data['filters'] = NonEmptyDict() section_data['filters']['ignored'] = app.IGNORE_WORDS section_data['filters']['undesired'] = app.UNDESIRED_WORDS section_data['filters']['preferred'] = app.PREFERRED_WORDS section_data['filters']['required'] = app.REQUIRE_WORDS section_data['filters']['ignoredSubsList'] = app.IGNORED_SUBS_LIST section_data['filters']['ignoreUnknownSubs'] = bool( app.IGNORE_UND_SUBS) return section_data
def http_get(self, identifier, path_param=None): """Query general configuration. :param identifier: :param path_param: :type path_param: str """ config_sections = DataGenerator.sections() if identifier and identifier not in config_sections: return self._not_found('Config not found') if not identifier: config_data = NonEmptyDict() for section in config_sections: config_data[section] = DataGenerator.get_data(section) return self._ok(data=config_data) config_data = DataGenerator.get_data(identifier) if path_param: if path_param not in config_data: return self._bad_request( '{key} is a invalid path'.format(key=path_param)) config_data = config_data[path_param] return self._ok(data=config_data)
def data_statuses(): """Statuses.""" section_data = NonEmptyDict() section_data['values'] = NonEmptyDict() section_data['values']['unset'] = common.UNSET section_data['values']['unaired'] = common.UNAIRED section_data['values']['snatched'] = common.SNATCHED section_data['values']['wanted'] = common.WANTED section_data['values']['downloaded'] = common.DOWNLOADED section_data['values']['skipped'] = common.SKIPPED section_data['values']['archived'] = common.ARCHIVED section_data['values']['ignored'] = common.IGNORED section_data['values']['snatchedProper'] = common.SNATCHED_PROPER section_data['values']['subtitled'] = common.SUBTITLED section_data['values']['failed'] = common.FAILED section_data['values']['snatchedBest'] = common.SNATCHED_BEST section_data['strings'] = common.statusStrings return section_data
def data_main(): """Main.""" section_data = NonEmptyDict() section_data['anonRedirect'] = app.ANON_REDIRECT section_data['animeSplitHome'] = bool(app.ANIME_SPLIT_HOME) section_data['animeSplitHomeInTabs'] = bool( app.ANIME_SPLIT_HOME_IN_TABS) section_data['comingEpsSort'] = app.COMING_EPS_SORT section_data['comingEpsDisplayPaused'] = bool( app.COMING_EPS_DISPLAY_PAUSED) section_data['datePreset'] = app.DATE_PRESET section_data['fuzzyDating'] = bool(app.FUZZY_DATING) section_data['themeName'] = app.THEME_NAME section_data['posterSortby'] = app.POSTER_SORTBY section_data['posterSortdir'] = app.POSTER_SORTDIR section_data['rootDirs'] = app.ROOT_DIRS section_data['sortArticle'] = bool(app.SORT_ARTICLE) section_data['timePreset'] = app.TIME_PRESET section_data['trimZero'] = bool(app.TRIM_ZERO) section_data['fanartBackground'] = bool(app.FANART_BACKGROUND) section_data['fanartBackgroundOpacity'] = float( app.FANART_BACKGROUND_OPACITY or 0) section_data['gitUsername'] = app.GIT_USERNAME section_data['branch'] = app.BRANCH section_data['commitHash'] = app.CUR_COMMIT_HASH section_data['release'] = app.APP_VERSION section_data['sslVersion'] = app.OPENSSL_VERSION section_data['pythonVersion'] = sys.version section_data['databaseVersion'] = NonEmptyDict() section_data['databaseVersion']['major'] = app.MAJOR_DB_VERSION section_data['databaseVersion']['minor'] = app.MINOR_DB_VERSION section_data['os'] = platform.platform() section_data['pid'] = app.PID section_data['locale'] = '.'.join( [text_type(loc or 'Unknown') for loc in app.LOCALE]) section_data['localUser'] = app.OS_USER or 'Unknown' section_data['programDir'] = app.PROG_DIR section_data['dataDir'] = app.DATA_DIR section_data['configFile'] = app.CONFIG_FILE section_data['dbPath'] = db.DBConnection().path section_data['cacheDir'] = app.CACHE_DIR section_data['logDir'] = app.LOG_DIR section_data['appArgs'] = app.MY_ARGS section_data['webRoot'] = app.WEB_ROOT section_data['githubUrl'] = app.GITHUB_IO_URL section_data['wikiUrl'] = app.WIKI_URL section_data['donationsUrl'] = app.DONATIONS_URL section_data['sourceUrl'] = app.APPLICATION_URL section_data['downloadUrl'] = app.DOWNLOAD_URL section_data['subtitlesMulti'] = bool(app.SUBTITLES_MULTI) section_data['namingForceFolders'] = bool(app.NAMING_FORCE_FOLDERS) section_data['subtitles'] = NonEmptyDict() section_data['subtitles']['enabled'] = bool(app.USE_SUBTITLES) section_data['recentShows'] = app.SHOWS_RECENT section_data['showDefaults'] = {} section_data['showDefaults']['status'] = app.STATUS_DEFAULT section_data['showDefaults']['statusAfter'] = app.STATUS_DEFAULT_AFTER section_data['showDefaults']['quality'] = app.QUALITY_DEFAULT section_data['showDefaults']['subtitles'] = bool(app.SUBTITLES_DEFAULT) section_data['showDefaults']['seasonFolders'] = bool( app.SEASON_FOLDERS_DEFAULT) section_data['showDefaults']['anime'] = bool(app.ANIME_DEFAULT) section_data['showDefaults']['scene'] = bool(app.SCENE_DEFAULT) section_data['news'] = NonEmptyDict() section_data['news']['lastRead'] = app.NEWS_LAST_READ section_data['news']['latest'] = app.NEWS_LATEST section_data['news']['unread'] = app.NEWS_UNREAD section_data['logs'] = NonEmptyDict() section_data['logs']['loggingLevels'] = { k.lower(): v for k, v in iteritems(logger.LOGGING_LEVELS) } section_data['logs']['numErrors'] = len(classes.ErrorViewer.errors) section_data['logs']['numWarnings'] = len(classes.WarningViewer.errors) section_data['failedDownloads'] = NonEmptyDict() section_data['failedDownloads']['enabled'] = bool( app.USE_FAILED_DOWNLOADS) section_data['failedDownloads']['deleteFailed'] = bool( app.DELETE_FAILED) section_data['kodi'] = NonEmptyDict() section_data['kodi']['enabled'] = bool(app.USE_KODI) section_data['kodi']['alwaysOn'] = bool(app.KODI_ALWAYS_ON) section_data['kodi']['notify'] = NonEmptyDict() section_data['kodi']['notify']['snatch'] = bool( app.KODI_NOTIFY_ONSNATCH) section_data['kodi']['notify']['download'] = bool( app.KODI_NOTIFY_ONDOWNLOAD) section_data['kodi']['notify']['subtitleDownload'] = bool( app.KODI_NOTIFY_ONSUBTITLEDOWNLOAD) section_data['kodi']['update'] = NonEmptyDict() section_data['kodi']['update']['library'] = bool( app.KODI_UPDATE_LIBRARY) section_data['kodi']['update']['full'] = bool(app.KODI_UPDATE_FULL) section_data['kodi']['update']['onlyFirst'] = bool( app.KODI_UPDATE_ONLYFIRST) section_data['kodi']['host'] = app.KODI_HOST section_data['kodi']['username'] = app.KODI_USERNAME section_data['kodi']['libraryCleanPending'] = bool( app.KODI_LIBRARY_CLEAN_PENDING) section_data['kodi']['cleanLibrary'] = bool(app.KODI_CLEAN_LIBRARY) section_data['plex'] = NonEmptyDict() section_data['plex']['server'] = NonEmptyDict() section_data['plex']['server']['enabled'] = bool(app.USE_PLEX_SERVER) section_data['plex']['server']['notify'] = NonEmptyDict() section_data['plex']['server']['notify']['snatch'] = bool( app.PLEX_NOTIFY_ONSNATCH) section_data['plex']['server']['notify']['download'] = bool( app.PLEX_NOTIFY_ONDOWNLOAD) section_data['plex']['server']['notify']['subtitleDownload'] = bool( app.PLEX_NOTIFY_ONSUBTITLEDOWNLOAD) section_data['plex']['server']['updateLibrary'] = bool( app.PLEX_UPDATE_LIBRARY) section_data['plex']['server']['host'] = app.PLEX_SERVER_HOST section_data['plex']['server']['username'] = app.PLEX_SERVER_USERNAME section_data['plex']['client'] = NonEmptyDict() section_data['plex']['client']['enabled'] = bool(app.USE_PLEX_CLIENT) section_data['plex']['client']['username'] = app.PLEX_CLIENT_USERNAME section_data['plex']['client']['host'] = app.PLEX_CLIENT_HOST section_data['emby'] = NonEmptyDict() section_data['emby']['enabled'] = bool(app.USE_EMBY) section_data['emby']['host'] = app.EMBY_HOST section_data['torrents'] = NonEmptyDict() section_data['torrents']['authType'] = app.TORRENT_AUTH_TYPE section_data['torrents']['dir'] = app.TORRENT_DIR section_data['torrents']['enabled'] = bool(app.USE_TORRENTS) section_data['torrents']['highBandwidth'] = app.TORRENT_HIGH_BANDWIDTH section_data['torrents']['host'] = app.TORRENT_HOST section_data['torrents']['label'] = app.TORRENT_LABEL section_data['torrents']['labelAnime'] = app.TORRENT_LABEL_ANIME section_data['torrents']['method'] = app.TORRENT_METHOD section_data['torrents']['path'] = app.TORRENT_PATH section_data['torrents']['paused'] = bool(app.TORRENT_PAUSED) section_data['torrents']['rpcurl'] = app.TORRENT_RPCURL section_data['torrents']['seedLocation'] = app.TORRENT_SEED_LOCATION section_data['torrents']['seedTime'] = app.TORRENT_SEED_TIME section_data['torrents']['username'] = app.TORRENT_USERNAME section_data['torrents']['verifySSL'] = bool(app.TORRENT_VERIFY_CERT) section_data['nzb'] = NonEmptyDict() section_data['nzb']['enabled'] = bool(app.USE_NZBS) section_data['nzb']['dir'] = app.NZB_DIR section_data['nzb']['method'] = app.NZB_METHOD section_data['nzb']['nzbget'] = NonEmptyDict() section_data['nzb']['nzbget']['category'] = app.NZBGET_CATEGORY section_data['nzb']['nzbget'][ 'categoryAnime'] = app.NZBGET_CATEGORY_ANIME section_data['nzb']['nzbget'][ 'categoryAnimeBacklog'] = app.NZBGET_CATEGORY_ANIME_BACKLOG section_data['nzb']['nzbget'][ 'categoryBacklog'] = app.NZBGET_CATEGORY_BACKLOG section_data['nzb']['nzbget']['host'] = app.NZBGET_HOST section_data['nzb']['nzbget']['priority'] = app.NZBGET_PRIORITY section_data['nzb']['nzbget']['useHttps'] = bool(app.NZBGET_USE_HTTPS) section_data['nzb']['nzbget']['username'] = app.NZBGET_USERNAME section_data['nzb']['sabnzbd'] = NonEmptyDict() section_data['nzb']['sabnzbd']['category'] = app.SAB_CATEGORY section_data['nzb']['sabnzbd'][ 'categoryAnime'] = app.SAB_CATEGORY_ANIME section_data['nzb']['sabnzbd'][ 'categoryAnimeBacklog'] = app.SAB_CATEGORY_ANIME_BACKLOG section_data['nzb']['sabnzbd'][ 'categoryBacklog'] = app.SAB_CATEGORY_BACKLOG section_data['nzb']['sabnzbd']['forced'] = bool(app.SAB_FORCED) section_data['nzb']['sabnzbd']['host'] = app.SAB_HOST section_data['nzb']['sabnzbd']['username'] = app.SAB_USERNAME section_data['layout'] = NonEmptyDict() section_data['layout']['schedule'] = app.COMING_EPS_LAYOUT section_data['layout']['history'] = app.HISTORY_LAYOUT section_data['layout']['home'] = app.HOME_LAYOUT section_data['layout']['show'] = NonEmptyDict() section_data['layout']['show']['allSeasons'] = bool( app.DISPLAY_ALL_SEASONS) section_data['layout']['show']['specials'] = bool( app.DISPLAY_SHOW_SPECIALS) section_data['layout']['show']['showListOrder'] = app.SHOW_LIST_ORDER section_data['selectedRootIndex'] = int( app.SELECTED_ROOT ) if app.SELECTED_ROOT is not None else -1 # All paths section_data['backlogOverview'] = NonEmptyDict() section_data['backlogOverview']['period'] = app.BACKLOG_PERIOD section_data['backlogOverview']['status'] = app.BACKLOG_STATUS section_data['indexers'] = NonEmptyDict() section_data['indexers']['config'] = get_indexer_config() section_data['postProcessing'] = NonEmptyDict() section_data['postProcessing']['naming'] = NonEmptyDict() section_data['postProcessing']['naming'][ 'pattern'] = app.NAMING_PATTERN section_data['postProcessing']['naming']['multiEp'] = int( app.NAMING_MULTI_EP) section_data['postProcessing']['naming'][ 'patternAirByDate'] = app.NAMING_ABD_PATTERN section_data['postProcessing']['naming'][ 'patternSports'] = app.NAMING_SPORTS_PATTERN section_data['postProcessing']['naming'][ 'patternAnime'] = app.NAMING_ANIME_PATTERN section_data['postProcessing']['naming'][ 'enableCustomNamingAirByDate'] = bool(app.NAMING_CUSTOM_ABD) section_data['postProcessing']['naming'][ 'enableCustomNamingSports'] = bool(app.NAMING_CUSTOM_SPORTS) section_data['postProcessing']['naming'][ 'enableCustomNamingAnime'] = bool(app.NAMING_CUSTOM_ANIME) section_data['postProcessing']['naming']['animeMultiEp'] = int( app.NAMING_ANIME_MULTI_EP) section_data['postProcessing']['naming']['animeNamingType'] = int( app.NAMING_ANIME) section_data['postProcessing']['naming']['stripYear'] = bool( app.NAMING_STRIP_YEAR) section_data['postProcessing']['showDownloadDir'] = app.TV_DOWNLOAD_DIR section_data['postProcessing']['processAutomatically'] = bool( app.PROCESS_AUTOMATICALLY) section_data['postProcessing']['postponeIfSyncFiles'] = bool( app.POSTPONE_IF_SYNC_FILES) section_data['postProcessing']['postponeIfNoSubs'] = bool( app.POSTPONE_IF_NO_SUBS) section_data['postProcessing']['renameEpisodes'] = bool( app.RENAME_EPISODES) section_data['postProcessing']['createMissingShowDirs'] = bool( app.CREATE_MISSING_SHOW_DIRS) section_data['postProcessing']['addShowsWithoutDir'] = bool( app.ADD_SHOWS_WO_DIR) section_data['postProcessing']['moveAssociatedFiles'] = bool( app.MOVE_ASSOCIATED_FILES) section_data['postProcessing']['nfoRename'] = bool(app.NFO_RENAME) section_data['postProcessing']['airdateEpisodes'] = bool( app.AIRDATE_EPISODES) section_data['postProcessing']['unpack'] = bool(app.UNPACK) section_data['postProcessing']['deleteRarContent'] = bool( app.DELRARCONTENTS) section_data['postProcessing']['noDelete'] = bool(app.NO_DELETE) section_data['postProcessing']['processMethod'] = app.PROCESS_METHOD section_data['postProcessing']['reflinkAvailable'] = bool( pkgutil.find_loader('reflink')) section_data['postProcessing']['autoPostprocessorFrequency'] = int( app.AUTOPOSTPROCESSOR_FREQUENCY) section_data['postProcessing']['syncFiles'] = app.SYNC_FILES section_data['postProcessing'][ 'fileTimestampTimezone'] = app.FILE_TIMESTAMP_TIMEZONE section_data['postProcessing'][ 'allowedExtensions'] = app.ALLOWED_EXTENSIONS section_data['postProcessing']['extraScripts'] = app.EXTRA_SCRIPTS section_data['postProcessing'][ 'extraScriptsUrl'] = app.EXTRA_SCRIPTS_URL section_data['postProcessing'][ 'multiEpStrings'] = common.MULTI_EP_STRINGS return section_data
def data_main(): """Main.""" section_data = NonEmptyDict() section_data['anonRedirect'] = app.ANON_REDIRECT section_data['animeSplitHome'] = bool(app.ANIME_SPLIT_HOME) section_data['animeSplitHomeInTabs'] = bool( app.ANIME_SPLIT_HOME_IN_TABS) section_data['comingEpsSort'] = app.COMING_EPS_SORT section_data['comingEpsDisplayPaused'] = bool( app.COMING_EPS_DISPLAY_PAUSED) section_data['datePreset'] = app.DATE_PRESET section_data['fuzzyDating'] = bool(app.FUZZY_DATING) section_data['themeName'] = app.THEME_NAME section_data['posterSortby'] = app.POSTER_SORTBY section_data['posterSortdir'] = app.POSTER_SORTDIR section_data['rootDirs'] = app.ROOT_DIRS section_data['sortArticle'] = bool(app.SORT_ARTICLE) section_data['timePreset'] = app.TIME_PRESET section_data['trimZero'] = bool(app.TRIM_ZERO) section_data['fanartBackground'] = bool(app.FANART_BACKGROUND) section_data['fanartBackgroundOpacity'] = float( app.FANART_BACKGROUND_OPACITY or 0) section_data['branch'] = app.BRANCH section_data['commitHash'] = app.CUR_COMMIT_HASH section_data['release'] = app.APP_VERSION section_data['sslVersion'] = app.OPENSSL_VERSION section_data['pythonVersion'] = sys.version section_data['databaseVersion'] = NonEmptyDict() section_data['databaseVersion']['major'] = app.MAJOR_DB_VERSION section_data['databaseVersion']['minor'] = app.MINOR_DB_VERSION section_data['os'] = platform.platform() section_data['pid'] = app.PID section_data['locale'] = '.'.join( [text_type(loc or 'Unknown') for loc in app.LOCALE]) section_data['localUser'] = app.OS_USER or 'Unknown' section_data['programDir'] = app.PROG_DIR section_data['configFile'] = app.CONFIG_FILE section_data['dbPath'] = db.DBConnection().path section_data['cacheDir'] = app.CACHE_DIR section_data['logDir'] = app.LOG_DIR section_data['appArgs'] = app.MY_ARGS section_data['webRoot'] = app.WEB_ROOT section_data['githubUrl'] = app.GITHUB_IO_URL section_data['wikiUrl'] = app.WIKI_URL section_data['donationsUrl'] = app.DONATIONS_URL section_data['sourceUrl'] = app.APPLICATION_URL section_data['downloadUrl'] = app.DOWNLOAD_URL section_data['subtitlesMulti'] = bool(app.SUBTITLES_MULTI) section_data['namingForceFolders'] = bool(app.NAMING_FORCE_FOLDERS) section_data['subtitles'] = NonEmptyDict() section_data['subtitles']['enabled'] = bool(app.USE_SUBTITLES) section_data['recentShows'] = app.SHOWS_RECENT section_data['news'] = NonEmptyDict() section_data['news']['lastRead'] = app.NEWS_LAST_READ section_data['news']['latest'] = app.NEWS_LATEST section_data['news']['unread'] = app.NEWS_UNREAD section_data['logs'] = NonEmptyDict() section_data['logs']['loggingLevels'] = { k.lower(): v for k, v in iteritems(logger.LOGGING_LEVELS) } section_data['logs']['numErrors'] = len(classes.ErrorViewer.errors) section_data['logs']['numWarnings'] = len(classes.WarningViewer.errors) section_data['failedDownloads'] = NonEmptyDict() section_data['failedDownloads']['enabled'] = bool( app.USE_FAILED_DOWNLOADS) section_data['failedDownloads']['deleteFailed'] = bool( app.DELETE_FAILED) section_data['kodi'] = NonEmptyDict() section_data['kodi']['enabled'] = bool(app.USE_KODI) section_data['kodi']['alwaysOn'] = bool(app.KODI_ALWAYS_ON) section_data['kodi']['notify'] = NonEmptyDict() section_data['kodi']['notify']['snatch'] = bool( app.KODI_NOTIFY_ONSNATCH) section_data['kodi']['notify']['download'] = bool( app.KODI_NOTIFY_ONDOWNLOAD) section_data['kodi']['notify']['subtitleDownload'] = bool( app.KODI_NOTIFY_ONSUBTITLEDOWNLOAD) section_data['kodi']['update'] = NonEmptyDict() section_data['kodi']['update']['library'] = bool( app.KODI_UPDATE_LIBRARY) section_data['kodi']['update']['full'] = bool(app.KODI_UPDATE_FULL) section_data['kodi']['update']['onlyFirst'] = bool( app.KODI_UPDATE_ONLYFIRST) section_data['kodi']['host'] = app.KODI_HOST section_data['kodi']['username'] = app.KODI_USERNAME section_data['kodi']['libraryCleanPending'] = bool( app.KODI_LIBRARY_CLEAN_PENDING) section_data['kodi']['cleanLibrary'] = bool(app.KODI_CLEAN_LIBRARY) section_data['plex'] = NonEmptyDict() section_data['plex']['server'] = NonEmptyDict() section_data['plex']['server']['enabled'] = bool(app.USE_PLEX_SERVER) section_data['plex']['server']['notify'] = NonEmptyDict() section_data['plex']['server']['notify']['snatch'] = bool( app.PLEX_NOTIFY_ONSNATCH) section_data['plex']['server']['notify']['download'] = bool( app.PLEX_NOTIFY_ONDOWNLOAD) section_data['plex']['server']['notify']['subtitleDownload'] = bool( app.PLEX_NOTIFY_ONSUBTITLEDOWNLOAD) section_data['plex']['server']['updateLibrary'] = bool( app.PLEX_UPDATE_LIBRARY) section_data['plex']['server']['host'] = app.PLEX_SERVER_HOST section_data['plex']['server']['username'] = app.PLEX_SERVER_USERNAME section_data['plex']['client'] = NonEmptyDict() section_data['plex']['client']['enabled'] = bool(app.USE_PLEX_CLIENT) section_data['plex']['client']['username'] = app.PLEX_CLIENT_USERNAME section_data['plex']['client']['host'] = app.PLEX_CLIENT_HOST section_data['emby'] = NonEmptyDict() section_data['emby']['enabled'] = bool(app.USE_EMBY) section_data['emby']['host'] = app.EMBY_HOST section_data['torrents'] = NonEmptyDict() section_data['torrents']['authType'] = app.TORRENT_AUTH_TYPE section_data['torrents']['dir'] = app.TORRENT_DIR section_data['torrents']['enabled'] = bool(app.USE_TORRENTS) section_data['torrents']['highBandwidth'] = app.TORRENT_HIGH_BANDWIDTH section_data['torrents']['host'] = app.TORRENT_HOST section_data['torrents']['label'] = app.TORRENT_LABEL section_data['torrents']['labelAnime'] = app.TORRENT_LABEL_ANIME section_data['torrents']['method'] = app.TORRENT_METHOD section_data['torrents']['path'] = app.TORRENT_PATH section_data['torrents']['paused'] = bool(app.TORRENT_PAUSED) section_data['torrents']['rpcurl'] = app.TORRENT_RPCURL section_data['torrents']['seedLocation'] = app.TORRENT_SEED_LOCATION section_data['torrents']['seedTime'] = app.TORRENT_SEED_TIME section_data['torrents']['username'] = app.TORRENT_USERNAME section_data['torrents']['verifySSL'] = bool(app.TORRENT_VERIFY_CERT) section_data['nzb'] = NonEmptyDict() section_data['nzb']['enabled'] = bool(app.USE_NZBS) section_data['nzb']['dir'] = app.NZB_DIR section_data['nzb']['method'] = app.NZB_METHOD section_data['nzb']['nzbget'] = NonEmptyDict() section_data['nzb']['nzbget']['category'] = app.NZBGET_CATEGORY section_data['nzb']['nzbget'][ 'categoryAnime'] = app.NZBGET_CATEGORY_ANIME section_data['nzb']['nzbget'][ 'categoryAnimeBacklog'] = app.NZBGET_CATEGORY_ANIME_BACKLOG section_data['nzb']['nzbget'][ 'categoryBacklog'] = app.NZBGET_CATEGORY_BACKLOG section_data['nzb']['nzbget']['host'] = app.NZBGET_HOST section_data['nzb']['nzbget']['priority'] = app.NZBGET_PRIORITY section_data['nzb']['nzbget']['useHttps'] = bool(app.NZBGET_USE_HTTPS) section_data['nzb']['nzbget']['username'] = app.NZBGET_USERNAME section_data['nzb']['sabnzbd'] = NonEmptyDict() section_data['nzb']['sabnzbd']['category'] = app.SAB_CATEGORY section_data['nzb']['sabnzbd'][ 'categoryAnime'] = app.SAB_CATEGORY_ANIME section_data['nzb']['sabnzbd'][ 'categoryAnimeBacklog'] = app.SAB_CATEGORY_ANIME_BACKLOG section_data['nzb']['sabnzbd'][ 'categoryBacklog'] = app.SAB_CATEGORY_BACKLOG section_data['nzb']['sabnzbd']['forced'] = bool(app.SAB_FORCED) section_data['nzb']['sabnzbd']['host'] = app.SAB_HOST section_data['nzb']['sabnzbd']['username'] = app.SAB_USERNAME section_data['layout'] = NonEmptyDict() section_data['layout']['schedule'] = app.COMING_EPS_LAYOUT section_data['layout']['history'] = app.HISTORY_LAYOUT section_data['layout']['home'] = app.HOME_LAYOUT section_data['layout']['show'] = NonEmptyDict() section_data['layout']['show']['allSeasons'] = bool( app.DISPLAY_ALL_SEASONS) section_data['layout']['show']['specials'] = bool( app.DISPLAY_SHOW_SPECIALS) section_data['layout']['show']['showListOrder'] = app.SHOW_LIST_ORDER section_data['selectedRootIndex'] = int( app.SELECTED_ROOT ) if app.SELECTED_ROOT is not None else -1 # All paths section_data['backlogOverview'] = NonEmptyDict() section_data['backlogOverview']['period'] = app.BACKLOG_PERIOD section_data['backlogOverview']['status'] = app.BACKLOG_STATUS section_data['indexers'] = NonEmptyDict() section_data['indexers']['config'] = get_indexer_config() section_data['postProcessing'] = NonEmptyDict() section_data['postProcessing']['processMethod'] = app.PROCESS_METHOD section_data['postProcessing']['postponeIfNoSubs'] = bool( app.POSTPONE_IF_NO_SUBS) return section_data
def config(monkeypatch, app_config): python_version = 'Python Test v1.2.3.4' monkeypatch.setattr(sys, 'version', python_version) os_user = app_config('OS_USER', 'superuser') app_config('LOCALE', (None, 'ABC')) app_locale = 'Unknown.ABC' config_data = NonEmptyDict() config_data['anonRedirect'] = app.ANON_REDIRECT config_data['animeSplitHome'] = app.ANIME_SPLIT_HOME config_data['comingEpsSort'] = app.COMING_EPS_SORT config_data['datePreset'] = app.DATE_PRESET config_data['fuzzyDating'] = app.FUZZY_DATING config_data['themeName'] = app.THEME_NAME config_data['posterSortby'] = app.POSTER_SORTBY config_data['posterSortdir'] = app.POSTER_SORTDIR config_data['rootDirs'] = app.ROOT_DIRS config_data['sortArticle'] = app.SORT_ARTICLE config_data['timePreset'] = app.TIME_PRESET config_data['trimZero'] = app.TRIM_ZERO config_data['fanartBackground'] = app.FANART_BACKGROUND config_data['fanartBackgroundOpacity'] = float( app.FANART_BACKGROUND_OPACITY or 0) config_data['branch'] = app.BRANCH config_data['commitHash'] = app.CUR_COMMIT_HASH config_data['release'] = app.APP_VERSION config_data['sslVersion'] = app.OPENSSL_VERSION config_data['pythonVersion'] = sys.version config_data['databaseVersion'] = NonEmptyDict() config_data['databaseVersion']['major'] = app.MAJOR_DB_VERSION config_data['databaseVersion']['minor'] = app.MINOR_DB_VERSION config_data['os'] = platform.platform() config_data['locale'] = app_locale config_data['localUser'] = os_user config_data['programDir'] = app.PROG_DIR config_data['configFile'] = app.CONFIG_FILE config_data['dbFilename'] = db.dbFilename() config_data['cacheDir'] = app.CACHE_DIR config_data['logDir'] = app.LOG_DIR config_data['appArgs'] = app.MY_ARGS config_data['webRoot'] = app.WEB_ROOT config_data['githubUrl'] = app.GITHUB_IO_URL config_data['wikiUrl'] = app.WIKI_URL config_data['sourceUrl'] = app.APPLICATION_URL config_data['downloadUrl'] = app.DOWNLOAD_URL config_data['subtitlesMulti'] = app.SUBTITLES_MULTI config_data['namingForceFolders'] = app.NAMING_FORCE_FOLDERS config_data['subtitles'] = NonEmptyDict() config_data['subtitles']['enabled'] = bool(app.USE_SUBTITLES) config_data['kodi'] = NonEmptyDict() config_data['kodi']['enabled'] = bool(app.USE_KODI and app.KODI_UPDATE_LIBRARY) config_data['plex'] = NonEmptyDict() config_data['plex']['server'] = NonEmptyDict() config_data['plex']['server']['enabled'] = bool(app.USE_PLEX_SERVER) config_data['plex']['server']['notify'] = NonEmptyDict() config_data['plex']['server']['notify']['snatch'] = bool( app.PLEX_NOTIFY_ONSNATCH) config_data['plex']['server']['notify']['download'] = bool( app.PLEX_NOTIFY_ONDOWNLOAD) config_data['plex']['server']['notify']['subtitleDownload'] = bool( app.PLEX_NOTIFY_ONSUBTITLEDOWNLOAD) config_data['plex']['server']['updateLibrary'] = bool( app.PLEX_UPDATE_LIBRARY) config_data['plex']['server']['host'] = app.PLEX_SERVER_HOST config_data['plex']['server']['token'] = app.PLEX_SERVER_TOKEN config_data['plex']['server']['username'] = app.PLEX_SERVER_USERNAME config_data['plex']['server']['password'] = app.PLEX_SERVER_PASSWORD config_data['plex']['client'] = NonEmptyDict() config_data['plex']['client']['enabled'] = bool(app.USE_PLEX_CLIENT) config_data['plex']['client']['username'] = app.PLEX_CLIENT_USERNAME config_data['plex']['client']['password'] = app.PLEX_CLIENT_PASSWORD config_data['plex']['client']['host'] = app.PLEX_CLIENT_HOST config_data['emby'] = NonEmptyDict() config_data['emby']['enabled'] = bool(app.USE_EMBY) config_data['torrents'] = NonEmptyDict() config_data['torrents']['enabled'] = bool(app.USE_TORRENTS) config_data['torrents']['method'] = app.TORRENT_METHOD config_data['torrents']['username'] = app.TORRENT_USERNAME config_data['torrents']['password'] = app.TORRENT_PASSWORD config_data['torrents']['label'] = app.TORRENT_LABEL config_data['torrents']['labelAnime'] = app.TORRENT_LABEL_ANIME config_data['torrents']['verifySSL'] = app.TORRENT_VERIFY_CERT config_data['torrents']['path'] = app.TORRENT_PATH config_data['torrents']['seedTime'] = app.TORRENT_SEED_TIME config_data['torrents']['paused'] = app.TORRENT_PAUSED config_data['torrents']['highBandwidth'] = app.TORRENT_HIGH_BANDWIDTH config_data['torrents']['host'] = app.TORRENT_HOST config_data['torrents']['rpcurl'] = app.TORRENT_RPCURL config_data['torrents']['authType'] = app.TORRENT_AUTH_TYPE config_data['nzb'] = NonEmptyDict() config_data['nzb']['enabled'] = bool(app.USE_NZBS) config_data['nzb']['username'] = app.NZBGET_USERNAME config_data['nzb']['password'] = app.NZBGET_PASSWORD # app.NZBGET_CATEGORY # app.NZBGET_CATEGORY_BACKLOG # app.NZBGET_CATEGORY_ANIME # app.NZBGET_CATEGORY_ANIME_BACKLOG config_data['nzb']['host'] = app.NZBGET_HOST config_data['nzb']['priority'] = app.NZBGET_PRIORITY config_data['layout'] = NonEmptyDict() config_data['layout']['schedule'] = app.COMING_EPS_LAYOUT config_data['layout']['history'] = app.HISTORY_LAYOUT config_data['layout']['home'] = app.HOME_LAYOUT config_data['layout']['show'] = NonEmptyDict() config_data['layout']['show']['allSeasons'] = bool(app.DISPLAY_ALL_SEASONS) config_data['layout']['show']['specials'] = bool(app.DISPLAY_SHOW_SPECIALS) config_data['selectedRootIndex'] = int( app.SELECTED_ROOT ) if app.SELECTED_ROOT is not None else -1 # All paths config_data['backlogOverview'] = NonEmptyDict() config_data['backlogOverview']['period'] = app.BACKLOG_PERIOD config_data['backlogOverview']['status'] = app.BACKLOG_STATUS return config_data
def get(self, identifier, path_param=None): """Query general configuration. :param identifier: :param path_param: :type path_param: str """ if identifier and identifier != 'main': return self._not_found('Config not found') config_data = NonEmptyDict() config_data['anonRedirect'] = app.ANON_REDIRECT config_data['animeSplitHome'] = app.ANIME_SPLIT_HOME config_data['animeSplitHomeInTabs'] = app.ANIME_SPLIT_HOME_IN_TABS config_data['comingEpsSort'] = app.COMING_EPS_SORT config_data['datePreset'] = app.DATE_PRESET config_data['fuzzyDating'] = app.FUZZY_DATING config_data['themeName'] = app.THEME_NAME config_data['posterSortby'] = app.POSTER_SORTBY config_data['posterSortdir'] = app.POSTER_SORTDIR config_data['rootDirs'] = app.ROOT_DIRS config_data['sortArticle'] = app.SORT_ARTICLE config_data['timePreset'] = app.TIME_PRESET config_data['trimZero'] = app.TRIM_ZERO config_data['fanartBackground'] = app.FANART_BACKGROUND config_data['fanartBackgroundOpacity'] = float( app.FANART_BACKGROUND_OPACITY or 0) config_data['branch'] = app.BRANCH config_data['commitHash'] = app.CUR_COMMIT_HASH config_data['release'] = app.APP_VERSION config_data['sslVersion'] = app.OPENSSL_VERSION config_data['pythonVersion'] = sys.version config_data['databaseVersion'] = NonEmptyDict() config_data['databaseVersion']['major'] = app.MAJOR_DB_VERSION config_data['databaseVersion']['minor'] = app.MINOR_DB_VERSION config_data['os'] = platform.platform() config_data['locale'] = '.'.join( [text_type(loc or 'Unknown') for loc in app.LOCALE]) config_data['localUser'] = app.OS_USER or 'Unknown' config_data['programDir'] = app.PROG_DIR config_data['configFile'] = app.CONFIG_FILE config_data['dbPath'] = db.DBConnection().path config_data['cacheDir'] = app.CACHE_DIR config_data['logDir'] = app.LOG_DIR config_data['appArgs'] = app.MY_ARGS config_data['webRoot'] = app.WEB_ROOT config_data['githubUrl'] = app.GITHUB_IO_URL config_data['wikiUrl'] = app.WIKI_URL config_data['sourceUrl'] = app.APPLICATION_URL config_data['downloadUrl'] = app.DOWNLOAD_URL config_data['subtitlesMulti'] = app.SUBTITLES_MULTI config_data['namingForceFolders'] = app.NAMING_FORCE_FOLDERS config_data['subtitles'] = NonEmptyDict() config_data['subtitles']['enabled'] = bool(app.USE_SUBTITLES) config_data['kodi'] = NonEmptyDict() config_data['kodi']['enabled'] = bool(app.USE_KODI and app.KODI_UPDATE_LIBRARY) config_data['plex'] = NonEmptyDict() config_data['plex']['server'] = NonEmptyDict() config_data['plex']['server']['enabled'] = bool(app.USE_PLEX_SERVER) config_data['plex']['server']['notify'] = NonEmptyDict() config_data['plex']['server']['notify']['snatch'] = bool( app.PLEX_NOTIFY_ONSNATCH) config_data['plex']['server']['notify']['download'] = bool( app.PLEX_NOTIFY_ONDOWNLOAD) config_data['plex']['server']['notify']['subtitleDownload'] = bool( app.PLEX_NOTIFY_ONSUBTITLEDOWNLOAD) config_data['plex']['server']['updateLibrary'] = bool( app.PLEX_UPDATE_LIBRARY) config_data['plex']['server']['host'] = app.PLEX_SERVER_HOST config_data['plex']['server']['token'] = app.PLEX_SERVER_TOKEN config_data['plex']['server']['username'] = app.PLEX_SERVER_USERNAME config_data['plex']['server']['password'] = app.PLEX_SERVER_PASSWORD config_data['plex']['client'] = NonEmptyDict() config_data['plex']['client']['enabled'] = bool(app.USE_PLEX_CLIENT) config_data['plex']['client']['username'] = app.PLEX_CLIENT_USERNAME config_data['plex']['client']['password'] = app.PLEX_CLIENT_PASSWORD config_data['plex']['client']['host'] = app.PLEX_CLIENT_HOST config_data['emby'] = NonEmptyDict() config_data['emby']['enabled'] = bool(app.USE_EMBY) config_data['torrents'] = NonEmptyDict() config_data['torrents']['enabled'] = bool(app.USE_TORRENTS) config_data['torrents']['method'] = app.TORRENT_METHOD config_data['torrents']['username'] = app.TORRENT_USERNAME config_data['torrents']['password'] = app.TORRENT_PASSWORD config_data['torrents']['label'] = app.TORRENT_LABEL config_data['torrents']['labelAnime'] = app.TORRENT_LABEL_ANIME config_data['torrents']['verifySSL'] = app.TORRENT_VERIFY_CERT config_data['torrents']['path'] = app.TORRENT_PATH config_data['torrents']['seedTime'] = app.TORRENT_SEED_TIME config_data['torrents']['paused'] = app.TORRENT_PAUSED config_data['torrents']['highBandwidth'] = app.TORRENT_HIGH_BANDWIDTH config_data['torrents']['host'] = app.TORRENT_HOST config_data['torrents']['rpcurl'] = app.TORRENT_RPCURL config_data['torrents']['authType'] = app.TORRENT_AUTH_TYPE config_data['nzb'] = NonEmptyDict() config_data['nzb']['enabled'] = bool(app.USE_NZBS) config_data['nzb']['username'] = app.NZBGET_USERNAME config_data['nzb']['password'] = app.NZBGET_PASSWORD # app.NZBGET_CATEGORY # app.NZBGET_CATEGORY_BACKLOG # app.NZBGET_CATEGORY_ANIME # app.NZBGET_CATEGORY_ANIME_BACKLOG config_data['nzb']['host'] = app.NZBGET_HOST config_data['nzb']['priority'] = app.NZBGET_PRIORITY config_data['layout'] = NonEmptyDict() config_data['layout']['schedule'] = app.COMING_EPS_LAYOUT config_data['layout']['history'] = app.HISTORY_LAYOUT config_data['layout']['home'] = app.HOME_LAYOUT config_data['layout']['show'] = NonEmptyDict() config_data['layout']['show']['allSeasons'] = bool( app.DISPLAY_ALL_SEASONS) config_data['layout']['show']['specials'] = bool( app.DISPLAY_SHOW_SPECIALS) config_data['layout']['show']['showListOrder'] = app.SHOW_LIST_ORDER config_data['selectedRootIndex'] = int( app.SELECTED_ROOT ) if app.SELECTED_ROOT is not None else -1 # All paths config_data['backlogOverview'] = NonEmptyDict() config_data['backlogOverview']['period'] = app.BACKLOG_PERIOD config_data['backlogOverview']['status'] = app.BACKLOG_STATUS config_data['indexers'] = NonEmptyDict() config_data['indexers']['config'] = get_indexer_config() if not identifier: return self._paginate([config_data]) if path_param: if path_param not in config_data: return self._bad_request( '{key} is a invalid path'.format(key=path_param)) config_data = config_data[path_param] return self._ok(data=config_data)
def config_main(monkeypatch, app_config): python_version = 'Python Test v1.2.3.4' monkeypatch.setattr(sys, 'version', python_version) app_config('PID', 4321) os_user = app_config('OS_USER', 'superuser') app_config('LOCALE', (None, 'ABC')) app_locale = 'Unknown.ABC' # postProcessing.naming app_config('NAMING_ANIME', 3) config_data = NonEmptyDict() config_data['anonRedirect'] = app.ANON_REDIRECT config_data['animeSplitHome'] = bool(app.ANIME_SPLIT_HOME) config_data['animeSplitHomeInTabs'] = bool(app.ANIME_SPLIT_HOME_IN_TABS) config_data['comingEpsSort'] = app.COMING_EPS_SORT config_data['comingEpsDisplayPaused'] = bool(app.COMING_EPS_DISPLAY_PAUSED) config_data['datePreset'] = app.DATE_PRESET config_data['fuzzyDating'] = bool(app.FUZZY_DATING) config_data['themeName'] = app.THEME_NAME config_data['posterSortby'] = app.POSTER_SORTBY config_data['posterSortdir'] = app.POSTER_SORTDIR config_data['rootDirs'] = app.ROOT_DIRS config_data['sortArticle'] = bool(app.SORT_ARTICLE) config_data['timePreset'] = app.TIME_PRESET config_data['trimZero'] = bool(app.TRIM_ZERO) config_data['fanartBackground'] = bool(app.FANART_BACKGROUND) config_data['fanartBackgroundOpacity'] = float( app.FANART_BACKGROUND_OPACITY or 0) config_data['gitUsername'] = app.GIT_USERNAME config_data['branch'] = app.BRANCH config_data['commitHash'] = app.CUR_COMMIT_HASH config_data['release'] = app.APP_VERSION config_data['sslVersion'] = app.OPENSSL_VERSION config_data['pythonVersion'] = sys.version config_data['databaseVersion'] = NonEmptyDict() config_data['databaseVersion']['major'] = app.MAJOR_DB_VERSION config_data['databaseVersion']['minor'] = app.MINOR_DB_VERSION config_data['os'] = platform.platform() config_data['pid'] = app.PID config_data['locale'] = app_locale config_data['localUser'] = os_user config_data['programDir'] = app.PROG_DIR config_data['dataDir'] = app.DATA_DIR config_data['configFile'] = app.CONFIG_FILE config_data['dbPath'] = db.DBConnection().path config_data['cacheDir'] = app.CACHE_DIR config_data['logDir'] = app.LOG_DIR config_data['appArgs'] = app.MY_ARGS config_data['webRoot'] = app.WEB_ROOT config_data['runsInDocker'] = bool(app.RUNS_IN_DOCKER) config_data['githubUrl'] = app.GITHUB_IO_URL config_data['wikiUrl'] = app.WIKI_URL config_data['donationsUrl'] = app.DONATIONS_URL config_data['sourceUrl'] = app.APPLICATION_URL config_data['downloadUrl'] = app.DOWNLOAD_URL config_data['subtitlesMulti'] = bool(app.SUBTITLES_MULTI) config_data['namingForceFolders'] = bool(app.NAMING_FORCE_FOLDERS) config_data['subtitles'] = NonEmptyDict() config_data['subtitles']['enabled'] = bool(app.USE_SUBTITLES) config_data['recentShows'] = app.SHOWS_RECENT config_data['showDefaults'] = {} config_data['showDefaults']['status'] = app.STATUS_DEFAULT config_data['showDefaults']['statusAfter'] = app.STATUS_DEFAULT_AFTER config_data['showDefaults']['quality'] = app.QUALITY_DEFAULT config_data['showDefaults']['subtitles'] = bool(app.SUBTITLES_DEFAULT) config_data['showDefaults']['seasonFolders'] = bool( app.SEASON_FOLDERS_DEFAULT) config_data['showDefaults']['anime'] = bool(app.ANIME_DEFAULT) config_data['showDefaults']['scene'] = bool(app.SCENE_DEFAULT) config_data['news'] = NonEmptyDict() config_data['news']['lastRead'] = app.NEWS_LAST_READ config_data['news']['latest'] = app.NEWS_LATEST config_data['news']['unread'] = app.NEWS_UNREAD config_data['logs'] = NonEmptyDict() config_data['logs']['loggingLevels'] = { k.lower(): v for k, v in iteritems(logger.LOGGING_LEVELS) } config_data['logs']['numErrors'] = len(classes.ErrorViewer.errors) config_data['logs']['numWarnings'] = len(classes.WarningViewer.errors) config_data['failedDownloads'] = NonEmptyDict() config_data['failedDownloads']['enabled'] = bool(app.USE_FAILED_DOWNLOADS) config_data['failedDownloads']['deleteFailed'] = bool(app.DELETE_FAILED) config_data['layout'] = NonEmptyDict() config_data['layout']['schedule'] = app.COMING_EPS_LAYOUT config_data['layout']['history'] = app.HISTORY_LAYOUT config_data['layout']['home'] = app.HOME_LAYOUT config_data['layout']['show'] = NonEmptyDict() config_data['layout']['show']['allSeasons'] = bool(app.DISPLAY_ALL_SEASONS) config_data['layout']['show']['specials'] = bool(app.DISPLAY_SHOW_SPECIALS) config_data['layout']['show']['showListOrder'] = app.SHOW_LIST_ORDER config_data['selectedRootIndex'] = int( app.SELECTED_ROOT ) if app.SELECTED_ROOT is not None else -1 # All paths config_data['backlogOverview'] = NonEmptyDict() config_data['backlogOverview']['period'] = app.BACKLOG_PERIOD config_data['backlogOverview']['status'] = app.BACKLOG_STATUS config_data['indexers'] = NonEmptyDict() config_data['indexers']['config'] = get_indexer_config() config_data['postProcessing'] = NonEmptyDict() config_data['postProcessing']['naming'] = NonEmptyDict() config_data['postProcessing']['naming']['pattern'] = app.NAMING_PATTERN config_data['postProcessing']['naming']['multiEp'] = int( app.NAMING_MULTI_EP) config_data['postProcessing']['naming'][ 'patternAirByDate'] = app.NAMING_ABD_PATTERN config_data['postProcessing']['naming'][ 'patternSports'] = app.NAMING_SPORTS_PATTERN config_data['postProcessing']['naming'][ 'patternAnime'] = app.NAMING_ANIME_PATTERN config_data['postProcessing']['naming'][ 'enableCustomNamingAirByDate'] = bool(app.NAMING_CUSTOM_ABD) config_data['postProcessing']['naming']['enableCustomNamingSports'] = bool( app.NAMING_CUSTOM_SPORTS) config_data['postProcessing']['naming']['enableCustomNamingAnime'] = bool( app.NAMING_CUSTOM_ANIME) config_data['postProcessing']['naming']['animeMultiEp'] = int( app.NAMING_ANIME_MULTI_EP) config_data['postProcessing']['naming']['animeNamingType'] = int( app.NAMING_ANIME) config_data['postProcessing']['naming']['stripYear'] = bool( app.NAMING_STRIP_YEAR) config_data['postProcessing']['showDownloadDir'] = app.TV_DOWNLOAD_DIR config_data['postProcessing']['processAutomatically'] = bool( app.PROCESS_AUTOMATICALLY) config_data['postProcessing']['postponeIfSyncFiles'] = bool( app.POSTPONE_IF_SYNC_FILES) config_data['postProcessing']['postponeIfNoSubs'] = bool( app.POSTPONE_IF_NO_SUBS) config_data['postProcessing']['renameEpisodes'] = bool(app.RENAME_EPISODES) config_data['postProcessing']['createMissingShowDirs'] = bool( app.CREATE_MISSING_SHOW_DIRS) config_data['postProcessing']['addShowsWithoutDir'] = bool( app.ADD_SHOWS_WO_DIR) config_data['postProcessing']['moveAssociatedFiles'] = bool( app.MOVE_ASSOCIATED_FILES) config_data['postProcessing']['nfoRename'] = bool(app.NFO_RENAME) config_data['postProcessing']['airdateEpisodes'] = bool( app.AIRDATE_EPISODES) config_data['postProcessing']['unpack'] = bool(app.UNPACK) config_data['postProcessing']['deleteRarContent'] = bool( app.DELRARCONTENTS) config_data['postProcessing']['noDelete'] = bool(app.NO_DELETE) config_data['postProcessing']['processMethod'] = app.PROCESS_METHOD config_data['postProcessing']['reflinkAvailable'] = bool( pkgutil.find_loader('reflink')) config_data['postProcessing']['autoPostprocessorFrequency'] = int( app.AUTOPOSTPROCESSOR_FREQUENCY) config_data['postProcessing']['syncFiles'] = app.SYNC_FILES config_data['postProcessing'][ 'fileTimestampTimezone'] = app.FILE_TIMESTAMP_TIMEZONE config_data['postProcessing']['allowedExtensions'] = list( app.ALLOWED_EXTENSIONS) config_data['postProcessing']['extraScripts'] = app.EXTRA_SCRIPTS config_data['postProcessing']['extraScriptsUrl'] = app.EXTRA_SCRIPTS_URL config_data['postProcessing']['multiEpStrings'] = { text_type(k): v for k, v in iteritems(common.MULTI_EP_STRINGS) } return config_data
def get(self, identifier, path_param): """Query scene_exception information.""" cache_db_con = db.DBConnection('cache.db') sql_base = (b'SELECT ' b' exception_id, ' b' indexer, ' b' indexer_id, ' b' show_name, ' b' season, ' b' custom ' b'FROM scene_exceptions ') sql_where = [] params = [] if identifier is not None: sql_where.append(b'exception_id') params += [identifier] else: series_slug = self.get_query_argument('series', None) series_identifier = SeriesIdentifier.from_slug(series_slug) if series_slug and not series_identifier: return self._bad_request('Invalid series') season = self._parse(self.get_query_argument('season', None)) exception_type = self.get_query_argument('type', None) if exception_type and exception_type not in ('local', ): return self._bad_request('Invalid type') if series_identifier: sql_where.append(b'indexer') sql_where.append(b'indexer_id') params += [series_identifier.indexer.id, series_identifier.id] if season is not None: sql_where.append(b'season') params += [season] if exception_type == 'local': sql_where.append(b'custom') params += [1] if sql_where: sql_base += b' WHERE ' + b' AND '.join( [where + b' = ? ' for where in sql_where]) sql_results = cache_db_con.select(sql_base, params) data = [] for item in sql_results: d = NonEmptyDict() d['id'] = item[0] d['series'] = SeriesIdentifier.from_id(item[1], item[2]).slug d['name'] = item[3] d['season'] = item[4] if item[4] >= 0 else None d['type'] = 'local' if item[5] else None data.append(d) if not identifier: return self._paginate(data, sort='id') if not data: return self._not_found('Alias not found') data = data[0] if path_param: if path_param not in data: return self._bad_request('Invalid path parameter') data = data[path_param] return self._ok(data=data)