Fixed !playlist add for soundcloud

This commit is contained in:
Twentysix 2016-05-14 04:03:42 +02:00
parent 742876ac96
commit e8d0c25eee

View File

@ -575,12 +575,14 @@ class Audio:
await asyncio.sleep(0.5) await asyncio.sleep(0.5)
for entry in d.song.entries: for entry in d.song.entries:
if entry.url[4] != "s": if entry["url"][4] != "s":
song_url = "https{}".format(entry.url[4:]) song_url = "https{}".format(entry["url"][4:])
playlist.append(song_url) playlist.append(song_url)
else: else:
playlist.append(entry.url) playlist.append(entry.url)
return playlist
async def _parse_yt_playlist(self, url): async def _parse_yt_playlist(self, url):
d = Downloader(url) d = Downloader(url)
d.start() d.start()
@ -1122,7 +1124,7 @@ class Audio:
if self._valid_playable_url(url): if self._valid_playable_url(url):
try: try:
await self.bot.say("Enumerating song list...this could take" await self.bot.say("Enumerating song list... This could take"
" a few moments.") " a few moments.")
songlist = await self._parse_playlist(url) songlist = await self._parse_playlist(url)
except InvalidPlaylist: except InvalidPlaylist:
@ -1136,7 +1138,8 @@ class Audio:
playlist.server = server playlist.server = server
self._save_playlist(server, name, playlist) self._save_playlist(server, name, playlist)
await self.bot.say("Playlist '{}' saved.".format(name)) await self.bot.say("Playlist '{}' saved. Tracks: {}".format(name,
len(songlist)))
else: else:
await self.bot.say("That URL is not a valid Soundcloud or YouTube" await self.bot.say("That URL is not a valid Soundcloud or YouTube"
" playlist link. If you think this is in error" " playlist link. If you think this is in error"