From 29be151a8e83784b7b00f6f5d6b371835e06a4db Mon Sep 17 00:00:00 2001 From: Dario Date: Thu, 19 Nov 2020 12:04:59 +0100 Subject: [PATCH] Refactor scene exception methods (#8753) * Update JS vue monorepo * yarn dev * Improve scene numbering * Imp doc * update tests * up test * up the test * more opti * flakeit * flake * fix stuff * Fix mapping without scene numbers * Reduce xem_refresh() usage and add ability to force xem refresh * rm unused import * leave no 0 behind * 0 is not a valid abs number Co-authored-by: Renovate Bot --- medusa/helpers/__init__.py | 33 +-- medusa/name_parser/parser.py | 102 +++++---- medusa/queues/show_queue.py | 2 +- medusa/scene_numbering.py | 302 +++++++++++++++++--------- medusa/server/web/home/handler.py | 15 +- medusa/tv/episode.py | 20 +- setup.cfg | 2 +- tests/name_parser/test_parse_anime.py | 26 +-- 8 files changed, 278 insertions(+), 224 deletions(-) diff --git a/medusa/helpers/__init__.py b/medusa/helpers/__init__.py index 9b7a1d2ac6..bbaa34f0b6 100644 --- a/medusa/helpers/__init__.py +++ b/medusa/helpers/__init__.py @@ -42,7 +42,7 @@ from medusa import app, db from medusa.common import DOWNLOADED, USER_AGENT -from medusa.helper.common import (episode_num, http_code_description, media_extensions, +from medusa.helper.common import (http_code_description, media_extensions, pretty_file_size, subtitle_extensions) from medusa.helpers.utils import generate from medusa.imdb import Imdb @@ -741,37 +741,6 @@ def fix_set_group_id(child_path): {'path': child_path, 'gid': parent_gid}) -def get_absolute_number_from_season_and_episode(series_obj, season, episode): - """Find the absolute number for a show episode. - - :param show: Show object - :param season: Season number - :param episode: Episode number - :return: The absolute number - """ - absolute_number = None - - if season and episode: - main_db_con = db.DBConnection() - sql = 'SELECT * FROM tv_episodes WHERE indexer = ? AND showid = ? AND season = ? AND episode = ?' - sql_results = main_db_con.select(sql, [series_obj.indexer, series_obj.series_id, season, episode]) - - if len(sql_results) == 1: - absolute_number = int(sql_results[0]['absolute_number']) - log.debug( - u'Found absolute number {absolute} for show {show} {ep}', { - 'absolute': absolute_number, - 'show': series_obj.name, - 'ep': episode_num(season, episode), - } - ) - else: - log.debug(u'No entries for absolute number for show {show} {ep}', - {'show': series_obj.name, 'ep': episode_num(season, episode)}) - - return absolute_number - - def get_all_episodes_from_absolute_number(show, absolute_numbers, indexer_id=None, indexer=None): episodes = [] season = None diff --git a/medusa/name_parser/parser.py b/medusa/name_parser/parser.py index 5efffaa350..cdcda335d4 100644 --- a/medusa/name_parser/parser.py +++ b/medusa/name_parser/parser.py @@ -148,18 +148,19 @@ def _parse_air_by_date(self, result): season = season_number episode = episode_number - if result.series.is_scene: - (season, episode) = scene_numbering.get_indexer_numbering( - result.series, - season_number, - episode_number, - ) - log.debug( - 'Scene numbering enabled series {name}, using indexer numbering: {ep}', - {'name': result.series.name, 'ep': episode_num(season, episode)} - ) - new_episode_numbers.append(episode) + (idx_season, idx_episode) = scene_numbering.get_indexer_numbering( + result.series, + episode_number, + season_number + ) + + 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) return new_episode_numbers, new_season_numbers @@ -191,20 +192,22 @@ def _parse_anime(result): if result.ab_episode_numbers: for absolute_episode in result.ab_episode_numbers: - a = absolute_episode + abs_ep = absolute_episode # Don't assume that scene_exceptions season is the same as indexer season. # E.g.: [HorribleSubs] Cardcaptor Sakura Clear Card - 08 [720p].mkv thetvdb s04, thexem s02 if season_exception is not None or result.series.is_scene: # Get absolute number from custom numbering (1), XEM (2) or indexer (3) - a = scene_numbering.get_indexer_absolute_numbering( - result.series, a, fallback_to_xem=True, scene_season=season_exception + idx_abs_ep = scene_numbering.get_indexer_abs_numbering( + result.series, abs_ep, season=season_exception ) + if idx_abs_ep is not None: + abs_ep = idx_abs_ep - new_absolute_numbers.append(a) + new_absolute_numbers.append(abs_ep) # Translate the absolute episode number, back to the indexers season and episode. - (season, episodes) = helpers.get_all_episodes_from_absolute_number(result.series, [a]) + (season, episodes) = helpers.get_all_episodes_from_absolute_number(result.series, [abs_ep]) if season and episodes: new_episode_numbers.extend(episodes) @@ -216,18 +219,19 @@ def _parse_anime(result): 'season number in the title, ' 'translating the episode #{abs} to indexer #{indexer_absolute}: {ep}', {'series_name': result.series_name, 'scene_season': season_exception, - 'abs': absolute_episode, 'indexer_absolute': a, 'ep': episode_num(season, episodes[0])} + 'abs': absolute_episode, 'indexer_absolute': abs_ep, + 'ep': episode_num(season, episodes[0])} ) elif result.series.is_scene: log.debug( 'Scene numbering enabled anime series {name} using indexer numbering #{absolute}: {ep}', - {'name': result.series.name, 'season': season, 'absolute': a, + {'name': result.series.name, 'season': season, 'absolute': abs_ep, 'ep': episode_num(season, episodes[0])} ) else: log.debug( 'Anime series {name} using indexer numbering #{absolute}: {ep}', - {'name': result.series.name, 'season': season, 'absolute': a, + {'name': result.series.name, 'season': season, 'absolute': abs_ep, 'ep': episode_num(season, episodes[0])} ) @@ -238,28 +242,35 @@ def _parse_anime(result): season = result.season_number episode = episode_number + idx_abs_ep = scene_numbering.get_indexer_abs_numbering(result.series, episode, season=season) + if idx_abs_ep is not None: + new_absolute_numbers.append(idx_abs_ep) + + (idx_season, idx_episode) = scene_numbering.get_indexer_numbering( + result.series, + episode_number, + result.season_number + ) + + 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) + if result.series.is_scene: - (season, episode) = scene_numbering.get_indexer_numbering( - result.series, - result.season_number, - episode_number - ) log.debug( 'Scene numbering enabled anime {name} using indexer numbering: {ep}', - {'name': result.series.name, 'ep': episode_num(season, episode)} + {'name': result.series.name, 'absolute': idx_abs_ep, 'ep': episode_num(season, episode)} ) - - a = helpers.get_absolute_number_from_season_and_episode(result.series, season, episode) - if a: - new_absolute_numbers.append(a) + else: log.debug( 'Anime series {name} using using indexer numbering #{absolute}: {ep}', - {'name': result.series.name, 'absolute': a, 'ep': episode_num(season, episode)} + {'name': result.series.name, 'absolute': idx_abs_ep, 'ep': episode_num(season, episode)} ) - new_episode_numbers.append(episode) - new_season_numbers.append(season) - return new_episode_numbers, new_season_numbers, new_absolute_numbers @staticmethod @@ -268,24 +279,25 @@ def _parse_series(result): new_season_numbers = [] new_absolute_numbers = [] - season = scene_exceptions.get_season_from_name(result.series, result.series_name) or result.season_number + ex_season = scene_exceptions.get_season_from_name(result.series, result.series_name) or result.season_number for episode_number in result.episode_numbers: + season = ex_season episode = episode_number - if result.series.is_scene: - (season, episode) = scene_numbering.get_indexer_numbering( - result.series, - season, - episode_number - ) - log.debug( - 'Scene numbering enabled series {name} using indexer numbering: {ep}', - {'name': result.series.name, 'ep': episode_num(season, episode)} - ) + (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 - new_episode_numbers.append(episode) new_season_numbers.append(season) + new_episode_numbers.append(episode) return new_episode_numbers, new_season_numbers, new_absolute_numbers diff --git a/medusa/queues/show_queue.py b/medusa/queues/show_queue.py index 18cfd8cf2a..e2a56815d3 100644 --- a/medusa/queues/show_queue.py +++ b/medusa/queues/show_queue.py @@ -504,7 +504,7 @@ def run(self): self.show.populate_cache() # Load XEM data to DB for show - scene_numbering.xem_refresh(self.show) + scene_numbering.xem_refresh(self.show, force=True) except IndexerException as error: log.warning( '{id}: Unable to contact {indexer}. Aborting: {error_msg}', diff --git a/medusa/scene_numbering.py b/medusa/scene_numbering.py index b84d6321ef..d87914f20b 100644 --- a/medusa/scene_numbering.py +++ b/medusa/scene_numbering.py @@ -24,44 +24,23 @@ from __future__ import unicode_literals import datetime +import logging import time import traceback from builtins import str from medusa import db, logger +from medusa.helper.common import episode_num from medusa.helper.exceptions import ex -from medusa.helpers import get_absolute_number_from_season_and_episode from medusa.indexers.api import indexerApi +from medusa.logger.adapters.style import BraceAdapter from medusa.scene_exceptions import safe_session from six import viewitems -def get_scene_numbering(series_obj, season, episode, fallback_to_xem=True): - """ - Returns a tuple, (season, episode), with the scene numbering (if there is one), - otherwise returns the xem numbering (if fallback_to_xem is set), otherwise - returns the TVDB numbering. - (so the return values will always be set) - - :param series_obj: Series object. - :param season: int - :param episode: int - :param fallback_to_xem: bool If set (the default), check xem for matches if there is no local scene numbering - :return: (int, int) a tuple with (season, episode) - """ - if series_obj is None or season is None or episode is None: - return season, episode - - result = find_scene_numbering(series_obj, season, episode) - if result: - return result - else: - if fallback_to_xem: - xem_result = find_xem_numbering(series_obj, season, episode) - if xem_result: - return xem_result - return season, episode +log = BraceAdapter(logging.getLogger(__name__)) +log.logger.addHandler(logging.NullHandler()) def find_scene_numbering(series_obj, season, episode): @@ -126,59 +105,7 @@ def find_scene_absolute_numbering(series_obj, absolute_number): return int(rows[0]['scene_absolute_number']) -def get_indexer_numbering(series_obj, scene_season, scene_episode, fallback_to_xem=True): - """ - Returns a tuple, (season, episode) with the TVDB numbering for (scene_season, scene_episode) - - (this works like the reverse of get_scene_numbering) - """ - if series_obj is None or scene_season is None or scene_episode is None: - return scene_season, scene_episode - - main_db_con = db.DBConnection() - rows = main_db_con.select( - 'SELECT season, episode FROM scene_numbering ' - 'WHERE indexer = ? AND indexer_id = ? AND scene_season = ? AND scene_episode = ?', - [series_obj.indexer, series_obj.series_id, scene_season, scene_episode] - ) - - if rows: - return int(rows[0]['season']), int(rows[0]['episode']) - else: - if fallback_to_xem: - return get_indexer_numbering_for_xem(series_obj, scene_season, scene_episode) - return scene_season, scene_episode - - -def get_indexer_absolute_numbering(series_obj, scene_episode, fallback_to_xem=True, scene_season=None): - """ - Returns a tuple, (season, episode, absolute_number) with the TVDB absolute numbering for (scene_episode) - (this works like the reverse of get_absolute_numbering) - """ - if scene_season is not None: - # Get the real absolute number - real_episode = get_absolute_number_from_season_and_episode( - series_obj, scene_season, scene_episode - ) - scene_episode = real_episode or scene_episode - - main_db_con = db.DBConnection() - rows = main_db_con.select( - 'SELECT absolute_number FROM scene_numbering ' - 'WHERE indexer = ? and indexer_id = ? and scene_absolute_number = ?', - [series_obj.indexer, series_obj.series_id, scene_episode]) - - if rows: - return int(rows[0]['absolute_number']) - - if fallback_to_xem: - a = get_indexer_absolute_numbering_for_xem(series_obj, scene_episode) - return a or scene_episode - - return scene_episode - - -def set_scene_numbering(series_obj, season=None, episode=None, # pylint:disable=too-many-arguments +def set_scene_numbering(series_obj, season=None, episode=None, absolute_number=None, scene_season=None, scene_episode=None, scene_absolute=None): """ @@ -269,49 +196,212 @@ def find_xem_absolute_numbering(series_obj, absolute_number): return int(rows[0]['scene_absolute_number']) -def get_indexer_numbering_for_xem(series_obj, scene_season, scene_episode): - """ - Reverse of find_xem_numbering: lookup a tvdb season and episode using scene numbering +def get_scene_numbering(series_obj, episode, season=None): + xem_refresh(series_obj) + main_db_con = db.DBConnection() - :param indexer_id: int - :param scene_season: int - :param scene_episode: int - :return: (int, int) a tuple of (season, episode) - """ - if series_obj is None or scene_season is None or scene_episode is None: - return scene_season, scene_episode + if season is None: + rows = main_db_con.select( + 'SELECT season, episode FROM tv_episodes ' + 'WHERE indexer = ? AND showid = ? AND scene_absolute_number = ?', + [series_obj.indexer, series_obj.series_id, episode] + ) + else: + rows = main_db_con.select( + 'SELECT season, episode FROM tv_episodes ' + 'WHERE indexer = ? AND showid = ? ' + 'AND scene_season = ? AND scene_episode = ?', + [series_obj.indexer, series_obj.series_id, season, episode] + ) + + if not rows: + return None, None + + (new_sea, new_ep) = int(rows[0]['season']), int(rows[0]['episode']) + log.debug('Found numbering {new} from scene for show {show} {old}', { + 'new': episode_num(new_sea, new_ep), + 'show': series_obj.name, + 'old': episode_num(season, episode) + }) + return new_sea, new_ep + +def get_scene_abs_number(series_obj, episode, season=None): xem_refresh(series_obj) + main_db_con = db.DBConnection() + + if season is None: + rows = main_db_con.select( + 'SELECT absolute_number FROM tv_episodes ' + 'WHERE indexer = ? AND showid = ? AND scene_absolute_number = ?', + [series_obj.indexer, series_obj.series_id, episode] + ) + else: + rows = main_db_con.select( + 'SELECT absolute_number FROM tv_episodes ' + 'WHERE indexer = ? AND showid = ? ' + 'AND scene_season = ? AND scene_episode = ?', + [series_obj.indexer, series_obj.series_id, season, episode] + ) + if rows: + absolute_number = int(rows[0]['absolute_number']) + log.debug('Found absolute number {absolute} from scene for show {show} {ep}', { + 'absolute': absolute_number, + 'show': series_obj.name, + 'ep': episode_num(season, episode), + }) + return absolute_number + + +def get_custom_numbering(series_obj, episode, season=None): main_db_con = db.DBConnection() - rows = main_db_con.select( - 'SELECT season, episode ' - 'FROM tv_episodes ' - 'WHERE indexer = ? AND showid = ? ' - 'AND scene_season = ? AND scene_episode = ?', - [series_obj.indexer, series_obj.series_id, scene_season, scene_episode] - ) + + if season is None: + rows = main_db_con.select( + 'SELECT season, episode FROM scene_numbering ' + 'WHERE indexer = ? AND indexer_id = ? AND scene_absolute_number = ?', + [series_obj.indexer, series_obj.series_id, episode] + ) + else: + rows = main_db_con.select( + 'SELECT season, episode FROM scene_numbering ' + 'WHERE indexer = ? AND indexer_id = ? ' + 'AND scene_season = ? AND scene_episode = ?', + [series_obj.indexer, series_obj.series_id, season, episode] + ) + + if not rows: + return None, None + + (new_sea, new_ep) = int(rows[0]['season']), int(rows[0]['episode']) + log.debug('Found numbering {new} from scene for show {show} {old}', { + 'new': episode_num(new_sea, new_ep), + 'show': series_obj.name, + 'old': episode_num(season, episode) + }) + return new_sea, new_ep + + +def get_custom_abs_number(series_obj, episode, season=None): + main_db_con = db.DBConnection() + + if season is None: + rows = main_db_con.select( + 'SELECT absolute_number FROM scene_numbering ' + 'WHERE indexer = ? AND indexer_id = ? AND scene_absolute_number = ?', + [series_obj.indexer, series_obj.series_id, episode] + ) + else: + rows = main_db_con.select( + 'SELECT absolute_number FROM scene_numbering ' + 'WHERE indexer = ? AND indexer_id = ? ' + 'AND scene_season = ? AND scene_episode = ?', + [series_obj.indexer, series_obj.series_id, season, episode] + ) if rows: - return int(rows[0]['season']), int(rows[0]['episode']) + absolute_number = int(rows[0]['absolute_number']) + log.debug('Found absolute number {absolute} from custom for show {show} {ep}', { + 'absolute': absolute_number, + 'show': series_obj.name, + 'ep': episode_num(season, episode), + }) + return absolute_number - return scene_season, scene_episode +def get_indexer_numbering(series_obj, episode, season=None): + """Find the numbering for a show episode and season. -def get_indexer_absolute_numbering_for_xem(series_obj, scene_episode): - """Reverse of find_xem_numbering: lookup a tvdb season and episode using scene numbering.""" - xem_refresh(series_obj) + :param series_obj: Show object + :param episode: Episode number + :param season: Season number (optional) + :return: Tuple, (season, episode) or (None, None) + """ + numbering = get_custom_numbering(series_obj, episode, season) + if all(number is not None for number in numbering): + return numbering + + if series_obj.is_scene: + numbering = get_scene_numbering(series_obj, episode, season) + if all(number is not None for number in numbering): + return numbering + + if season is not None: + log.debug('Found numbering {new} from parser for show {show} {old}', { + 'new': episode_num(season, episode), + 'show': series_obj.name, + 'old': episode_num(season, episode) + }) + return season, episode main_db_con = db.DBConnection() rows = main_db_con.select( - 'SELECT absolute_number ' - 'FROM tv_episodes ' + 'SELECT season, episode FROM tv_episodes ' + 'WHERE indexer = ? AND showid = ? ' + 'AND absolute_number = ?', + [series_obj.indexer, series_obj.series_id, episode] + ) + + if not rows: + log.debug('No entries for numbering for show {show} {ep}', + {'show': series_obj.name, 'ep': episode_num(season, episode)}) + return None, None + + (new_sea, new_ep) = int(rows[0]['season']), int(rows[0]['episode']) + log.debug('Found numbering {new} from indexer for show {show} {old}', { + 'new': episode_num(new_sea, new_ep), + 'show': series_obj.name, + 'old': episode_num(season, episode) + }) + return new_sea, new_ep + + +def get_indexer_abs_numbering(series_obj, episode, season=None): + """Find the absolute numbering for a show episode and season. + + :param series_obj: Show object + :param episode: Episode number + :param season: Season number (optional) + :return: The absolute number or None + """ + abs_number = get_custom_abs_number(series_obj, episode, season) + if abs_number: + return abs_number + + if series_obj.is_scene: + abs_number = get_scene_abs_number(series_obj, episode, season) + if abs_number: + return abs_number + + if season is None: + abs_number = episode + log.debug('Found absolute number {absolute} from parser for show {show} {ep}', { + 'absolute': abs_number, + 'show': series_obj.name, + 'ep': episode_num(season, episode), + }) + return abs_number + + main_db_con = db.DBConnection() + rows = main_db_con.select( + 'SELECT absolute_number FROM tv_episodes ' 'WHERE indexer = ? AND showid = ? ' - 'AND scene_absolute_number = ?', - [series_obj.indexer, series_obj.series_id, scene_episode]) + 'AND season = ? AND episode = ?', + [series_obj.indexer, series_obj.series_id, season, episode] + ) if rows: - return int(rows[0]['absolute_number']) + abs_number = int(rows[0]['absolute_number']) + log.debug('Found absolute number {absolute} from indexer for show {show} {ep}', { + 'absolute': abs_number, + 'show': series_obj.name, + 'ep': episode_num(season, episode), + }) + return abs_number + + log.debug('No entries for absolute number for show {show} {ep}', + {'show': series_obj.name, 'ep': episode_num(season, episode)}) def get_scene_numbering_for_show(series_obj): diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py index 69fd65e6a2..2a54ae8fda 100644 --- a/medusa/server/web/home/handler.py +++ b/medusa/server/web/home/handler.py @@ -1044,10 +1044,9 @@ def massEditShow( if do_update_scene_numbering or do_erase_parsed_cache: try: xem_refresh(series_obj) - time.sleep(cpu_presets[app.CPU_PRESET]) except CantUpdateShowException as error: errors += 1 - logger.log("Unable to force an update on scene numbering for show '{show}': {error!r}".format + logger.log("Unable to update scene numbering for show '{show}': {error!r}".format (show=series_obj.name, error=error), logger.WARNING) # Must erase cached DB results when toggling scene numbering @@ -1760,16 +1759,10 @@ def setSceneNumbering(self, indexername=None, seriesid=None, forSeason=None, for if series_obj.is_anime: sn = get_scene_absolute_numbering(series_obj, forAbsolute) - if sn: - result['sceneAbsolute'] = sn - else: - result['sceneAbsolute'] = None + result['sceneAbsolute'] = sn else: - sn = get_scene_numbering(series_obj, forSeason, forEpisode) - if sn: - (result['sceneSeason'], result['sceneEpisode']) = sn - else: - (result['sceneSeason'], result['sceneEpisode']) = (None, None) + sn = get_scene_numbering(series_obj, forEpisode, forSeason) + (result['sceneSeason'], result['sceneEpisode']) = sn return json.dumps(result) diff --git a/medusa/tv/episode.py b/medusa/tv/episode.py index 154f0cd7c7..9e9f39494e 100644 --- a/medusa/tv/episode.py +++ b/medusa/tv/episode.py @@ -76,7 +76,6 @@ from medusa.scene_numbering import ( get_scene_absolute_numbering, get_scene_numbering, - xem_refresh, ) from medusa.tv.base import Identifier, TV @@ -664,9 +663,6 @@ def load_from_db(self, season, episode): self.indexerid = int(sql_results[0]['indexerid']) self.indexer = int(sql_results[0]['indexer']) - # FIXME: This shouldn't be part of a possible apiv2 episodes request - xem_refresh(self.series) - self.scene_season = try_int(sql_results[0]['scene_season'], 0) self.scene_episode = try_int(sql_results[0]['scene_episode'], 0) self.scene_absolute_number = try_int(sql_results[0]['scene_absolute_number'], 0) @@ -679,8 +675,7 @@ def load_from_db(self, season, episode): if self.scene_season == 0 or self.scene_episode == 0: self.scene_season, self.scene_episode = get_scene_numbering( - self.series, - self.season, self.episode + self.series, self.episode, self.season ) if sql_results[0]['release_name'] is not None: @@ -825,16 +820,13 @@ def load_from_indexer(self, season=None, episode=None, tvapi=None, cached_season self.season = season self.episode = episode - xem_refresh(self.series) - self.scene_absolute_number = get_scene_absolute_numbering( self.series, self.absolute_number ) self.scene_season, self.scene_episode = get_scene_numbering( - self.series, - self.season, self.episode + self.series, self.episode, self.season ) self.description = getattr(my_ep, 'overview', '') @@ -1027,9 +1019,7 @@ def __load_from_nfo(self, location): ) self.scene_season, self.scene_episode = get_scene_numbering( - self.series.series_id, - self.series.indexer, - self.season, self.episode + self.series, self.episode, self.season ) self.description = ep_details.findtext('plot') @@ -1560,9 +1550,9 @@ def release_group(series, name): '%E': str(self.episode), '%0E': '%02d' % self.episode, '%XS': str(self.scene_season), - '%0XS': '%02d' % self.scene_season, + '%0XS': '%02d' % try_int(self.scene_season, self.season), '%XE': str(self.scene_episode), - '%0XE': '%02d' % self.scene_episode, + '%0XE': '%02d' % try_int(self.scene_episode, self.episode), '%AB': '%(#)03d' % {'#': self.absolute_number}, '%XAB': '%(#)03d' % {'#': self.scene_absolute_number}, '%RN': release_name(self.release_name), diff --git a/setup.cfg b/setup.cfg index c8d4b59306..c738315311 100644 --- a/setup.cfg +++ b/setup.cfg @@ -120,7 +120,7 @@ flake8-ignore = medusa/rss_feeds.py D100 D103 N802 medusa/sbdatetime.py D100 D101 D102 D105 D202 D205 D400 N801 medusa/scene_exceptions.py D100 - medusa/scene_numbering.py D100 D200 D205 D400 D401 E501 N803 N806 + medusa/scene_numbering.py D100 D103 D200 D205 D400 D401 E501 N803 N806 medusa/schedulers/__init__.py D104 medusa/schedulers/episode_updater.py D100 D101 D102 medusa/schedulers/scheduler.py D100 D101 D102 N802 N803 diff --git a/tests/name_parser/test_parse_anime.py b/tests/name_parser/test_parse_anime.py index 7585d4eedf..5ac293980d 100644 --- a/tests/name_parser/test_parse_anime.py +++ b/tests/name_parser/test_parse_anime.py @@ -19,7 +19,7 @@ 'indexer_incorrect_absolute_ep_episodes': 8, 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', 2), - ('medusa.scene_numbering.get_indexer_absolute_numbering', 78), + ('medusa.scene_numbering.get_indexer_abs_numbering', 78), ('medusa.helpers.get_all_episodes_from_absolute_number', (4, [8])) ], 'series_info':{ @@ -38,7 +38,7 @@ 'indexer_incorrect_absolute_ep_episodes': 8, 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', 2), - ('medusa.scene_numbering.get_indexer_absolute_numbering', 78), + ('medusa.scene_numbering.get_indexer_abs_numbering', 78), ('medusa.helpers.get_all_episodes_from_absolute_number', (4, [8])) ], 'series_info': { @@ -57,7 +57,7 @@ 'indexer_incorrect_absolute_ep_episodes': 8, 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', None), - ('medusa.scene_numbering.get_indexer_absolute_numbering', 8), + ('medusa.scene_numbering.get_indexer_abs_numbering', 8), ('medusa.helpers.get_all_episodes_from_absolute_number', (1, [8])) ], 'series_info': { @@ -73,7 +73,7 @@ 'indexer': 262954, 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', None), - ('medusa.scene_numbering.get_indexer_absolute_numbering', 26), + ('medusa.scene_numbering.get_indexer_abs_numbering', 26), ('medusa.helpers.get_all_episodes_from_absolute_number', (1, [26])) ], 'series_info': { @@ -89,7 +89,7 @@ 'indexer': 262954, 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', 3), - ('medusa.scene_numbering.get_indexer_absolute_numbering', 52), + ('medusa.scene_numbering.get_indexer_abs_numbering', 52), ('medusa.helpers.get_all_episodes_from_absolute_number', (2, [26])) ], 'series_info': { @@ -105,7 +105,7 @@ 'indexer': 262954, 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', 4), - ('medusa.scene_numbering.get_indexer_absolute_numbering', 100), + ('medusa.scene_numbering.get_indexer_abs_numbering', 100), ('medusa.helpers.get_all_episodes_from_absolute_number', (3, [26])) ], 'series_info': { @@ -122,7 +122,7 @@ 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', None), ('medusa.scene_numbering.get_indexer_numbering', (2, 13)), - ('medusa.helpers.get_absolute_number_from_season_and_episode', 26), + ('medusa.scene_numbering.get_indexer_abs_numbering', 26), ], 'series_info': { 'name': u"Ajin", @@ -138,7 +138,7 @@ 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', None), ('medusa.scene_numbering.get_indexer_numbering', (2, 13)), - ('medusa.helpers.get_absolute_number_from_season_and_episode', 26), + ('medusa.scene_numbering.get_indexer_abs_numbering', 26), ], 'series_info': { 'name': u"Ajin", @@ -153,7 +153,7 @@ 'indexer': 295068, 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', None), - ('medusa.scene_numbering.get_indexer_absolute_numbering', 2), + ('medusa.scene_numbering.get_indexer_abs_numbering', 2), ('medusa.helpers.get_all_episodes_from_absolute_number', (1, [2])) ], 'series_info': { @@ -169,7 +169,7 @@ 'indexer': 262954, 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', 2), - ('medusa.scene_numbering.get_indexer_absolute_numbering', 38), + ('medusa.scene_numbering.get_indexer_abs_numbering', 38), ('medusa.helpers.get_all_episodes_from_absolute_number', (2, [12])), ], 'series_info': { @@ -184,7 +184,7 @@ 'indexer': 262954, 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', 2), - ('medusa.scene_numbering.get_indexer_absolute_numbering', 38), + ('medusa.scene_numbering.get_indexer_abs_numbering', 38), ('medusa.helpers.get_all_episodes_from_absolute_number', (2, [12])), ], 'series_info': { @@ -202,7 +202,7 @@ 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', 2), ('medusa.scene_numbering.get_indexer_numbering', (2, 12)), - ('medusa.helpers.get_absolute_number_from_season_and_episode', 38), + ('medusa.scene_numbering.get_indexer_abs_numbering', 38), ], 'series_info': { 'name': u"JoJo's Bizarre Adventure", @@ -218,7 +218,7 @@ 'mocks': [ ('medusa.scene_exceptions.get_season_from_name', None), ('medusa.scene_numbering.get_indexer_numbering', (3, 13)), - ('medusa.helpers.get_absolute_number_from_season_and_episode', 43), + ('medusa.scene_numbering.get_indexer_abs_numbering', 43), ], 'series_info': { 'name': u"One Piece",