From 31dcd37d52dfb52d091c1131754bba7f1bd94609 Mon Sep 17 00:00:00 2001 From: siankatabg Date: Sat, 17 Jul 2021 14:52:37 +0100 Subject: [PATCH] Added fix for inconsistent movie/tv naming to yavkanet provider --- libs/subliminal_patch/providers/yavkanet.py | 22 ++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/libs/subliminal_patch/providers/yavkanet.py b/libs/subliminal_patch/providers/yavkanet.py index 83c77d93a..9be512491 100644 --- a/libs/subliminal_patch/providers/yavkanet.py +++ b/libs/subliminal_patch/providers/yavkanet.py @@ -15,7 +15,7 @@ from guessit import guessit from dogpile.cache.api import NO_VALUE from subliminal_patch.providers import Provider from subliminal_patch.subtitle import Subtitle, guess_matches -from subliminal_patch.utils import sanitize +from subliminal_patch.utils import sanitize, fix_inconsistent_naming from subliminal.video import Episode, Movie from subliminal.subtitle import fix_line_ending from subliminal.cache import region @@ -25,6 +25,22 @@ from .utils import FIRST_THOUSAND_OR_SO_USER_AGENTS as AGENT_LIST logger = logging.getLogger(__name__) +def fix_tv_naming(title): + """Fix TV show titles with inconsistent naming using dictionary, but do not sanitize them. + :param str title: original title. + :return: new title. + :rtype: str + """ + return fix_inconsistent_naming(title, {"Superman & Lois": "Superman and Lois", + }, True) + + +def fix_movie_naming(title): + return fix_inconsistent_naming(title, { + }, True) + + + class YavkaNetSubtitle(Subtitle): """YavkaNet Subtitle.""" provider_name = 'yavkanet' @@ -112,10 +128,10 @@ class YavkaNetProvider(Provider): } if isEpisode: - params['s'] = "%s s%02de%02d" % (sanitize(video.series, {'\''}), video.season, video.episode) + params['s'] = "%s s%02de%02d" % (sanitize(fix_tv_naming(video.series), {'\''}), video.season, video.episode) else: params['y'] = video.year - params['s'] = sanitize(video.title, {'\''}) + params['s'] = sanitize(fix_movie_naming(video.title), {'\''}) if language == 'en' or language == 'eng': params['l'] = 'EN'