Example #1
0
def spotify_lookup(release):
    upc = release.upc
    lookup = Lookup(upc)
    result = lookup.spotify(upc)
    if result['albums'].get('total', None) == 1:
       release.is_up_spotify = True
    return release
Example #2
0
def testGoogleLookup():
    """ Testing Google Lookup"""
    title = "You Forgot It In People"
    artist = "Broken Social Scene"
    lookup = Lookup(title=title, artist=artist)
    response = lookup.google()
    assert response
Example #3
0
def itunes_lookup(release):
    upc = release.upc
    lookup = Lookup(upc)
    result = lookup.itunes(upc)
    if result['resultCount'] == 1:
       release.is_up_itunes = True
    return release
Example #4
0
def testDeezerLookup():
    """ Testing Deezer Lookup"""
    title = "You Forgot It In People"
    artist = "Broken Social Scene"
    lookup = Lookup(title=title, artist=artist)
    response = lookup.deezer()
    assert response
Example #5
0
def testAmazonLookup():
    """ Testing Amazon Lookup"""
    title = "You Forgot It In People"
    artist = "Broken Social Scene"
    lookup = Lookup(title=title, artist=artist)
    response = lookup.amazon()
    assert response
Example #6
0
def testRdioLookup():
    """ Testing Rdio Lookup"""
    upc = "884502232769"
    lookup = Lookup(upc=upc)
    response = lookup.rdio()
    print response
    assert response[0]['length'] == 11
Example #7
0
def check_status():
    """
    This will check status for upc
    although the person should be notified by email

    Possible feature: count of times upc has been checked
    """

    request_data = json.loads(request.data)
    distributor = request_data.pop('distributor', False)
    assert distributor, "No distributor provided"
    results = Lookup.lookup_by_distributor(distributor, **request_data)
    return json.dumps({
        'status': 'OK',
        'results': results
        })
Example #8
0
def check_is_live(distributor):
    """
    Directly checks status
    """
    upc = request.args.get('upc')
    artist = request.args.get('artist')
    album_title = request.args.get('album_title')

    distributor = distributor.lower()

    if distributor in ['amazon', 'deezer', 'google']:
        if not artist or not album_title:
            return json.dumps({
                'status': 'error',
                'message': 'Amazon lookup requires both artist and album title'
                })

    results = Lookup.lookup_by_distributor(distributor, upc=upc, artist=artist,
        title=album_title)

    return json.dumps(results)
Example #9
0
def testSpotifyLookup():
    """ Testing Spotify Lookup"""
    upc = "840218148053"
    lookup = Lookup(upc=upc)
    response = lookup.spotify()
    assert response['albums']['total'] == 1
Example #10
0
def testItunesLookup():
    """ Testing iTunes Lookup"""
    upc = "840218148053"
    lookup = Lookup(upc=upc)
    response = lookup.itunes()
    assert response['resultCount'] == 1