Note
Not all of this has been implemented yet. See Current status for more informations. Pretty much everything that hasn’t the todo status is done
This is a sort of project of what the library should look like when finished.
A decent name :)
Low, if not none, dependencies
There is a simple but powerful api
get(artist='foo', album='asd', title='xyz', otherinfo='this', timeout=10) Just do it.
get(... as above ...) The first site to give an ‘OK’ will return
get(... plugins=('this', 'that'))
the user is able to “filter” from the set of plugins: this way badly-behaving plugins can be avoided without uninstalling them
Todo
get_best(... as above ...)
Try to catch as much information as possible
Todo
get_all(... as above ...)
Return all results (useful for user selection) *
Todo
get(filename='/path/to/file.mp3, id3=True)
will automatically discover album, artist, title information using file metadata. This will work, however, only if eyed3 is installed
It’s not limited to lyrics, but supports artist info, cover, tabs, whatsoever
Extensibility is provided through eggs
Retrievers run concurrently, results analysis is performed real*time
This way we can take “the fastest”, or wait for the best
See also
Section on Retrievers
Todo
A command*line utility provides the same functionalities
Todo
A C library that wraps the python one
A retriever is an object that can fetch lyrics, coverart or other stuff. It is a class with a lot of metadata about his capabilities (optional), and one mandatory static method, get_data
No subclassing is required, only conventional class attributes are needed.
Let’s see an example:
class FooRetriever(object):
name = 'Foo will do'
features = ('lyrics', 'coverart')
@staticmethod
def get_data(song_metadata, options)
The more interesting part is get_data: here all the fetching part is done. Both his tho arguments, song_metadata and options are dict. song_metadata has four main fields: artist, title, album, filename. Some of them could be None. options has currently only one field, but it may grow:
To know how to create a retriever plugin, read Plugin HOWTO
The setup.py you’ll find into the plugin skeleton is slightly modified to make it more “automatic”: the entrypoint name is equal to Retriever.name, and attempts are done to autoconfigure it. If you have a complex file structure, or defines other classes than the Retriver one, it will probably fail. It should be easy, anyway, to configure it!