Skip to content

Commit

Permalink
Merge pull request #19 from zeroquinc:fix-show-title
Browse files Browse the repository at this point in the history
fix: fix for NoneType in show title
  • Loading branch information
zeroquinc authored Jun 22, 2024
2 parents f80046e + e119c9c commit 9be5658
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/trakt/models/rating.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self, data):

class Show:
def __init__(self, data):
self.title = data['show']['title']
self.show_title = data['show']['title']
self.year = data['show']['year']
self.slug = data['show']['ids']['slug']
self.trakt_id = data['show']['ids']['trakt']
Expand Down
8 changes: 1 addition & 7 deletions src/trakt/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ async def process_ratings(ratings_channel, username):
ratings = sorted(user.get_ratings(start_time=then, end_time=now), key=lambda rating: rating.date)

async def process_rating(rating):
description_formats = {
'show': f"{username} rated this {rating.type} {rating.rated} :star:",
'season': f"{username} rated this {rating.type} {rating.rated} :star:",
'episode': f"{username} rated this {rating.type} {rating.rated} :star:",
'movie': f"{username} rated this {rating.type} {rating.rated} :star:"
}
author_formats = {
'show': "A show has been rated on Trakt",
'season': "A season has been rated on Trakt",
Expand All @@ -30,7 +24,7 @@ async def process_rating(rating):
'episode': f"{rating.show_title} - S{rating.season_id}E{rating.episode_id}",
'movie': f"{rating.title} ({rating.year})"
}
description = description_formats[rating.type]
description = f"{username} rated this {rating.type} {rating.rated} :star:"
author = author_formats[rating.type]
title = title_formats[rating.type]
embed_builder = EmbedBuilder(title=title, description=description, color=0xFF0000)
Expand Down

0 comments on commit 9be5658

Please sign in to comment.