pycompmusic documentation

PyCompmusic is a library of tools that are used in the CompMusic research project. The main two components are feature extractors, and a wrapper to the Dunya API.

Dunya API

exception compmusic.dunya.conn.ConnectionError[source]

Bases: exceptions.Exception

exception compmusic.dunya.conn.HTTPError[source]

Bases: exceptions.Exception

compmusic.dunya.conn.set_hostname(hostname)[source]

Change the hostname of the dunya API endpoint.

Arguments:
hostname: The new dunya hostname to set
compmusic.dunya.conn.set_token(token)[source]

Set an access token. You must call this before you can make any other calls.

Arguments:
token: your access token
compmusic.dunya.docserver.add_sourcetype(document, filetype, file)[source]

If file is a string and refers to a file on disk, the contents of the file is read and send, otherwise it is sent as-is

compmusic.dunya.docserver.create_and_upload_document(collection, document, title, filetype, file)[source]
compmusic.dunya.docserver.create_document(collection, document, title=None)[source]
compmusic.dunya.docserver.document(recordingid)[source]

Get the available source filetypes for a Musicbrainz recording.

Parameters:recordingid – Musicbrainz recording ID
Returns:a list of filetypes in the database for this recording
compmusic.dunya.docserver.file_for_document(recordingid, thetype, subtype=None, part=None, version=None)[source]

Get the most recent derived file given a filetype.

Parameters:
  • recordingid – Musicbrainz recording ID
  • thetype – the computed filetype
  • subtype – a subtype if the module has one
  • part – the file part if the module has one
  • version – a specific version, otherwise the most recent one will be used
Returns:

The contents of the most recent version of the derived file

compmusic.dunya.docserver.get_collection(slug)[source]

Get the documents (recordings) in a collection.

Parameters:slug – the name of the collection
compmusic.dunya.docserver.get_collections()[source]

Get a list of all collections in the server.

compmusic.dunya.docserver.get_document_as_json(recordingid, thetype, subtype=None, part=None, version=None)[source]

Get a derived filetype and load it as json.

Parameters:
  • recordingid – Musicbrainz recording ID
  • thetype – the computed filetype
  • subtype – a subtype if the module has one
  • part – the file part if the module has one
  • version – a specific version, otherwise the most recent one will be used
compmusic.dunya.docserver.get_mp3(recordingid)[source]
compmusic.dunya.docserver.update_document(collection, document, title=None)[source]
compmusic.dunya.docserver.update_sourcetype(document, filetype, file)[source]

Indices and tables