Package musicbrainz2 :: Module disc
[frames] | no frames]

Module disc

source code

Utilities for working with Audio CDs.

This module contains utilities for working with Audio CDs.

The functions in this module need both a working ctypes package (already included in python-2.5) and an installed libdiscid. If you don't have libdiscid, it can't be loaded, or your platform isn't supported by either ctypes or this module, a NotImplementedError is raised when using the readDisc() function.


Author: Matthias Friedrich <matt@mafr.de>

Classes
  DiscError
The Audio CD could not be read.
Functions
 
getSubmissionUrl(disc, host='mm.musicbrainz.org', port=80)
Returns a URL for adding a disc to the MusicBrainz database.
source code
 
readDisc(deviceName=None)
Reads an Audio CD in the disc drive.
source code
Function Details

getSubmissionUrl(disc, host='mm.musicbrainz.org', port=80)

source code 

Returns a URL for adding a disc to the MusicBrainz database.

A fully initialized musicbrainz2.model.Disc object is needed, as returned by readDisc. A disc object returned by the web service doesn't provide the necessary information.

Note that the created URL is intended for interactive use and points to the MusicBrainz disc submission wizard by default. This method just returns a URL, no network connection is needed. The disc drive isn't used.

Parameters:
  • disc - a fully initialized musicbrainz2.model.Disc object
  • host - a string containing a host name
  • port - an integer containing a port number
Returns:
a string containing the submission URL

See Also: readDisc

readDisc(deviceName=None)

source code 

Reads an Audio CD in the disc drive.

This reads a CD's table of contents (TOC) and calculates the MusicBrainz DiscID, which is a 28 character ASCII string. This DiscID can be used to retrieve a list of matching releases from the web service (see musicbrainz2.webservice.Query).

Note that an Audio CD has to be in drive for this to work. The deviceName argument may be used to set the device. The default depends on the operating system (on linux, it's '/dev/cdrom'). No network connection is needed for this function.

If the device doesn't exist or there's no valid Audio CD in the drive, a DiscError exception is raised.

Parameters:
  • deviceName - a string containing the CD drive's device name
Returns:
a musicbrainz2.model.Disc object
Raises:
  • DiscError - if there was a problem reading the disc
  • NotImplementedError - if DiscID generation isn't supported