Skip to content

Commit

Permalink
Add helper function for short season number
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyWong16 committed Mar 5, 2021
1 parent 390391c commit 8444860
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 6 additions & 0 deletions plexpy/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 1 addition & 4 deletions plexpy/notifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,7 @@ def get_title(self, divider='-'):
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,
Expand Down

0 comments on commit 8444860

Please sign in to comment.