Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/apiv2 add config search attributes #5079

Merged
merged 5 commits into from
Oct 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
- Added a new field name 'watched' to the tv_episodes db table. UI will be added in future ([#4825](https://github.com/pymedusa/Medusa/pull/4825))
- Standardized most titles and headers ([#4663](https://github.com/pymedusa/Medusa/pull/4663))
- Converted IRC page into a Vue SFC ([#5089](https://github.com/pymedusa/Medusa/pull/5089))
- Added config/search values to apiv2 ([#5079](https://github.com/pymedusa/Medusa/pull/5079))

#### Fixes
- Fixed error when changing episode status from episode status management ([#4783](https://github.com/pymedusa/Medusa/pull/4783))
Expand Down
103 changes: 103 additions & 0 deletions dredd/api-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,109 @@ definitions:
type: string
multiEpStrings:
type: object
search:
type: object
properties:
general:
type: object
properties:
randomizeProviders:
type: boolean
downloadPropers:
type: boolean
checkPropersInterval:
type: string
propersSearchDays:
type: integer
backlogDays:
type: integer
backlogFrequency:
type: integer
minBacklogFrequency:
type: integer
dailySearchFrequency:
type: integer
minDailySearchFrequency:
type: integer
removeFromClient:
type: boolean
torrentCheckerFrequency:
type: integer
minTorrentCheckerFrequency:
type: integer
usenetRetention:
type: integer
trackersList:
type: array
allowHighPriority:
type: boolean
useFailedDownloads:
type: boolean
deleteFailed:
type: boolean
cacheTrimming:
type: boolean
maxCacheAge:
type: integer
filters:
type: object
properties:
ignored:
type: array
undesired:
type: array
preferred:
type: array
required:
type: array
ignoredSubsList:
type: array
ignoreUnknownSubs:
type: boolean
showDownloadDir:
type: string
processAutomatically:
type: boolean
postponeIfSyncFiles:
type: boolean
postponeIfNoSubs:
type: boolean
renameEpisodes:
type: boolean
createMissingShowDirs:
type: boolean
addShowsWithoutDir:
type: boolean
moveAssociatedFiles:
type: boolean
nfoRename:
type: boolean
airdateEpisodes:
type: boolean
unpack:
type: boolean
deleteRarContent:
type: boolean
noDelete:
type: boolean
processMethod:
type: string
reflinkAvailable:
type: boolean
autoPostprocessorFrequency:
type: integer
syncFiles:
type: array
fileTimestampTimezone:
type: string
allowedExtensions:
type: array
extraScripts:
type: array
extraScriptsUrl:
type: string
multiEpStrings:
type: object

Log:
type: object
Expand Down
69 changes: 68 additions & 1 deletion medusa/server/api/v2/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,35 @@ class ConfigHandler(BaseRequestHandler):
'postProcessing.naming.animeMultiEp': IntegerField(app, 'NAMING_ANIME_MULTI_EP'),
'postProcessing.naming.animeNamingType': IntegerField(app, 'NAMING_ANIME'),
'postProcessing.naming.multiEp': IntegerField(app, 'NAMING_MULTI_EP'),
'postProcessing.naming.stripYear': BooleanField(app, 'NAMING_STRIP_YEAR')
'postProcessing.naming.stripYear': BooleanField(app, 'NAMING_STRIP_YEAR'),

'search.general.randomizeProviders': BooleanField(app, 'RANDOMIZE_PROVIDERS'),
'search.general.downloadPropers': BooleanField(app, 'DOWNLOAD_PROPERS'),
'search.general.checkPropersInterval': StringField(app, 'CHECK_PROPERS_INTERVAL'),
# 'search.general.propersIntervalLabels': IntegerField(app, 'PROPERS_INTERVAL_LABELS'),
'search.general.propersSearchDays': IntegerField(app, 'PROPERS_SEARCH_DAYS'),
'search.general.backlogDays': IntegerField(app, 'BACKLOG_DAYS'),
'search.general.backlogFrequency': IntegerField(app, 'BACKLOG_FREQUENCY'),
'search.general.minBacklogFrequency': IntegerField(app, 'MIN_BACKLOG_FREQUENCY'),
'search.general.dailySearchFrequency': IntegerField(app, 'DAILYSEARCH_FREQUENCY'),
'search.general.minDailySearchFrequency': IntegerField(app, 'MIN_DAILYSEARCH_FREQUENCY'),
'search.general.removeFromClient': BooleanField(app, 'REMOVE_FROM_CLIENT'),
'search.general.torrentCheckerFrequency': IntegerField(app, 'TORRENT_CHECKER_FREQUENCY'),
'search.general.minTorrentCheckerFrequency': IntegerField(app, 'MIN_TORRENT_CHECKER_FREQUENCY'),
'search.general.usenetRetention': IntegerField(app, 'USENET_RETENTION'),
'search.general.trackersList': ListField(app, 'TRACKERS_LIST'),
'search.general.allowHighPriority': BooleanField(app, 'ALLOW_HIGH_PRIORITY'),
'search.general.useFailedDownloads': BooleanField(app, 'USE_FAILED_DOWNLOADS'),
'search.general.deleteFailed': BooleanField(app, 'DELETE_FAILED'),
'search.general.cacheTrimming': BooleanField(app, 'CACHE_TRIMMING'),
'search.general.maxCacheAge': IntegerField(app, 'MAX_CACHE_AGE'),

'search.filters.ignored': ListField(app, 'IGNORE_WORDS'),
'search.filters.undesired': ListField(app, 'UNDESIRED_WORDS'),
'search.filters.preferred': ListField(app, 'PREFERRED_WORDS'),
'search.filters.required': ListField(app, 'REQUIRE_WORDS'),
'search.filters.ignoredSubsList': ListField(app, 'IGNORED_SUBS_LIST'),
'search.filters.ignoreUnknownSubs': BooleanField(app, 'IGNORE_UND_SUBS'),
}

def http_get(self, identifier, path_param=None):
Expand Down Expand Up @@ -547,3 +575,42 @@ def data_metadata():
section_data['metadataProviders'][json_repr['id']] = json_repr

return section_data

@staticmethod
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