Skip to content

Commit

Permalink
feat: similar artists (#90)
Browse files Browse the repository at this point in the history
* feat: ✨ add similar items when available.
  • Loading branch information
djdembeck authored Jun 22, 2023
1 parent 633347d commit 370ee95
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Contents/Code/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "1.2.2"
version = "1.3.0"
20 changes: 20 additions & 0 deletions Contents/Code/update_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def collect_metadata_to_log(self):
{'Author name': self.metadata.title},
{'Author poster URL': self.thumb},
{'Author sort name': self.metadata.title_sort},
{'Similar Authors': ', '.join([author['name']
for author in self.similar] if self.similar else [])},
]
)

Expand Down Expand Up @@ -207,6 +209,8 @@ def parse_api_response(self, response):
self.synopsis = response['summary']
if 'image' in response:
self.thumb = response['image']
if 'similar' in response:
self.similar = response['similar']
if 'subtitle' in response:
self.subtitle = response['subtitle']
if 'title' in response:
Expand All @@ -229,6 +233,7 @@ def set_empty_variables(self):
self.rating = None
self.series = ''
self.series2 = ''
self.similar = None
self.subtitle = ''
self.thumb = ''
self.volume = ''
Expand Down Expand Up @@ -296,6 +301,8 @@ def set_metadata_tags(self):
tagger.add_authors_to_moods()
# Series.
tagger.add_series_to_moods()
# Similar.
tagger.add_similar()

def set_metadata_title(self):
"""
Expand Down Expand Up @@ -426,6 +433,8 @@ def parse_api_response(self, response):
squared_image = self.get_square_image(response['image'])
log.debug('Square image: ' + squared_image)
self.thumb = squared_image
if 'similar' in response:
self.similar = response['similar']

def set_metadata_description(self):
"""
Expand All @@ -441,6 +450,7 @@ def set_empty_variables(self):
"""
self.date = None
self.genres = None
self.similar = None
self.thumb = ''

def set_metadata_sort_title(self):
Expand Down Expand Up @@ -475,6 +485,8 @@ def set_metadata_tags(self):
tagger = TagTool(self, self.prefs)
# Genres.
tagger.add_genres()
# Similar.
tagger.add_similar()

def set_metadata_title(self):
"""
Expand Down Expand Up @@ -529,6 +541,14 @@ def add_series_to_moods(self):
if self.helper.series2:
self.helper.metadata.moods.add("Series: " + self.helper.series2)

def add_similar(self):
"""
Adds similar items.
"""
if self.helper.similar:
for item in self.helper.similar:
self.helper.metadata.similar.add(item['name'])

def clear_moods(self):
"""
Clears moods.
Expand Down

0 comments on commit 370ee95

Please sign in to comment.