Skip to content

Commit

Permalink
Merge pull request #10346 from pymedusa/release/release-0.5.24
Browse files Browse the repository at this point in the history
Release/release 0.5.24
  • Loading branch information
p0psicles authored Feb 15, 2022
2 parents dd0b950 + 0dac9c4 commit 4908f30
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 64 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.5.24 (15-02-2022)

#### Improvements
- Improve show updates. Update the complete show when marked updated by indexer, without an indication to update a season. ([10330](https://github.com/pymedusa/Medusa/pull/10330))

#### Fixes
- Fix searching for season packs. ([10345](https://github.com/pymedusa/Medusa/pull/10345))

## 0.5.23 (11-02-2022)

#### New Features
Expand Down
2 changes: 1 addition & 1 deletion medusa/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
log.logger.addHandler(logging.NullHandler())

INSTANCE_ID = text_type(uuid.uuid1())
VERSION = '0.5.23'
VERSION = '0.5.24'

USER_AGENT = 'Medusa/{version} ({system}; {release}; {instance})'.format(
version=VERSION, system=platform.system(), release=platform.release(),
Expand Down
45 changes: 26 additions & 19 deletions medusa/name_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _parse_anime(result):

# It's possible that we map a parsed result to an anime series,
# but the result is not detected/parsed as an anime. In that case, we're using the result.episode_numbers.
else:
elif result.episode_numbers:
for episode_number in result.episode_numbers:
season = result.season_number
episode = episode_number
Expand Down Expand Up @@ -269,6 +269,9 @@ def _parse_anime(result):
'Anime series {name} using using indexer numbering #{absolute}: {ep}',
{'name': result.series.name, 'absolute': idx_abs_ep, 'ep': episode_num(season, episode)}
)
else:
# Treat it as a season pack.
new_season_numbers.append(season_exception or result.season_number)

return new_episode_numbers, new_season_numbers, new_absolute_numbers

Expand All @@ -286,23 +289,27 @@ def _parse_series(result):
{'name': result.series.name}
)

for episode_number in result.episode_numbers:
season = ex_season
episode = episode_number
if result.episode_numbers:
for episode_number in result.episode_numbers:
season = ex_season
episode = episode_number

(idx_season, idx_episode) = scene_numbering.get_indexer_numbering(
result.series,
episode_number,
ex_season
)
(idx_season, idx_episode) = scene_numbering.get_indexer_numbering(
result.series,
episode_number,
ex_season
)

if idx_season is not None:
season = idx_season
if idx_episode is not None:
episode = idx_episode
if idx_season is not None:
season = idx_season
if idx_episode is not None:
episode = idx_episode

new_season_numbers.append(season)
new_episode_numbers.append(episode)
new_season_numbers.append(season)
new_episode_numbers.append(episode)
else:
# No episode numbers. Treat it like a season pack.
new_season_numbers.append(ex_season)

return new_episode_numbers, new_season_numbers, new_absolute_numbers

Expand Down Expand Up @@ -366,13 +373,13 @@ def _parse_string(self, name):
else:
new_episode_numbers, new_season_numbers, new_absolute_numbers = self._parse_series(result)

if not new_season_numbers and not new_episode_numbers:
raise InvalidNameException('The result that was found ({result_name}) is not yet supported by Medusa '
'and will be skipped. Sorry.'.format(result_name=result.original_name))

# Remove None from the list of seasons, as we can't sort on that
new_season_numbers = sorted({season for season in new_season_numbers if season is not None})

if not new_season_numbers:
raise InvalidNameException('The result that was found ({result_name}) is not yet supported by Medusa '
'and will be skipped. Sorry.'.format(result_name=result.original_name))

# need to do a quick sanity check here ex. It's possible that we now have episodes
# from more than one season (by tvdb numbering), and this is just too much
# for the application, so we'd need to flag it.
Expand Down
80 changes: 43 additions & 37 deletions medusa/schedulers/show_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run(self, force=False):
# Refresh the exceptions_cache from db.
refresh_exceptions_cache()

logger.info(u'Started periodic show updates')
logger.info('Started periodic show updates')

# Cache for the indexers list of updated show
indexer_updated_shows = {}
Expand All @@ -48,16 +48,16 @@ def run(self, force=False):
# Loop through the list of shows, and per show evaluate if we can use the .get_last_updated_seasons()
for show in app.showList:
if show.paused:
logger.info(u'The show {show} is paused, not updating it.', show=show.name)
logger.info('The show {show} is paused, not updating it.', show=show.name)
continue

indexer_name = indexerApi(show.indexer).name
indexer_api_params = indexerApi(show.indexer).api_params.copy()
try:
indexer_api = indexerApi(show.indexer).indexer(**indexer_api_params)
except IndexerUnavailable:
logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
u'connectivity issues. While trying to look for show updates on show: {show}',
logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
'connectivity issues. While trying to look for show updates on show: {show}',
indexer_name=indexer_name, show=show.name)
continue

Expand All @@ -78,46 +78,46 @@ def run(self, force=False):
last_updates[indexer_name], update_max_weeks
)
except IndexerUnavailable:
logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
u'connectivity issues while trying to look for show updates on show: {show}',
logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
'connectivity issues while trying to look for show updates on show: {show}',
indexer_name=indexer_name, show=show.name)
continue
except IndexerException as error:
logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
u'issues while trying to get updates for show {show}. Cause: {cause!r}',
logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
'issues while trying to get updates for show {show}. Cause: {cause!r}',
indexer_name=indexer_name, show=show.name, cause=error)
continue
except RequestException as error:
logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
u'issues while trying to get updates for show {show}. Cause: {cause!r}',
logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
'issues while trying to get updates for show {show}. Cause: {cause!r}',
indexer_name=indexer_name, show=show.name, cause=error)

if isinstance(error, HTTPError):
if error.response.status_code == 503:
logger.warning(u'API Service offline: '
u'This service is temporarily offline, try again later.')
logger.warning('API Service offline: '
'This service is temporarily offline, try again later.')
elif error.response.status_code == 429:
logger.warning(u'Your request count (#) is over the allowed limit of (40).')
logger.warning('Your request count (#) is over the allowed limit of (40).')
continue
except Exception as error:
logger.exception(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
u'issues while trying to get updates for show {show}. Cause: {cause!r}.',
logger.exception('Problem running show_updater, Indexer {indexer_name} seems to be having '
'issues while trying to get updates for show {show}. Cause: {cause!r}.',
indexer_name=indexer_name, show=show.name, cause=error)
continue

# Update shows that were updated in the last X weeks
# or were not updated within the last X weeks
if show.indexerid not in indexer_updated_shows.get(show.indexer, []):
if show.last_update_indexer > time.time() - 604800 * update_max_weeks:
logger.debug(u'Skipping show update for {show}. Show was not in the '
u'indexers {indexer_name} list with updated shows and it '
u'was updated within the last {weeks} weeks.', show=show.name,
logger.debug('Skipping show update for {show}. Show was not in the '
'indexers {indexer_name} list with updated shows and it '
'was updated within the last {weeks} weeks.', show=show.name,
indexer_name=indexer_name, weeks=update_max_weeks)
continue

# If indexer doesn't have season updates.
if not hasattr(indexer_api, 'get_last_updated_seasons'):
logger.debug(u'Adding the following show for full update to queue: {show}', show=show.name)
logger.debug('Adding the following show for full update to queue: {show}', show=show.name)
refresh_shows.append(show)

# Else fall back to per season updates.
Expand All @@ -127,46 +127,52 @@ def run(self, force=False):
updated_seasons = indexer_api.get_last_updated_seasons(
[show.indexerid], show.last_update_indexer, update_max_weeks)
except IndexerUnavailable:
logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
u'connectivity issues while trying to look for show updates for show: {show}',
logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
'connectivity issues while trying to look for show updates for show: {show}',
indexer_name=indexer_name, show=show.name)
continue
except IndexerException as error:
logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
u'issues while trying to get updates for show {show}. Cause: {cause!r}',
logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
'issues while trying to get updates for show {show}. Cause: {cause!r}',
indexer_name=indexer_name, show=show.name, cause=error)
continue
except Exception as error:
logger.exception(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
u'issues while trying to get updates for show {show}. Cause: {cause!r}',
logger.exception('Problem running show_updater, Indexer {indexer_name} seems to be having '
'issues while trying to get updates for show {show}. Cause: {cause!r}',
indexer_name=indexer_name, show=show.name, cause=error)
continue

if updated_seasons[show.indexerid]:
logger.info(u'{show_name}: Adding the following seasons for update to queue: {seasons}',
logger.info('{show_name}: Adding the following seasons for update to queue: {seasons}',
show_name=show.name, seasons=updated_seasons[show.indexerid])
season_updates.append((show.indexer, show, updated_seasons[show.indexerid]))
elif show.indexerid in indexer_updated_shows.get(show.indexer, []):
# This show was marked to have an update, but it didn't get a season update. Let's fully
# update the show anyway.
logger.debug('Could not detect a season update, but an update is required. \n'
'Adding the following show for full update to queue: {show}', show=show.name)
refresh_shows.append(show)

pi_list = []
# Full refreshes
for show in refresh_shows:
logger.info(u'Full update on show: {show}', show=show.name)
logger.info('Full update on show: {show}', show=show.name)
try:
pi_list.append(app.show_queue_scheduler.action.updateShow(show))
except (CantUpdateShowException, CantRefreshShowException) as e:
logger.warning(u'Automatic update failed. Error: {error}', error=e)
logger.warning('Automatic update failed. Error: {error}', error=e)
except Exception as e:
logger.error(u'Automatic update failed: Error: {error}', error=e)
logger.error('Automatic update failed: Error: {error}', error=e)

# Only update expired season
for show in season_updates:
logger.info(u'Updating season {season} for show: {show}.', season=show[2], show=show[1].name)
logger.info('Updating season {season} for show: {show}.', season=show[2], show=show[1].name)
try:
pi_list.append(app.show_queue_scheduler.action.updateShow(show[1], season=show[2]))
except CantUpdateShowException as e:
logger.warning(u'Automatic update failed. Error: {error}', error=e)
logger.warning('Automatic update failed. Error: {error}', error=e)
except Exception as e:
logger.error(u'Automatic update failed: Error: {error}', error=e)
logger.error('Automatic update failed: Error: {error}', error=e)

ui.ProgressIndicators.setIndicator('dailyUpdate', ui.QueueProgressIndicator('Daily Update', pi_list))

Expand All @@ -176,20 +182,20 @@ def run(self, force=False):
try:
app.show_queue_scheduler.action.refreshShow(show, True)
except CantRefreshShowException as e:
logger.warning(u'Show refresh on show {show_name} failed. Error: {error}',
logger.warning('Show refresh on show {show_name} failed. Error: {error}',
show_name=show.name, error=e)
except Exception as e:
logger.error(u'Show refresh on show {show_name} failed: Unexpected Error: {error}',
logger.error('Show refresh on show {show_name} failed: Unexpected Error: {error}',
show_name=show.name, error=e)

if refresh_shows or season_updates:
for indexer in set([s.indexer for s in refresh_shows] + [s[1].indexer for s in season_updates]):
indexer_api = indexerApi(indexer)
self.update_cache.set_last_indexer_update(indexer_api.name)
logger.info(u'Updated lastUpdate timestamp for {indexer_name}', indexer_name=indexer_api.name)
logger.info(u'Completed scheduling updates on shows')
logger.info('Updated lastUpdate timestamp for {indexer_name}', indexer_name=indexer_api.name)
logger.info('Completed scheduling updates on shows')
else:
logger.info(u'Completed scheduling updates on shows, but there was nothing to update')
logger.info('Completed scheduling updates on shows, but there was nothing to update')

self.amActive = False

Expand Down
2 changes: 1 addition & 1 deletion medusa/search/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ def search_providers(series_obj, episodes, forced_search=False, down_cur_quality
multi_results, single_results = collect_candidates(
found_results, cur_provider, multi_results, single_results
)
found_eps = itertools.chain(*(result.episodes for result in multi_results + single_results))
found_eps = itertools.chain(*(result.episodes for result in multi_results + single_results if result.episodes))
needed_eps = [ep for ep in episodes if ep not in found_eps]

except AuthException as error:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,17 @@ export default {
parent: this
});
// Bind the 'added' event to the newShow vm.
// Bind the 'selected' event to the searchComponent vm.
this.searchComponent.$on('selected', ({ result }) => {
this.searchedShow.searched = true;
this.searchedShow.indexer = indexerIdToName(result.indexerId);
this.searchedShow.id = result.showId;
// Emit the event
this.$emit('selected', { show, indexer: this.searchedShow.indexer, showId: this.searchedShow.id });
});
// Bind the 'added' event to the newShow vm.
// Bind the 'close' event to the searchComponent vm.
this.searchComponent.$on('close', () => {
this.searchComponent.$destroy();
// Remove the element from the DOM
Expand Down
2 changes: 1 addition & 1 deletion themes/dark/assets/js/medusa-runtime.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/dark/assets/js/medusa-runtime.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/light/assets/js/medusa-runtime.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/light/assets/js/medusa-runtime.js.map

Large diffs are not rendered by default.

0 comments on commit 4908f30

Please sign in to comment.