Skip to content
This repository
Browse code

Nicer error message

  • Loading branch information...
commit 03164fdfe1acccac5e5b202c31046d232aed2f69 1 parent 64a9f5e
Tristan Jehan authored June 24, 2011

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. 7  examples/lookup.py
7  examples/lookup.py
@@ -23,8 +23,11 @@ def lookup(file):
23 23
         # The version parameter to song/identify indicates the use of echoprint
24 24
         result = song.identify(query_obj=fp, version="4.11")
25 25
         print "Got result:", result
26  
-        print "Artist: %s (%s)" % (result[0].artist_name, result[0].artist_id)
27  
-        print "Song: %s (%s)" % (result[0].title, result[0].id)
  26
+        if len(result):
  27
+            print "Artist: %s (%s)" % (result[0].artist_name, result[0].artist_id)
  28
+            print "Song: %s (%s)" % (result[0].title, result[0].id)
  29
+        else:
  30
+            print "No match. This track may not be in the database yet."
28 31
     else:
29 32
         print "Couldn't decode", file
30 33
             

0 notes on commit 03164fd

Please sign in to comment.
Something went wrong with that request. Please try again.