Skip to content
Open
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
22 changes: 19 additions & 3 deletions Contents/Code/update_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,17 @@ def parse_api_response(self, response):
if 'rating' in response:
self.rating = response['rating']
if 'seriesPrimary' in response:
self.series = response['seriesPrimary']['name']
self.series = self.simplify_series_title(
response['seriesPrimary']['name']
)
if 'position' in response['seriesPrimary']:
self.volume = self.volume_prefix(
response['seriesPrimary']['position']
)
if 'seriesSecondary' in response:
self.series2 = response['seriesSecondary']['name']
self.series2 = self.simplify_series_title(
response['seriesSecondary']['name']
)
if 'position' in response['seriesSecondary']:
self.volume2 = self.volume_prefix(
response['seriesSecondary']['position']
Expand Down Expand Up @@ -346,6 +350,18 @@ def simplify_title(self):
album_title = album_title.strip()

return album_title

def simplify_series_title(self, series_title):
"""
Simplifies the series titles (series 1 and 2) by removing
the word "Series" from the end if it exists.
"""
if self.prefs['simplify_series_title']:
if series_title:
simplified_series_title = re.sub(r" Series$", '', series_title, flags=re.IGNORECASE)
return simplified_series_title
return series_title


def volume_prefix(self, string):
"""
Expand Down Expand Up @@ -534,7 +550,7 @@ def add_narrators_to_styles(self):

def add_authors_to_moods(self):
"""
Adds authors to moods, except for cases in contibutors list.
Adds authors to moods, except for cases in contributors list.
"""
contributor_regex = '.+?(?= -)'
if not self.helper.metadata.moods or self.helper.force:
Expand Down
6 changes: 6 additions & 0 deletions Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
"type": "bool",
"default": "false"
},
{
"id": "simplify_series_title",
"label": "Simplify series titles (remove ' Series' from the end if it exists)",
"type": "bool",
"default": "false"
},
{
"id": "logging_level",
"label": "Level of plugin logging: ",
Expand Down