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
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
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
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
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
def testRdioLookup(): """ Testing Rdio Lookup""" upc = "884502232769" lookup = Lookup(upc=upc) response = lookup.rdio() print response assert response[0]['length'] == 11
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 })
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)
def testSpotifyLookup(): """ Testing Spotify Lookup""" upc = "840218148053" lookup = Lookup(upc=upc) response = lookup.spotify() assert response['albums']['total'] == 1
def testItunesLookup(): """ Testing iTunes Lookup""" upc = "840218148053" lookup = Lookup(upc=upc) response = lookup.itunes() assert response['resultCount'] == 1