From 84448600d21fb077f47bb4bd444ddc2b63e4c60e Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Thu, 4 Mar 2021 17:59:47 -0800 Subject: [PATCH] Add helper function for short season number --- plexpy/helpers.py | 6 ++++++ plexpy/notifiers.py | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plexpy/helpers.py b/plexpy/helpers.py index 26c7378d..515c171c 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -1660,3 +1660,9 @@ def delete_file(file_path): except OSError: logger.error("Tautulli Helpers :: Failed to delete file: %s", file_path) return False + + +def short_season(title): + if title.startswith('Season ') and title[7:].isdigit(): + return 'S%s' % title[7:] + return title diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index fb30bc5f..7eb54055 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -767,10 +767,7 @@ class PrettyMetadata(object): elif self.media_type == 'season': title = '%s - %s' % (self.parameters['show_name'], self.parameters['season_name']) elif self.media_type == 'episode': - if self.parameters['season_name'].startswith('Season '): - season = 'S%s' % self.parameters['season_num'] - else: - season = self.parameters['season_name'] + season = helpers.short_season(self.parameters['season_name']) title = '%s - %s (%s %s E%s)' % (self.parameters['show_name'], self.parameters['episode_name'], season,