Skip to content

Commit

Permalink
fix: 🐛 content_type check was not plural, all data was trying to be…
Browse files Browse the repository at this point in the history
… collected into variable if unused
  • Loading branch information
djdembeck committed Jan 23, 2023
1 parent f2fb6d4 commit f4e60fc
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions Contents/Code/update_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,28 @@ def collect_metadata_to_log(self):
# Start an array with common metadata
data_to_log = [{'ASIN': self.metadata.id}]

# Book metadata
book_data_to_log = [
{'Book poster URL': self.thumb},
{'Book publisher': self.metadata.studio},
{'Book release date': str(self.metadata.originally_available_at)},
{'Book sort title': self.metadata.title_sort},
{'Book summary': self.metadata.summary},
{'Book title': self.metadata.title},
]

# Author metadata
author_data_to_log = [
{'Author bio': self.metadata.summary},
{'Author name': self.metadata.title},
{'Author poster URL': self.thumb},
{'Author sort name': self.metadata.title_sort},
]

# Determine which metadata to log
if self.content_type == 'book':
data_to_log.extend(book_data_to_log)
elif self.content_type == 'author':
data_to_log.extend(author_data_to_log)
if self.content_type == 'books':
data_to_log.extend(
[
{'Book poster URL': self.thumb},
{'Book publisher': self.metadata.studio},
{'Book release date': str(
self.metadata.originally_available_at)},
{'Book sort title': self.metadata.title_sort},
{'Book summary': self.metadata.summary},
{'Book title': self.metadata.title},
]
)
elif self.content_type == 'authors':
data_to_log.extend(
[
{'Author bio': self.metadata.summary},
{'Author name': self.metadata.title},
{'Author poster URL': self.thumb},
{'Author sort name': self.metadata.title_sort},
]
)

return data_to_log

Expand Down

0 comments on commit f4e60fc

Please sign in to comment.