def artist_dee_data(link):
    ids = get_ids(link)
    data = deezer_api.get_artist(ids)
    name = data['name']
    image_url = data['picture_xl']
    nb_album = data['nb_album']
    nb_fan = data['nb_fan']

    return (name, image_url, nb_album, nb_fan)
def playlist_spo_data(link):
    ids = get_ids(link)
    data = Spo.get_playlist(ids)
    n_fans = data['followers']['total']
    image_url = data['images'][0]['url']
    creation_date = data['tracks']['items'][0]['added_at']
    creator = data['owner']['display_name']
    tracks = data['tracks']['items']
    nb_tracks = len(tracks)

    return (nb_tracks, n_fans, image_url, creation_date, creator, tracks)
def playlist_dee_data(link):
    ids = get_ids(link)
    data = deezer_api.get_playlist(ids)
    nb_tracks = data['nb_tracks']
    n_fans = data['fans']
    image_url = data['picture_xl']
    creation_date = data['creation_date']
    creator = data['creator']['name']
    tracks = data['tracks']['data']

    return (nb_tracks, n_fans, image_url, creation_date, creator, tracks)
def track_dee_data(link):
    ids = get_ids(link)
    data = deezer_api.get_track(ids)
    md5_image = data['md5_image']
    image_url = deezer_api.get_img_url(md5_image, size="1000x1000")
    name = data['title']
    artist = data['artist']['name']
    album = data['album']['title']
    date = data['album']['release_date']
    link_dee = data['link']
    duration = data['duration']

    return (image_url, name, artist, album, date, link_dee, duration)
def track_spo_data(link, conv: bool):
    if conv:
        return track_spo_to_dee_data(link)

    ids = get_ids(link)
    data = Spo.get_track(ids)
    image_url = data['album']['images'][0]['url']
    name = data['name']
    artist = data['artists'][0]['name']
    album = data['album']['name']
    date = data['album']['release_date']
    duration = data['duration_ms'] // 1000

    return (image_url, name, artist, album, date, link, duration)
def album_dee_data(link):
    ids = get_ids(link)
    data = deezer_api.get_album(ids)
    md5_image = data['md5_image']
    image_url = deezer_api.get_img_url(md5_image, size="1000x1000")
    album = data['title']
    artist = data['artist']['name']
    date = data['release_date']
    nb_tracks = data['nb_tracks']
    tracks = data['tracks']['data']
    duration = data['duration']
    link_dee = data['link']

    return (image_url, album, artist, date, nb_tracks, tracks, duration,
            link_dee)
Exemple #7
0
def create_keyboard_artist(link):
	ids = get_ids(link)
	query = f"artist:{ids}"

	keyboad_artist = [
		[
			InlineKeyboardButton(
				command['text'],
				switch_inline_query_current_chat = command['query'] % query
			)
			for command in __artist_commands_queries[
				line:line + 2
			]
		]
		for line in range(0, __l_artist_commands_queries, 2)
	]

	artist_keyboard = InlineKeyboardMarkup(keyboad_artist)
	return artist_keyboard
def album_spo_data(link, conv: bool):
    if conv:
        return album_spo_data_to_dee(link)

    ids = get_ids(link)
    data = Spo.get_album(ids)
    image_url = data['images'][0]['url']
    album = data['name']
    artist = data['artists'][0]['name']
    date = data['release_date']
    nb_tracks = data['total_tracks']
    tracks = data['tracks']['items']
    duration = 0

    for track in tracks:
        duration += track['duration_ms']

    duration //= 1000

    return (image_url, album, artist, date, nb_tracks, tracks, duration, link)