Skip to content

Commit

Permalink
Fixing error in getting song original url in queue handler
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelSolVargas committed Sep 17, 2022
1 parent d10264b commit ef66bf8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Handlers/QueueHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,20 @@ async def run(self, pageNumber=0) -> HandlerResponse:
startIndex = (pageNumber * self.config.MAX_SONGS_IN_PAGE) + 1
for pos, song in enumerate(songs, start=startIndex):
song_name = song.title[:50] if song.title else self.messages.SONG_DOWNLOADING
text += f"**`{pos}` - ** [{song_name}]({song.identifier}) - `{Utils.format_time(song.duration)}`\n"

songURL = ''
hasURL = False
if 'original_url' in song.info.keys():
hasURL = True
songURL = song.info['original_url']
elif 'webpage_url' in song.info.keys():
hasURL = True
songURL = song.info['webpage_url']

if hasURL:
text += f"**`{pos}` - ** [{song_name}]({songURL}) - `{Utils.format_time(song.duration)}`\n"
else:
text += f"**`{pos}` - ** {song_name} - `{Utils.format_time(song.duration)}`\n"

embed = self.embeds.QUEUE(title, text)
# Release the acquired Lock
Expand Down

0 comments on commit ef66bf8

Please sign in to comment.