I'm using I'm using the dev version of the python wrapper for the gracenote gnsdk (gnsdk-3.06.0.1241o-20130927/wrappers/gnsdk_python/samples/musicid_stream/main.py) to identify 15 seconds of music, which seems to be working pretty well in terms of recognising the album the song is from.

Is it possible to use the data returned to get the artist, song, and other information, rather than just the album title?

有帮助吗?

解决方案

I hope the snippet below is helpful. It gives a taste of some of the data that is available. You can also check the type() of any object returned from a query, and any objects down the hierarchy, and then find that type in gnsdk.py to see all of the methods that it supports.

Not every field will be populated for each album or track.

Enjoy. Damon

def display_track_info(track):
    print "      title: %s" % track.title().display()
    print "      number: %s" % track.track_number()
    print "      artist: %s" % track.artist().name().display()
    print "      genre lvl 1: %s" % track.genre().level1()
    print "      genre lvl 2: %s" % track.genre().level2()
    print "      genre lvl 3: %s" % track.genre().level3()
    print "      mood lvl 1: %s" % track.mood().level1()
    print "      mood lvl 2: %s" % track.mood().level2()

def display_album_info(album):
    print "    title: %s" % album.title().display()
    print "    artist: %s" % album.artist().name().display()
    tracks = album.tracks_matched()
    print "    Matched %d tracks" % tracks.count()
    iterable = tracks.at(0)
    for index in range(tracks.count()):
        print "    Track %d:" % (index+1)
        track = iterable.next()
        display_track_info(track)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top