async def extract_first_infos_other(self, url, ctx): if url == "charts": __songs = [] __song = Song() __song.user = ctx.message.author song_list = await self.extract_first_infos_spotify( "https://open.spotify.com/playlist/37i9dQZEVXbMDoHDwVN2tF?si=vgYiEOfYTL-ejBdn0A_E2g", ctx, ) for track in song_list: track.user = ctx.message.author __songs.append(track) return __songs __song = Song() __song.title = url __song.user = ctx.message.author return [__song]
async def extract_first_infos_youtube(self, url, ctx): youtube_type = Url.determine_youtube_type(url=url) if youtube_type == Url.youtube_url: __song = Song() __song.user = ctx.message.author __song.link = url return [__song] if youtube_type == Url.youtube_playlist: __songs = [] __song_list = await self.parent.youtube.youtube_playlist(url) if len(__song_list) == 0: await self.parent.send_error_message(ctx, Errors.spotify_pull) return [] for track in __song_list: track.user = ctx.message.author __songs.append(track) return __songs
async def extract_first_infos_spotify(self, url, ctx): spotify_type = Url.determine_spotify_type(url=url) __songs = [] __song = Song() __song.user = ctx.message.author if spotify_type == Url.spotify_playlist: __song_list = await self.parent.spotify.spotify_playlist(url) if len(__song_list) == 0: await self.parent.send_error_message( ctx=ctx, message=Errors.spotify_pull) return [] for track in __song_list: track: SpotifySong __song = Song(song=__song) __song.title = track.title __song.image_url = track.image_url __song.artist = track.artist __song.song_name = track.song_name __songs.append(__song) return __songs if spotify_type == Url.spotify_track: track = await self.parent.spotify.spotify_track(url) if track is not None: __song.title = track.title __song.image_url = track.image_url __song.artist = track.artist __song.song_name = track.song_name return [__song] return [] if spotify_type == Url.spotify_artist: song_list = await self.parent.spotify.spotify_artist(url) for track in song_list: __song = Song(song=__song) __song.title = track __songs.append(__song) return __songs if spotify_type == Url.spotify_album: song_list = await self.parent.spotify.spotify_album(url) for track in song_list: __song = Song(song=__song) __song.title = track __songs.append(__song) return __songs
async def _extract_first_infos_spotify( self, url: str, ctx: commands.Context) -> List[Song]: spotify_type = Url.determine_spotify_type(url=url) __songs = [] __song = Song() __song.user = ctx.message.author if spotify_type == Url.spotify_playlist: song_list = await self.parent.spotify.spotify_playlist(url) return song_list if spotify_type == Url.spotify_track: track = await self.parent.spotify.spotify_track(url) if track: return [track] return [] if spotify_type == Url.spotify_artist: song_list = await self.parent.spotify.spotify_artist(url) return song_list if spotify_type == Url.spotify_album: song_list = await self.parent.spotify.spotify_album(url) return song_list