Esempio n. 1
0
def format_simple_album(result):
    album = {
        'artists': format_all(result['artists'], format_simple_artist),
        'name': result['name'],
        'id': result['id'],
        'type': result['type']}

    return album
Esempio n. 2
0
def format_simple_track(result):
    if result['is_local']:
        return None
    
    track = {
        'album': format_simple_album(result['album']),
        'artists': format_all(result['artists'], format_simple_artist),
        'name': result['name'],
        'id': result['id'],
        'type': result['type']}

    return track
Esempio n. 3
0
def format_playlist(result):
    playlist = {
        'collaborative': result['collaborative'],
        'description': result['description'],
        'followers': result['followers']['total'],
        'name': result['name'],
        'owner': format_simple_user(result['owner']),
        'public': result['public'],
        'snapshot_id': result['snapshot_id'],
        'tracks': format_all(result['tracks'], format_playlist_track),
        'uri': result['uri'],
        'id': result['id'],
        'type': result['type']
    }

    return playlist
Esempio n. 4
0
def format_album(result):
    album = {
        'album_type': result['album_type'],
        'artists': format_all(result['artists'], format_simple_artist),
        'copyrights': result['copyrights'],
        'genres': result['genres'],
        'name': result['name'],
        'popularity': result['popularity'],
        'release_date': to_datetime(result['release_date'],
                                    result['release_date_precision']),
        'release_date_precision': result['release_date_precision'],
        'total_tracks': result['total_tracks'],
        'uri': result['uri'],
        'id': result['id'],
        'type': result['type']}

    return album
Esempio n. 5
0
def format_track(result):
    if result['is_local']:
        print(f'SKIPPING TRACK BECAUSE IT IS LOCAL {result["name"]}')
        return None

    track = {
        'album': format_simple_album(result['album']),
        'artists': format_all(result['artists'], format_simple_artist),
        'disc_number': result['disc_number'],
        'duration_ms': result['duration_ms'],
        'explicit': result['explicit'],
        'name': result['name'],
        'popularity': result['popularity'],
        'track_number': result['track_number'],
        'uri': result['uri'],
        'id': result['id'],
        'type': result['type']}
    
    return track