예제 #1
0
def lastfm_update_artists(args):
    artists_tags = lastfm.artists_tags
    missing_artists = sorted(mpd.list_artists())
    if artists_tags:
        missing_artists = [artist for artist in missing_artists
                           if artist not in artists_tags]
    info('Will fetch datas for %s missing artist(s)' % len(missing_artists))
    for artist in missing_artists:
        print('Fetching %s' % artist)
        tags = lastfm.get_artist_tags(artist, update=True)
        if tags is not None:
            artists_tags[artist] = tags
    write_cache('artists_tags', artists_tags)
예제 #2
0
파일: mpdc_database.py 프로젝트: nhrx/mpdc
def lastfm_update_artists(args):
    tags = lastfm.artists_tags
    artists = sorted(mpd.list_artists())
    extra_artists = [artist for artist in tags if artist not in artists]
    info('{} extra artist(s)'.format(len(extra_artists)))
    for artist in extra_artists:
        del tags[artist]
    if tags:
        missing_artists = [artist for artist in artists if artist not in tags]
    else:
        missing_artists = artists
    info('{} missing artist(s)'.format(len(missing_artists)))
    for artist in missing_artists:
        print('Fetching {}'.format(artist))
        tags[artist] = lastfm.get_artist_tags(artist, update=True)
    cache.write('artists_tags', tags)