Esempio n. 1
0
def get_info(mbid, songname, artist):
    """ Fetch track information from multiple sources. """
    try:
        # Last.fm
        lfm = lastfm.get(LFM_KEY, method='track.getInfo', mbid=mbid).json()
        # Echonest
        enest = echonest.get(ENEST_KEY).json()
    except ValueError:
        # TODO: What if a song is on last.fm but not on AB?
        return None

    return (lfm,enest)
Esempio n. 2
0
def get_info(mbid):
    """ Fetch track information from multiple sources. """
    try:
        # AcousticBrainz
        ab_high = acousticbrainz.get(mbid=mbid, level='high').json()
        ab_low = acousticbrainz.get(mbid=mbid, level='low').json()

        # Last.fm
        lfm = lastfm.get(LFM_KEY, method='track.getInfo', mbid=mbid).json()
    except ValueError:
        # TODO: What if a song is on last.fm but not on AB?
        return None

    return (lfm, ab_high, ab_low)
Esempio n. 3
0
def get_info(mbid):
    """ Fetch track information from multiple sources. """
    try:
        # AcousticBrainz
        ab_high = acousticbrainz.get(mbid=mbid, level='high').json()
        ab_low = acousticbrainz.get(mbid=mbid, level='low').json()

        # Last.fm
        lfm = lastfm.get(LFM_KEY, method='track.getInfo', mbid=mbid).json()
    except ValueError:
        # TODO: What if a song is on last.fm but not on AB?
        return None

    return (lfm, ab_high, ab_low)
Esempio n. 4
0
    pushbullet.send(**PB_PARAMS)

# Setup Logging
logging.basicConfig(**LOGGING_PARAMS)

# Folder to dump data to
folder = 'dump'
if not os.path.exists(folder):
    os.makedirs(folder)

# Keep track of files dumped
count_files = 0

# Let's get some data
for page in LFM_PAGES:
    r = lastfm.get(LFM_KEY, method='tag.getTopTracks', tag='electronic',
                   page=page, limit=LFM_PER_PAGE).json()

    if not r['tracks']['track']:
        PB_PARAMS['title'] = 'Null! - ' + PB_PARAMS['title']
        break

    for track in r['tracks']['track']:

        if track['mbid']:
            info = track_info(mbid=track['mbid'])

            # Dump data to disk!
            if info:
                data = {
                    'lfm': info[0],
                    'ab_high': info[1],
Esempio n. 5
0
# Setup Logging
logging.basicConfig(**LOGGING_PARAMS)

# Folder to dump data to
folder = 'dump'
if not os.path.exists(folder):
    os.makedirs(folder)

# Keep track of files dumped
count_files = 0

# Let's get some data
for page in LFM_PAGES:
    r = lastfm.get(LFM_KEY,
                   method='tag.getTopTracks',
                   tag='electronic',
                   page=page,
                   limit=LFM_PER_PAGE).json()

    if not r['tracks']['track']:
        PB_PARAMS['title'] = 'Null! - ' + PB_PARAMS['title']
        break

    for track in r['tracks']['track']:

        if track['mbid']:
            info = track_info(mbid=track['mbid'])

            # Dump data to disk!
            if info:
                data = {