MythTV  master
Classes | Functions | Variables
discid.disc Namespace Reference

Classes

class  Disc
 
class  DiscError
 
class  TOCError
 

Functions

def read (device=None, features=[])
 
def put (first, last, disc_sectors, track_offsets)
 

Variables

dictionary _FEATURE_MAPPING = {"read": 1 << 0, "mcn": 1 << 1, "isrc": 1 << 2}
 
 FEATURES_IMPLEMENTED = list(_FEATURE_MAPPING.keys())
 

Function Documentation

◆ read()

def discid.disc.read (   device = None,
  features = [] 
)
Reads the TOC from the device given as string
and returns a :class:`Disc` object.

That string can be either of:
:obj:`str <python:str>`, :obj:`unicode` or :obj:`bytes`.
However, it should in no case contain non-ASCII characters.
If no device is given, a default, also given by :func:`get_default_device`
is used.

You can optionally add a subset of the features in
:data:`FEATURES` or the whole list to read more than just the TOC.
In contrast to libdiscid, :func:`read` won't read any
of the additional features by default.

A :exc:`DiscError` exception is raised when the reading fails,
and :exc:`NotImplementedError` when libdiscid doesn't support
reading discs on the current platform.

Definition at line 35 of file disc.py.

Referenced by common.audiofile.AudioFile.AnalyzeFlac(), common.audiofile.AudioFile.AnalyzeMp3(), common.audiofile.AudioFile.AnalyzeOgg(), common.audiofile.AudioFile.AnalyzeWma(), avi_read_index(), MediaMonitorUnix.CheckDeviceNotifications(), MythCDROMLinux.checkMedia(), UnzipPrivate.decryptBytes(), hardwareprofile.os_detect.OSWithFile.do_test(), UnzipPrivate.extractFile(), hardwareprofile.distros.mythtv_data.uuiddb._UuidDb.gen_uuid(), get_avi_from_index(), lyricsmode.LyricsFetcher.get_lyrics(), baidu.LyricsFetcher.get_lyrics(), hardwareprofile.distros.mythtv_data.uuiddb._UuidDb.get_priv_uuid(), hardwareprofile.distros.mythtv_data.uuiddb._UuidDb.get_pub_uuid(), LIRC.GetCodes(), DVDInfo.GetNameAndSerialNum(), AudioInputOSS.GetSamples(), getsize(), ExternIO.GetStatus(), MythSystemLegacyIOHandler.HandleRead(), SignalHandler.handleSignal(), lirc_nextcode(), lirc_read_string(), hardwareprofile.MultipartPostHandler.main(), mythfile_read(), FileRingBuffer.OpenFile(), DeviceReadBuffer.Poll(), ExternIO.Read(), RemoteFile.Read(), read_avi_header(), hardwareprofile.smolt.read_cpuinfo(), hardwareprofile.smolt.read_memory_2_4(), hardwareprofile.smolt.read_memory_2_6(), hardwareprofile.software.read_runlevel(), hardwareprofile.smolt.read_uuid(), common.audiofile.AudioFile.ReadAudioStream(), ZMClient.readData(), ring_write_file(), MpegRecorder.run(), DeviceReadBuffer.run(), JoystickMenuThread.run(), DVBStreamHandler.RunSR(), DVBStreamHandler.RunTS(), V4LRecorder.RunVBIDevice(), FileRingBuffer.safe_read(), safe_read(), save_read(), UnzipPrivate.seekToCentralDirectory(), V4L2encStreamHandler.StartEncoding(), MpegRecorder.StartEncoding(), hardwareprofile.os_detect.get_os_info.ubuntu(), and vbi_handler().

◆ put()

def discid.disc.put (   first,
  last,
  disc_sectors,
  track_offsets 
)
Creates a TOC based on the information given
and returns a :class:`Disc` object.

Takes the `first` track and `last` **audio** track as :obj:`int`.
`disc_sectors` is the end of the last audio track,
normally the total sector count of the disc.
`track_offsets` is a list of all audio track offsets.

Depending on how you get the total sector count,
you might have to substract 11400 (2:32 min.) for discs with data tracks.

A :exc:`TOCError` exception is raised when illegal parameters
are provided.

.. seealso:: :musicbrainz:`Disc ID Calculation`

Definition at line 58 of file disc.py.

Variable Documentation

◆ _FEATURE_MAPPING

dictionary discid.disc._FEATURE_MAPPING = {"read": 1 << 0, "mcn": 1 << 1, "isrc": 1 << 2}
private

Definition at line 30 of file disc.py.

◆ FEATURES_IMPLEMENTED

discid.disc.FEATURES_IMPLEMENTED = list(_FEATURE_MAPPING.keys())

Definition at line 33 of file disc.py.