1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Ensure that the duration has been provided when using length

This commit is contained in:
Phxntxm 2017-05-13 14:23:32 -05:00
parent 2e1fd109f1
commit 2a5e6b96b1

View file

@ -288,8 +288,9 @@ class URLPlaylistEntry(BasePlaylistEntry):
if self.thumbnail:
embed.set_thumbnail(url=self.thumbnail)
# Get the current length of the song and display this
length = divmod(round(self.length, 0), 60)
fmt = "{0[0]}m {0[1]}s".format(length)
embed.add_field(name='Duration', value=fmt, inline=False)
if self.length:
length = divmod(round(self.length, 0), 60)
fmt = "{0[0]}m {0[1]}s".format(length)
embed.add_field(name='Duration', value=fmt, inline=False)
# And return the embed we created
return embed