Skip to content

Commit

Permalink
Fix fm album when duration is None
Browse files Browse the repository at this point in the history
  • Loading branch information
joinemm committed Dec 11, 2023
1 parent dd4c321 commit 74d286e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cogs/lastfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,8 +931,9 @@ async def album(self, ctx: MisoContext, *, album: Annotated[tuple, AlbumArgument
else:
row = f"`{track['@attr']['rank']:02}` {track['name']}"

if (duration := int(track["duration"])) > 0:
m, s = divmod(duration, 60)
duration = track["duration"]
if duration is not None and int(duration) > 0:
m, s = divmod(int(duration), 60)
h, m = divmod(m, 60)
duration_fmt = (f"{h}:" if h > 1 else "") + f"{m}:{s:02}"
row += f" `{duration_fmt}`"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ services:
bot:
container_name: miso-bot
build: .
command: python -O main.py
command: python -O main.py dev
restart: unless-stopped
expose:
- 8080
Expand Down

0 comments on commit 74d286e

Please sign in to comment.