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 4dcac4a
Showing 1 changed file with 3 additions and 2 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

0 comments on commit 4dcac4a

Please sign in to comment.