mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Add helper function for short season number
This commit is contained in:
parent
390391c750
commit
84448600d2
2 changed files with 7 additions and 4 deletions
|
@ -1660,3 +1660,9 @@ def delete_file(file_path):
|
||||||
except OSError:
|
except OSError:
|
||||||
logger.error("Tautulli Helpers :: Failed to delete file: %s", file_path)
|
logger.error("Tautulli Helpers :: Failed to delete file: %s", file_path)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def short_season(title):
|
||||||
|
if title.startswith('Season ') and title[7:].isdigit():
|
||||||
|
return 'S%s' % title[7:]
|
||||||
|
return title
|
||||||
|
|
|
@ -767,10 +767,7 @@ class PrettyMetadata(object):
|
||||||
elif self.media_type == 'season':
|
elif self.media_type == 'season':
|
||||||
title = '%s - %s' % (self.parameters['show_name'], self.parameters['season_name'])
|
title = '%s - %s' % (self.parameters['show_name'], self.parameters['season_name'])
|
||||||
elif self.media_type == 'episode':
|
elif self.media_type == 'episode':
|
||||||
if self.parameters['season_name'].startswith('Season '):
|
season = helpers.short_season(self.parameters['season_name'])
|
||||||
season = 'S%s' % self.parameters['season_num']
|
|
||||||
else:
|
|
||||||
season = self.parameters['season_name']
|
|
||||||
title = '%s - %s (%s %s E%s)' % (self.parameters['show_name'],
|
title = '%s - %s (%s %s E%s)' % (self.parameters['show_name'],
|
||||||
self.parameters['episode_name'],
|
self.parameters['episode_name'],
|
||||||
season,
|
season,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue