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

Reduce the amount of expected titles created. #10493

Merged
merged 3 commits into from
Apr 12, 2022
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
6 changes: 4 additions & 2 deletions medusa/name_parser/guessit_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
'gb',
]

series_re = re.compile(r'^(?P<series>.*?)(?: \(?(?:(?P<year>\d{4})|(?P<country>[A-Z]{2}))\)?)?$')
series_re = re.compile(r'^(?P<series>.*?)(?: ?(?:(?P<year>\(\d{4}\))|(?P<country>[A-Z]{2}))?)?$')


def guessit(name, options=None):
Expand Down Expand Up @@ -113,9 +113,11 @@ def get_expected_titles(show_list):
if not match:
continue

if not any(char.isdigit() or char == '-' for char in exception):
if not any(char.isdigit() or char == '-' for char in match.group(1)):
continue

# At this point only add titles (without the year ex: 9-1-1 (2018),
# only use `9-1-1`. And only when it has a number or '-' in its title.
expected_titles.append(exception)

return expected_titles
Expand Down
7 changes: 4 additions & 3 deletions medusa/post_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,10 @@ def _finalize(self, parse_result):
self.is_proper = bool(parse_result.proper_tags)

# if the result is complete set release name
if parse_result.series_name and ((parse_result.season_number is not None and parse_result.episode_numbers) or
parse_result.air_date) and parse_result.release_group:

if parse_result.series_name and (
(parse_result.season_number is not None and parse_result.episode_numbers)
or parse_result.air_date
) and parse_result.release_group:
if not self.release_name:
self.release_name = remove_extension(os.path.basename(parse_result.original_name))

Expand Down