From c3e36d2dc716f70d4c748dbf63a59b129e432dea Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Fri, 30 Oct 2020 01:44:35 +0000 Subject: [PATCH] Fix an old and rare thread timing case that can change a show to the wrong type while fetching alternative names. --- CHANGES.md | 7 ++++++- sickbeard/show_name_helpers.py | 19 +++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1fde0fc..fd6607c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,9 @@ -### 0.22.10 (2020-10-28 14:10:00 UTC) +### 0.22.11 (2020-10-30 01:45:00 UTC) + +* Fix an old and rare thread timing case that can change a show to the wrong type while fetching alternative names + + +### 0.22.10 (2020-10-28 14:10:00 UTC) * Fix clear of old fail times for providers diff --git a/sickbeard/show_name_helpers.py b/sickbeard/show_name_helpers.py index ba6b474..e9452f7 100644 --- a/sickbeard/show_name_helpers.py +++ b/sickbeard/show_name_helpers.py @@ -223,16 +223,11 @@ def get_show_names(ep_obj, spacer='.'): :param spacer: spacer :return: """ - old_anime, old_dirty = ep_obj.show_obj.is_anime, ep_obj.show_obj.dirty - ep_obj.show_obj.anime = 1 # used to limit results from all_possible(...) - show_names = get_show_names_all_possible(ep_obj.show_obj, season=ep_obj.season, spacer=spacer) - ep_obj.show_obj.anime = old_anime # temporary measure, so restore property then dirty flag - ep_obj.show_obj.dirty = old_dirty - return show_names + return get_show_names_all_possible(ep_obj.show_obj, season=ep_obj.season, spacer=spacer, force_anime=True) -def get_show_names_all_possible(show_obj, season=-1, scenify=True, spacer='.'): - # type: (sickbeard.tv.TVShow, int, bool, AnyStr) -> List[AnyStr] +def get_show_names_all_possible(show_obj, season=-1, scenify=True, spacer='.', force_anime=False): + # type: (sickbeard.tv.TVShow, int, bool, AnyStr, bool) -> List[AnyStr] """ :param show_obj: show object @@ -241,7 +236,7 @@ def get_show_names_all_possible(show_obj, season=-1, scenify=True, spacer='.'): :param spacer: spacer :return: """ - show_names = list(set(allPossibleShowNames(show_obj, season=season))) # type: List[AnyStr] + show_names = list(set(allPossibleShowNames(show_obj, season=season, force_anime=force_anime))) # type: List[AnyStr] if scenify: show_names = map_list(sanitize_scene_name, show_names) return url_encode(show_names, spacer) @@ -380,8 +375,8 @@ def makeSceneSearchString(show_obj, # type: sickbeard.tv.TVShow return to_return -def allPossibleShowNames(show_obj, season=-1): - # type: (sickbeard.tv.TVShow, int) -> List[AnyStr] +def allPossibleShowNames(show_obj, season=-1, force_anime=False): + # type: (sickbeard.tv.TVShow, int, bool) -> List[AnyStr] """ Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name, country codes on the end, eg. "Show Name (AU)", and any scene exception names. @@ -399,7 +394,7 @@ def allPossibleShowNames(show_obj, season=-1): if season in [-1, 1]: showNames.append(show_obj.name) - if not show_obj.is_anime: + if not show_obj.is_anime and not force_anime: newShowNames = [] country_list = common.countryList country_list.update(dict(zip(itervalues(common.countryList), iterkeys(common.countryList))))