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

Fix black/whitelist for new shows, refactor episodes and series attrs #9047

Merged
merged 7 commits into from
Jan 19, 2021
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
11 changes: 2 additions & 9 deletions medusa/server/api/v1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1944,15 +1944,8 @@ def run(self):
show_dict['airs'] = text_type(show_obj.airs).replace('am', ' AM').replace('pm', ' PM').replace(' ', ' ')
show_dict['dvdorder'] = (0, 1)[show_obj.dvd_order]

if show_obj.rls_require_words:
show_dict['rls_require_words'] = show_obj.rls_require_words.split(', ')
else:
show_dict['rls_require_words'] = []

if show_obj.rls_ignore_words:
show_dict['rls_ignore_words'] = show_obj.rls_ignore_words.split(', ')
else:
show_dict['rls_ignore_words'] = []
show_dict['release_required_words'] = show_obj.release_required_words
show_dict['release_ignored_words'] = show_obj.release_ignored_words

show_dict['scene'] = (0, 1)[show_obj.scene]
# show_dict['archive_firstmatch'] = (0, 1)[show_obj.archive_firstmatch]
Expand Down
8 changes: 4 additions & 4 deletions medusa/server/api/v2/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def post(self, series_slug=None, path_param=None):
'scene': data_options.get('scene'),
'paused': data_options.get('paused'),
'blacklist': data_options['release'].get('blacklist', []) if data_options.get('release') else None,
'whitelist: ': data_options['release'].get('whitelist', []) if data_options.get('release') else None,
'whitelist': data_options['release'].get('whitelist', []) if data_options.get('release') else None,
'default_status_after': data_options.get('statusAfter'),
'root_dir': data_options.get('rootDir'),
'show_lists': data_options.get('showLists')
Expand Down Expand Up @@ -156,11 +156,11 @@ def patch(self, series_slug, path_param=None):
'config.airByDate': BooleanField(series, 'air_by_date'),
'config.subtitlesEnabled': BooleanField(series, 'subtitles'),
'config.release.requiredWords': ListField(series, 'release_required_words'),
'config.release.ignoredWords': ListField(series, 'release_ignore_words'),
'config.release.ignoredWords': ListField(series, 'release_ignored_words'),
'config.release.blacklist': ListField(series, 'blacklist'),
'config.release.whitelist': ListField(series, 'whitelist'),
'config.release.requiredWordsExclude': BooleanField(series, 'rls_require_exclude'),
'config.release.ignoredWordsExclude': BooleanField(series, 'rls_ignore_exclude'),
'config.release.requiredWordsExclude': BooleanField(series, 'release_required_exclude'),
'config.release.ignoredWordsExclude': BooleanField(series, 'release_ignored_exclude'),
'language': StringField(series, 'lang'),
'config.qualities.allowed': ListField(series, 'qualities_allowed'),
'config.qualities.preferred': ListField(series, 'qualities_preferred'),
Expand Down
59 changes: 24 additions & 35 deletions medusa/tv/episode.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,9 @@ def __init__(self, series, season, episode, filepath=''):
"""Instantiate a Episode with database information."""
super(Episode, self).__init__(
int(series.indexer) if series else 0,
0,
{'series',
'scene_season',
'scene_episode',
'scene_absolute_number',
'related_episodes',
'wanted_quality'
}
)
int(series.indexerid) if series else 0,
{'series', 'related_episodes', 'wanted_quality'})

self.series = series
self.name = ''
self.season = season
Expand Down Expand Up @@ -705,32 +699,39 @@ def load_from_db(self, season, episode):
)
return False
else:
if sql_results[0]['name']:
self.name = sql_results[0]['name']

self.name = sql_results[0]['name'] or ''
self.season = season
self.episode = episode
self.absolute_number = sql_results[0]['absolute_number']
self.description = sql_results[0]['description']
if not self.description:
self.description = ''
if sql_results[0]['subtitles'] and sql_results[0]['subtitles']:
self.description = sql_results[0]['description'] or ''

if sql_results[0]['subtitles']:
self.subtitles = sql_results[0]['subtitles'].split(',')

self.subtitles_searchcount = sql_results[0]['subtitles_searchcount']
self.subtitles_lastsearch = sql_results[0]['subtitles_lastsearch']
self.airdate = date.fromordinal(int(sql_results[0]['airdate']))
self.status = int(sql_results[0]['status'] or UNSET)
self.quality = int(sql_results[0]['quality'] or Quality.NA)
self.manually_searched = bool(sql_results[0]['manually_searched'])
self.watched = bool(sql_results[0]['watched'])
self.file_size = int(sql_results[0]['file_size'] or 0)

if sql_results[0]['release_name'] is not None:
self.release_name = sql_results[0]['release_name']

if sql_results[0]['is_proper']:
self.is_proper = int(sql_results[0]['is_proper'])

if sql_results[0]['version']:
self.version = int(sql_results[0]['version'])

if sql_results[0]['release_group'] is not None:
self.release_group = sql_results[0]['release_group']

# don't overwrite my location
if sql_results[0]['location']:
self._location = sql_results[0]['location']
if sql_results[0]['file_size']:
self.file_size = int(sql_results[0]['file_size'])
else:
self.file_size = 0

self.manually_searched = bool(sql_results[0]['manually_searched'])
self.watched = bool(sql_results[0]['watched'])

self.indexerid = int(sql_results[0]['indexerid'])
self.indexer = int(sql_results[0]['indexer'])
Expand All @@ -750,18 +751,6 @@ def load_from_db(self, season, episode):
self.series, self.episode, self.season
)

if sql_results[0]['release_name'] is not None:
self.release_name = sql_results[0]['release_name']

if sql_results[0]['is_proper']:
self.is_proper = int(sql_results[0]['is_proper'])

if sql_results[0]['version']:
self.version = int(sql_results[0]['version'])

if sql_results[0]['release_group'] is not None:
self.release_group = sql_results[0]['release_group']

self.reset_dirty()
return True

Expand Down
Loading