Merge pull request #387 from whipper-team/feature/issue-383-restructuredtext
Convert documentation from epydoc to reStructuredText
This commit is contained in:
@@ -39,7 +39,7 @@ class Persister:
|
||||
Call persist to store the object to disk; it will get stored if it
|
||||
changed from the on-disk object.
|
||||
|
||||
@ivar object: the persistent object
|
||||
:ivar object: the persistent object
|
||||
"""
|
||||
|
||||
def __init__(self, path=None, default=None):
|
||||
@@ -162,7 +162,7 @@ class ResultCache:
|
||||
Retrieve the persistable RipResult either from our cache (from a
|
||||
previous, possibly aborted rip), or return a new one.
|
||||
|
||||
@rtype: L{Persistable} for L{result.RipResult}
|
||||
:rtype: :any:`Persistable` for :any:`result.RipResult`
|
||||
"""
|
||||
presult = self._pcache.get(cddbdiscid)
|
||||
|
||||
|
||||
@@ -56,11 +56,11 @@ def msfToFrames(msf):
|
||||
"""
|
||||
Converts a string value in MM:SS:FF to frames.
|
||||
|
||||
@param msf: the MM:SS:FF value to convert
|
||||
@type msf: str
|
||||
:param msf: the MM:SS:FF value to convert
|
||||
:type msf: str
|
||||
|
||||
@rtype: int
|
||||
@returns: number of frames
|
||||
:rtype: int
|
||||
:returns: number of frames
|
||||
"""
|
||||
if ':' not in msf:
|
||||
return int(msf)
|
||||
@@ -104,14 +104,14 @@ def formatTime(seconds, fractional=3):
|
||||
If it is greater than 0, we will show seconds and fractions of seconds.
|
||||
As a side consequence, there is no way to show seconds without fractions.
|
||||
|
||||
@param seconds: the time in seconds to format.
|
||||
@type seconds: int or float
|
||||
@param fractional: how many digits to show for the fractional part of
|
||||
:param seconds: the time in seconds to format.
|
||||
:type seconds: int or float
|
||||
:param fractional: how many digits to show for the fractional part of
|
||||
seconds.
|
||||
@type fractional: int
|
||||
:type fractional: int
|
||||
|
||||
@rtype: string
|
||||
@returns: a nicely formatted time string.
|
||||
:rtype: string
|
||||
:returns: a nicely formatted time string.
|
||||
"""
|
||||
chunks = []
|
||||
|
||||
@@ -207,11 +207,11 @@ def getRealPath(refPath, filePath):
|
||||
Does Windows path translation.
|
||||
Will look for the given file name, but with .flac and .wav as extensions.
|
||||
|
||||
@param refPath: path to the file from which the track is referenced;
|
||||
:param refPath: path to the file from which the track is referenced;
|
||||
for example, path to the .cue file in the same directory
|
||||
@type refPath: unicode
|
||||
:type refPath: unicode
|
||||
|
||||
@type filePath: unicode
|
||||
:type filePath: unicode
|
||||
"""
|
||||
assert isinstance(filePath, unicode), "%r is not unicode" % filePath
|
||||
|
||||
@@ -300,11 +300,11 @@ class VersionGetter(object):
|
||||
|
||||
def __init__(self, dependency, args, regexp, expander):
|
||||
"""
|
||||
@param dependency: name of the dependency providing the program
|
||||
@param args: the arguments to invoke to show the version
|
||||
@type args: list of str
|
||||
@param regexp: the regular expression to get the version
|
||||
@param expander: the expansion string for the version using the
|
||||
:param dependency: name of the dependency providing the program
|
||||
:param args: the arguments to invoke to show the version
|
||||
:type args: list of str
|
||||
:param regexp: the regular expression to get the version
|
||||
:param expander: the expansion string for the version using the
|
||||
regexp group dict
|
||||
"""
|
||||
|
||||
|
||||
@@ -58,13 +58,13 @@ class TrackMetadata(object):
|
||||
|
||||
class DiscMetadata(object):
|
||||
"""
|
||||
@param artist: artist(s) name
|
||||
@param sortName: release artist sort name
|
||||
@param release: earliest release date, in YYYY-MM-DD
|
||||
@type release: unicode
|
||||
@param title: title of the disc (with disambiguation)
|
||||
@param releaseTitle: title of the release (without disambiguation)
|
||||
@type tracks: C{list} of L{TrackMetadata}
|
||||
:param artist: artist(s) name
|
||||
:param sortName: release artist sort name
|
||||
:param release: earliest release date, in YYYY-MM-DD
|
||||
:type release: unicode
|
||||
:param title: title of the disc (with disambiguation)
|
||||
:param releaseTitle: title of the release (without disambiguation)
|
||||
:type tracks: list of :any:`TrackMetadata`
|
||||
"""
|
||||
artist = None
|
||||
sortName = None
|
||||
@@ -163,11 +163,11 @@ def _getWorks(recording):
|
||||
|
||||
def _getMetadata(release, discid, country=None):
|
||||
"""
|
||||
@type release: C{dict}
|
||||
@param release: a release dict as returned in the value for key release
|
||||
:type release: dict
|
||||
:param release: a release dict as returned in the value for key release
|
||||
from get_release_by_id
|
||||
|
||||
@rtype: L{DiscMetadata} or None
|
||||
:rtype: DiscMetadata or None
|
||||
"""
|
||||
logger.debug('getMetadata for release id %r', release['id'])
|
||||
if not release['id']:
|
||||
@@ -282,9 +282,9 @@ def musicbrainz(discid, country=None, record=False):
|
||||
|
||||
Example disc id: Mj48G109whzEmAbPBoGvd4KyCS4-
|
||||
|
||||
@type discid: str
|
||||
:type discid: str
|
||||
|
||||
@rtype: list of L{DiscMetadata}
|
||||
:rtype: list of :any:`DiscMetadata`
|
||||
"""
|
||||
logger.debug('looking up results for discid %r', discid)
|
||||
import musicbrainzngs
|
||||
|
||||
@@ -28,10 +28,10 @@ class PathFilter(object):
|
||||
|
||||
def __init__(self, slashes=True, quotes=True, fat=True, special=False):
|
||||
"""
|
||||
@param slashes: whether to convert slashes to dashes
|
||||
@param quotes: whether to normalize quotes
|
||||
@param fat: whether to strip characters illegal on FAT filesystems
|
||||
@param special: whether to strip special characters
|
||||
:param slashes: whether to convert slashes to dashes
|
||||
:param quotes: whether to normalize quotes
|
||||
:param fat: whether to strip characters illegal on FAT filesystems
|
||||
:param special: whether to strip special characters
|
||||
"""
|
||||
self._slashes = slashes
|
||||
self._quotes = quotes
|
||||
|
||||
@@ -44,12 +44,11 @@ class Program:
|
||||
"""
|
||||
I maintain program state and functionality.
|
||||
|
||||
@ivar metadata:
|
||||
@type metadata: L{mbngs.DiscMetadata}
|
||||
@ivar result: the rip's result
|
||||
@type result: L{result.RipResult}
|
||||
@type outdir: unicode
|
||||
@type config: L{whipper.common.config.Config}
|
||||
:vartype metadata: mbngs.DiscMetadata
|
||||
:cvar result: the rip's result
|
||||
:vartype result: result.RipResult
|
||||
:vartype outdir: unicode
|
||||
:vartype config: whipper.common.config.Config
|
||||
"""
|
||||
|
||||
cuePath = None
|
||||
@@ -60,7 +59,7 @@ class Program:
|
||||
|
||||
def __init__(self, config, record=False):
|
||||
"""
|
||||
@param record: whether to record results of API calls for playback.
|
||||
:param record: whether to record results of API calls for playback.
|
||||
"""
|
||||
self._record = record
|
||||
self._cache = cache.ResultCache()
|
||||
@@ -109,7 +108,7 @@ class Program:
|
||||
"""
|
||||
Retrieve the Table either from the cache or the drive.
|
||||
|
||||
@rtype: L{table.Table}
|
||||
:rtype: table.Table
|
||||
"""
|
||||
tcache = cache.TableCache()
|
||||
ptable = tcache.get(cddbdiscid, mbdiscid)
|
||||
@@ -153,7 +152,7 @@ class Program:
|
||||
Retrieve the persistable RipResult either from our cache (from a
|
||||
previous, possibly aborted rip), or return a new one.
|
||||
|
||||
@rtype: L{result.RipResult}
|
||||
:rtype: result.RipResult
|
||||
"""
|
||||
assert self.result is None
|
||||
|
||||
@@ -247,9 +246,9 @@ class Program:
|
||||
@staticmethod
|
||||
def getCDDB(cddbdiscid):
|
||||
"""
|
||||
@param cddbdiscid: list of id, tracks, offsets, seconds
|
||||
:param cddbdiscid: list of id, tracks, offsets, seconds
|
||||
|
||||
@rtype: str
|
||||
:rtype: str
|
||||
"""
|
||||
# FIXME: convert to nonblocking?
|
||||
try:
|
||||
@@ -272,7 +271,7 @@ class Program:
|
||||
def getMusicBrainz(self, ittoc, mbdiscid, release=None, country=None,
|
||||
prompt=False):
|
||||
"""
|
||||
@type ittoc: L{whipper.image.table.Table}
|
||||
:type ittoc: whipper.image.table.Table
|
||||
"""
|
||||
# look up disc on MusicBrainz
|
||||
print('Disc duration: %s, %d audio tracks' % (
|
||||
@@ -392,10 +391,10 @@ class Program:
|
||||
"""
|
||||
Based on the metadata, get a dict of tags for the given track.
|
||||
|
||||
@param number: track number (0 for HTOA)
|
||||
@type number: int
|
||||
:param number: track number (0 for HTOA)
|
||||
:type number: int
|
||||
|
||||
@rtype: dict
|
||||
:rtype: dict
|
||||
"""
|
||||
trackArtist = u'Unknown Artist'
|
||||
releaseArtist = u'Unknown Artist'
|
||||
@@ -461,7 +460,7 @@ class Program:
|
||||
"""
|
||||
Check if we have hidden track one audio.
|
||||
|
||||
@returns: tuple of (start, stop), or None
|
||||
:returns: tuple of (start, stop), or None
|
||||
"""
|
||||
track = self.result.table.tracks[0]
|
||||
try:
|
||||
@@ -498,8 +497,8 @@ class Program:
|
||||
Ripping the track may change the track's filename as stored in
|
||||
trackResult.
|
||||
|
||||
@param trackResult: the object to store information in.
|
||||
@type trackResult: L{result.TrackResult}
|
||||
:param trackResult: the object to store information in.
|
||||
:type trackResult: result.TrackResult
|
||||
"""
|
||||
if trackResult.number == 0:
|
||||
start, stop = self.getHTOA()
|
||||
|
||||
@@ -109,10 +109,10 @@ class FileRenamer(Operator):
|
||||
"""
|
||||
Add a rename operation.
|
||||
|
||||
@param source: source filename
|
||||
@type source: str
|
||||
@param destination: destination filename
|
||||
@type destination: str
|
||||
:param source: source filename
|
||||
:type source: str
|
||||
:param destination: destination filename
|
||||
:type destination: str
|
||||
"""
|
||||
|
||||
|
||||
@@ -142,16 +142,16 @@ class Operation(object):
|
||||
def serialize(self):
|
||||
"""
|
||||
Serialize the operation.
|
||||
The return value should bu usable with L{deserialize}
|
||||
The return value should bu usable with :any:`deserialize`
|
||||
|
||||
@rtype: str
|
||||
:rtype: str
|
||||
"""
|
||||
|
||||
def deserialize(cls, data):
|
||||
"""
|
||||
Deserialize the operation with the given operation data.
|
||||
|
||||
@type data: str
|
||||
:type data: str
|
||||
"""
|
||||
raise NotImplementedError
|
||||
deserialize = classmethod(deserialize)
|
||||
|
||||
24
whipper/extern/task/task.py
vendored
24
whipper/extern/task/task.py
vendored
@@ -97,8 +97,8 @@ class Task(LogStub):
|
||||
stopping myself from running.
|
||||
The listener can then handle the Task.exception.
|
||||
|
||||
@ivar description: what am I doing
|
||||
@ivar exception: set if an exception happened during the task
|
||||
:cvar description: what am I doing
|
||||
:cvar exception: set if an exception happened during the task
|
||||
execution. Will be raised through run() at the end.
|
||||
"""
|
||||
logCategory = 'Task'
|
||||
@@ -254,16 +254,16 @@ class ITaskListener(object):
|
||||
"""
|
||||
Implement me to be informed about progress.
|
||||
|
||||
@type value: float
|
||||
@param value: progress, from 0.0 to 1.0
|
||||
:type value: float
|
||||
:param value: progress, from 0.0 to 1.0
|
||||
"""
|
||||
|
||||
def described(self, task, description):
|
||||
"""
|
||||
Implement me to be informed about description changes.
|
||||
|
||||
@type description: str
|
||||
@param description: description
|
||||
:type description: str
|
||||
:param description: description
|
||||
"""
|
||||
|
||||
def started(self, task):
|
||||
@@ -298,8 +298,8 @@ class BaseMultiTask(Task, ITaskListener):
|
||||
"""
|
||||
I perform multiple tasks.
|
||||
|
||||
@ivar tasks: the tasks to run
|
||||
@type tasks: list of L{Task}
|
||||
:ivar tasks: the tasks to run
|
||||
:type tasks: list of :any:`Task`
|
||||
"""
|
||||
|
||||
description = 'Doing various tasks'
|
||||
@@ -313,7 +313,7 @@ class BaseMultiTask(Task, ITaskListener):
|
||||
"""
|
||||
Add a task.
|
||||
|
||||
@type task: L{Task}
|
||||
:type task: Task
|
||||
"""
|
||||
if self.tasks is None:
|
||||
self.tasks = []
|
||||
@@ -446,7 +446,7 @@ class TaskRunner(LogStub):
|
||||
"""
|
||||
Run the given task.
|
||||
|
||||
@type task: Task
|
||||
:type task: Task
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@@ -457,8 +457,8 @@ class TaskRunner(LogStub):
|
||||
|
||||
Subclasses should implement this.
|
||||
|
||||
@type delta: float
|
||||
@param delta: time in the future to schedule call for, in seconds.
|
||||
:type delta: float
|
||||
:param delta: time in the future to schedule call for, in seconds.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@@ -62,14 +62,14 @@ class CueFile(object):
|
||||
"""
|
||||
I represent a .cue file as an object.
|
||||
|
||||
@type table: L{table.Table}
|
||||
@ivar table: the index table.
|
||||
:vartype table: table.Table
|
||||
:ivar table: the index table.
|
||||
"""
|
||||
logCategory = 'CueFile'
|
||||
|
||||
def __init__(self, path):
|
||||
"""
|
||||
@type path: unicode
|
||||
:type path: unicode
|
||||
"""
|
||||
assert isinstance(path, unicode), "%r is not unicode" % path
|
||||
|
||||
@@ -154,7 +154,7 @@ class CueFile(object):
|
||||
"""
|
||||
Add a message about a given line in the cue file.
|
||||
|
||||
@param number: line number, counting from 0.
|
||||
:param number: line number, counting from 0.
|
||||
"""
|
||||
self._messages.append((number + 1, message))
|
||||
|
||||
@@ -182,7 +182,7 @@ class CueFile(object):
|
||||
"""
|
||||
Translate the .cue's FILE to an existing path.
|
||||
|
||||
@type path: unicode
|
||||
:type path: unicode
|
||||
"""
|
||||
return common.getRealPath(self._path, path)
|
||||
|
||||
@@ -194,7 +194,7 @@ class File:
|
||||
|
||||
def __init__(self, path, file_format):
|
||||
"""
|
||||
@type path: unicode
|
||||
:type path: unicode
|
||||
"""
|
||||
assert isinstance(path, unicode), "%r is not unicode" % path
|
||||
|
||||
|
||||
@@ -36,15 +36,15 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class Image(object):
|
||||
"""
|
||||
@ivar table: The Table of Contents for this image.
|
||||
@type table: L{table.Table}
|
||||
:ivar table: The Table of Contents for this image.
|
||||
:vartype table: table.Table
|
||||
"""
|
||||
logCategory = 'Image'
|
||||
|
||||
def __init__(self, path):
|
||||
"""
|
||||
@type path: unicode
|
||||
@param path: .cue path
|
||||
:type path: unicode
|
||||
:param path: .cue path
|
||||
"""
|
||||
assert isinstance(path, unicode), "%r is not unicode" % path
|
||||
|
||||
@@ -60,7 +60,7 @@ class Image(object):
|
||||
"""
|
||||
Translate the .cue's FILE to an existing path.
|
||||
|
||||
@param path: .cue path
|
||||
:param path: .cue path
|
||||
"""
|
||||
assert isinstance(path, unicode), "%r is not unicode" % path
|
||||
|
||||
|
||||
@@ -57,17 +57,18 @@ class Track:
|
||||
"""
|
||||
I represent a track entry in an Table.
|
||||
|
||||
@ivar number: track number (1-based)
|
||||
@type number: int
|
||||
@ivar audio: whether the track is audio
|
||||
@type audio: bool
|
||||
@type indexes: dict of number -> L{Index}
|
||||
@ivar isrc: ISRC code (12 alphanumeric characters)
|
||||
@type isrc: str
|
||||
@ivar cdtext: dictionary of CD Text information; see L{CDTEXT_KEYS}.
|
||||
@type cdtext: str -> unicode
|
||||
@ivar pre_emphasis: whether track is pre-emphasised
|
||||
@type pre_emphasis: bool
|
||||
:cvar number: track number (1-based)
|
||||
:vartype number: int
|
||||
:cvar audio: whether the track is audio
|
||||
:vartype audio: bool
|
||||
:vartype indexes: dict of number -> :any:`Index`
|
||||
:cvar isrc: ISRC code (12 alphanumeric characters)
|
||||
:vartype isrc: str
|
||||
:cvar cdtext: dictionary of CD Text information;
|
||||
:any:`see CDTEXT_KEYS`
|
||||
:vartype cdtext: str -> unicode
|
||||
:cvar pre_emphasis: whether track is pre-emphasised
|
||||
:vartype pre_emphasis: bool
|
||||
"""
|
||||
|
||||
number = None
|
||||
@@ -90,7 +91,7 @@ class Track:
|
||||
def index(self, number, absolute=None, path=None, relative=None,
|
||||
counter=None):
|
||||
"""
|
||||
@type path: unicode or None
|
||||
:type path: unicode or None
|
||||
"""
|
||||
if path is not None:
|
||||
assert isinstance(path, unicode), "%r is not unicode" % path
|
||||
@@ -130,9 +131,9 @@ class Track:
|
||||
|
||||
class Index:
|
||||
"""
|
||||
@ivar counter: counter for the index source; distinguishes between
|
||||
:cvar counter: counter for the index source; distinguishes between
|
||||
the matching FILE lines in .cue files for example
|
||||
@type path: unicode or None
|
||||
:vartype path: unicode or None
|
||||
"""
|
||||
number = None
|
||||
absolute = None
|
||||
@@ -161,11 +162,11 @@ class Table(object):
|
||||
"""
|
||||
I represent a table of indexes on a CD.
|
||||
|
||||
@ivar tracks: tracks on this CD
|
||||
@type tracks: list of L{Track}
|
||||
@ivar catalog: catalog number
|
||||
@type catalog: str
|
||||
@type cdtext: dict of str -> str
|
||||
:cvar tracks: tracks on this CD
|
||||
:vartype tracks: list of :any:`Track`
|
||||
:cvar catalog: catalog number
|
||||
:vartype catalog: str
|
||||
:vartype cdtext: dict of str -> str
|
||||
"""
|
||||
|
||||
tracks = None # list of Track
|
||||
@@ -193,22 +194,22 @@ class Table(object):
|
||||
|
||||
def getTrackStart(self, number):
|
||||
"""
|
||||
@param number: the track number, 1-based
|
||||
@type number: int
|
||||
:param number: the track number, 1-based
|
||||
:type number: int
|
||||
|
||||
@returns: the start of the given track number's index 1, in CD frames
|
||||
@rtype: int
|
||||
:returns: the start of the given track number's index 1, in CD frames
|
||||
:rtype: int
|
||||
"""
|
||||
track = self.tracks[number - 1]
|
||||
return track.getIndex(1).absolute
|
||||
|
||||
def getTrackEnd(self, number):
|
||||
"""
|
||||
@param number: the track number, 1-based
|
||||
@type number: int
|
||||
:param number: the track number, 1-based
|
||||
:type number: int
|
||||
|
||||
@returns: the end of the given track number (ie index 1 of next track)
|
||||
@rtype: int
|
||||
:returns: the end of the given track number (ie index 1 of next track)
|
||||
:rtype: int
|
||||
"""
|
||||
# default to end of disc
|
||||
end = self.leadout - 1
|
||||
@@ -228,24 +229,24 @@ class Table(object):
|
||||
|
||||
def getTrackLength(self, number):
|
||||
"""
|
||||
@param number: the track number, 1-based
|
||||
@type number: int
|
||||
:param number: the track number, 1-based
|
||||
:type number: int
|
||||
|
||||
@returns: the length of the given track number, in CD frames
|
||||
@rtype: int
|
||||
:returns: the length of the given track number, in CD frames
|
||||
:rtype: int
|
||||
"""
|
||||
return self.getTrackEnd(number) - self.getTrackStart(number) + 1
|
||||
|
||||
def getAudioTracks(self):
|
||||
"""
|
||||
@returns: the number of audio tracks on the CD
|
||||
@rtype: int
|
||||
:returns: the number of audio tracks on the CD
|
||||
:rtype: int
|
||||
"""
|
||||
return len([t for t in self.tracks if t.audio])
|
||||
|
||||
def hasDataTracks(self):
|
||||
"""
|
||||
@returns: whether this disc contains data tracks
|
||||
:returns: whether this disc contains data tracks
|
||||
"""
|
||||
return len([t for t in self.tracks if not t.audio]) > 0
|
||||
|
||||
@@ -268,7 +269,7 @@ class Table(object):
|
||||
- offset of index 1 of each track
|
||||
- length of disc in seconds (including data track)
|
||||
|
||||
@rtype: list of int
|
||||
:rtype: list of int
|
||||
"""
|
||||
offsets = []
|
||||
|
||||
@@ -320,8 +321,8 @@ class Table(object):
|
||||
"""
|
||||
Calculate the CDDB disc ID.
|
||||
|
||||
@rtype: str
|
||||
@returns: the 8-character hexadecimal disc ID
|
||||
:rtype: str
|
||||
:returns: the 8-character hexadecimal disc ID
|
||||
"""
|
||||
values = self.getCDDBValues()
|
||||
return "%08x" % int(values)
|
||||
@@ -330,8 +331,8 @@ class Table(object):
|
||||
"""
|
||||
Calculate the MusicBrainz disc ID.
|
||||
|
||||
@rtype: str
|
||||
@returns: the 28-character base64-encoded disc ID
|
||||
:rtype: str
|
||||
:returns: the 28-character base64-encoded disc ID
|
||||
"""
|
||||
if self.mbdiscid:
|
||||
logger.debug('getMusicBrainzDiscId: returning cached %r',
|
||||
@@ -401,7 +402,7 @@ class Table(object):
|
||||
"""
|
||||
Get the length in frames (excluding HTOA)
|
||||
|
||||
@param data: whether to include the data tracks in the length
|
||||
:param data: whether to include the data tracks in the length
|
||||
"""
|
||||
# the 'real' leadout, not offset by 150 frames
|
||||
if data:
|
||||
@@ -431,7 +432,7 @@ class Table(object):
|
||||
- leadout of disc
|
||||
- offset of index 1 of each track
|
||||
|
||||
@rtype: list of int
|
||||
:rtype: list of int
|
||||
"""
|
||||
# MusicBrainz disc id does not take into account data tracks
|
||||
|
||||
@@ -470,13 +471,13 @@ class Table(object):
|
||||
|
||||
def cue(self, cuePath='', program='whipper'):
|
||||
"""
|
||||
@param cuePath: path to the cue file to be written. If empty,
|
||||
:param cuePath: path to the cue file to be written. If empty,
|
||||
will treat paths as if in current directory.
|
||||
|
||||
|
||||
Dump our internal representation to a .cue file content.
|
||||
|
||||
@rtype: C{unicode}
|
||||
:rtype: unicode
|
||||
"""
|
||||
logger.debug('generating .cue for cuePath %r', cuePath)
|
||||
|
||||
@@ -633,8 +634,8 @@ class Table(object):
|
||||
|
||||
Assumes all indexes have an absolute offset and will raise if not.
|
||||
|
||||
@type track: C{int}
|
||||
@type index: C{int}
|
||||
:type track: int
|
||||
:type index: int
|
||||
"""
|
||||
logger.debug('setFile: track %d, index %d, path %r, length %r, '
|
||||
'counter %r', track, index, path, length, counter)
|
||||
@@ -704,7 +705,7 @@ class Table(object):
|
||||
The other table is assumed to be from an additional session,
|
||||
|
||||
|
||||
@type other: L{Table}
|
||||
:type other: Table
|
||||
"""
|
||||
gap = self._getSessionGap(session)
|
||||
|
||||
@@ -751,11 +752,11 @@ class Table(object):
|
||||
"""
|
||||
Return the next track and index.
|
||||
|
||||
@param track: track number, 1-based
|
||||
:param track: track number, 1-based
|
||||
|
||||
@raises IndexError: on last index
|
||||
:raises IndexError: on last index
|
||||
|
||||
@rtype: tuple of (int, int)
|
||||
:rtype: tuple of (int, int)
|
||||
"""
|
||||
t = self.tracks[track - 1]
|
||||
indexes = list(t.indexes)
|
||||
|
||||
@@ -104,10 +104,10 @@ class Sources:
|
||||
|
||||
def append(self, counter, offset, source):
|
||||
"""
|
||||
@param counter: the source counter; updates for each different
|
||||
:param counter: the source counter; updates for each different
|
||||
data source (silence or different file path)
|
||||
@type counter: int
|
||||
@param offset: the absolute disc offset where this source starts
|
||||
:type counter: int
|
||||
:param offset: the absolute disc offset where this source starts
|
||||
"""
|
||||
logger.debug('appending source, counter %d, abs offset %d, '
|
||||
'source %r', counter, offset, source)
|
||||
@@ -138,7 +138,7 @@ class TocFile(object):
|
||||
|
||||
def __init__(self, path):
|
||||
"""
|
||||
@type path: unicode
|
||||
:type path: unicode
|
||||
"""
|
||||
assert isinstance(path, unicode), "%r is not unicode" % path
|
||||
self._path = path
|
||||
@@ -380,7 +380,7 @@ class TocFile(object):
|
||||
"""
|
||||
Add a message about a given line in the cue file.
|
||||
|
||||
@param number: line number, counting from 0.
|
||||
:param number: line number, counting from 0.
|
||||
"""
|
||||
self._messages.append((number + 1, message))
|
||||
|
||||
@@ -412,7 +412,7 @@ class TocFile(object):
|
||||
"""
|
||||
Translate the .toc's FILE to an existing path.
|
||||
|
||||
@type path: unicode
|
||||
:type path: unicode
|
||||
"""
|
||||
return common.getRealPath(self._path, path)
|
||||
|
||||
@@ -424,10 +424,10 @@ class File:
|
||||
|
||||
def __init__(self, path, start, length):
|
||||
"""
|
||||
@type path: C{unicode}
|
||||
@type start: C{int}
|
||||
@param start: starting point for the track in this file, in frames
|
||||
@param length: length for the track in this file, in frames
|
||||
:type path: unicode
|
||||
:type start: int
|
||||
:param start: starting point for the track in this file, in frames
|
||||
:param length: length for the track in this file, in frames
|
||||
"""
|
||||
assert isinstance(path, unicode), "%r is not unicode" % path
|
||||
|
||||
|
||||
@@ -88,10 +88,10 @@ class ProgressParser:
|
||||
|
||||
def __init__(self, start, stop):
|
||||
"""
|
||||
@param start: first frame to rip
|
||||
@type start: int
|
||||
@param stop: last frame to rip (inclusive)
|
||||
@type stop: int
|
||||
:param start: first frame to rip
|
||||
:type start: int
|
||||
:param stop: last frame to rip (inclusive)
|
||||
:type stop: int
|
||||
"""
|
||||
self.start = start
|
||||
self.stop = stop
|
||||
@@ -205,8 +205,6 @@ class ProgressParser:
|
||||
class ReadTrackTask(task.Task):
|
||||
"""
|
||||
I am a task that reads a track using cdparanoia.
|
||||
|
||||
@ivar reads: how many reads were done to rip the track
|
||||
"""
|
||||
|
||||
description = "Reading track"
|
||||
@@ -221,22 +219,22 @@ class ReadTrackTask(task.Task):
|
||||
"""
|
||||
Read the given track.
|
||||
|
||||
@param path: where to store the ripped track
|
||||
@type path: unicode
|
||||
@param table: table of contents of CD
|
||||
@type table: L{table.Table}
|
||||
@param start: first frame to rip
|
||||
@type start: int
|
||||
@param stop: last frame to rip (inclusive); >= start
|
||||
@type stop: int
|
||||
@param offset: read offset, in samples
|
||||
@type offset: int
|
||||
@param device: the device to rip from
|
||||
@type device: str
|
||||
@param action: a string representing the action; e.g. Read/Verify
|
||||
@type action: str
|
||||
@param what: a string representing what's being read; e.g. Track
|
||||
@type what: str
|
||||
:param path: where to store the ripped track
|
||||
:type path: unicode
|
||||
:param table: table of contents of CD
|
||||
:type table: table.Table
|
||||
:param start: first frame to rip
|
||||
:type start: int
|
||||
:param stop: last frame to rip (inclusive); >= start
|
||||
:type stop: int
|
||||
:param offset: read offset, in samples
|
||||
:type offset: int
|
||||
:param device: the device to rip from
|
||||
:type device: str
|
||||
:param action: a string representing the action; e.g. Read/Verify
|
||||
:type action: str
|
||||
:param what: a string representing what's being read; e.g. Track
|
||||
:type what: str
|
||||
"""
|
||||
assert isinstance(path, unicode), "%r is not unicode" % path
|
||||
|
||||
@@ -403,17 +401,16 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
|
||||
The path where the file is stored can be changed if necessary, for
|
||||
example if the file name is too long.
|
||||
|
||||
@ivar path: the path where the file is to be stored.
|
||||
@ivar checksum: the checksum of the track; set if they match.
|
||||
@ivar testchecksum: the test checksum of the track.
|
||||
@ivar copychecksum: the copy checksum of the track.
|
||||
@ivar testspeed: the test speed of the track, as a multiple of
|
||||
:cvar checksum: the checksum of the track; set if they match.
|
||||
:cvar testchecksum: the test checksum of the track.
|
||||
:cvar copychecksum: the copy checksum of the track.
|
||||
:cvar testspeed: the test speed of the track, as a multiple of
|
||||
track duration.
|
||||
@ivar copyspeed: the copy speed of the track, as a multiple of
|
||||
:cvar copyspeed: the copy speed of the track, as a multiple of
|
||||
track duration.
|
||||
@ivar testduration: the test duration of the track, in seconds.
|
||||
@ivar copyduration: the copy duration of the track, in seconds.
|
||||
@ivar peak: the peak level of the track
|
||||
:cvar testduration: the test duration of the track, in seconds.
|
||||
:cvar copyduration: the copy duration of the track, in seconds.
|
||||
:cvar peak: the peak level of the track
|
||||
"""
|
||||
|
||||
checksum = None
|
||||
@@ -432,20 +429,20 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
|
||||
def __init__(self, path, table, start, stop, overread, offset=0,
|
||||
device=None, taglist=None, what="track"):
|
||||
"""
|
||||
@param path: where to store the ripped track
|
||||
@type path: str
|
||||
@param table: table of contents of CD
|
||||
@type table: L{table.Table}
|
||||
@param start: first frame to rip
|
||||
@type start: int
|
||||
@param stop: last frame to rip (inclusive)
|
||||
@type stop: int
|
||||
@param offset: read offset, in samples
|
||||
@type offset: int
|
||||
@param device: the device to rip from
|
||||
@type device: str
|
||||
@param taglist: a dict of tags
|
||||
@type taglist: dict
|
||||
:param path: where to store the ripped track
|
||||
:type path: str
|
||||
:param table: table of contents of CD
|
||||
:type table: table.Table
|
||||
:param start: first frame to rip
|
||||
:type start: int
|
||||
:param stop: last frame to rip (inclusive)
|
||||
:type stop: int
|
||||
:param offset: read offset, in samples
|
||||
:type offset: int
|
||||
:param device: the device to rip from
|
||||
:type device: str
|
||||
:param taglist: a dict of tags
|
||||
:type taglist: dict
|
||||
"""
|
||||
task.MultiSeparateTask.__init__(self)
|
||||
|
||||
|
||||
@@ -69,12 +69,12 @@ class ReadTOCTask(task.Task):
|
||||
"""
|
||||
Read the TOC for 'device'.
|
||||
|
||||
@param device: block device to read TOC from
|
||||
@type device: str
|
||||
@param fast_toc: If to use fast-toc cdrdao mode
|
||||
@type fast_toc: bool
|
||||
@param toc_path: Where to save TOC if wanted.
|
||||
@type toc_path: str
|
||||
:param device: block device to read TOC from
|
||||
:type device: str
|
||||
:param fast_toc: If to use fast-toc cdrdao mode
|
||||
:type fast_toc: bool
|
||||
:param toc_path: Where to save TOC if wanted.
|
||||
:type toc_path: str
|
||||
"""
|
||||
|
||||
self.device = device
|
||||
|
||||
@@ -13,7 +13,7 @@ class AudioLengthTask(ctask.PopenTask):
|
||||
"""
|
||||
I calculate the length of a track in audio samples.
|
||||
|
||||
@ivar length: length of the decoded audio file, in audio samples.
|
||||
:cvar length: length of the decoded audio file, in audio samples.
|
||||
"""
|
||||
logCategory = 'AudioLengthTask'
|
||||
description = 'Getting length of audio track'
|
||||
@@ -21,7 +21,7 @@ class AudioLengthTask(ctask.PopenTask):
|
||||
|
||||
def __init__(self, path):
|
||||
"""
|
||||
@type path: unicode
|
||||
:type path: unicode
|
||||
"""
|
||||
assert isinstance(path, unicode), "%r is not unicode" % path
|
||||
|
||||
|
||||
@@ -69,18 +69,18 @@ class RipResult:
|
||||
I hold information about the result for rips.
|
||||
I can be used to write log files.
|
||||
|
||||
@ivar offset: sample read offset
|
||||
@ivar table: the full index table
|
||||
@type table: L{whipper.image.table.Table}
|
||||
@ivar metadata: disc metadata from MusicBrainz (if available)
|
||||
@type metadata: L{whipper.common.mbngs.DiscMetadata}
|
||||
:cvar offset: sample read offset
|
||||
:cvar table: the full index table
|
||||
:vartype table: whipper.image.table.Table
|
||||
:cvar metadata: disc metadata from MusicBrainz (if available)
|
||||
:vartype metadata: whipper.common.mbngs.DiscMetadata
|
||||
|
||||
@ivar vendor: vendor of the CD drive
|
||||
@ivar model: model of the CD drive
|
||||
@ivar release: release of the CD drive
|
||||
:cvar vendor: vendor of the CD drive
|
||||
:cvar model: model of the CD drive
|
||||
:cvar release: release of the CD drive
|
||||
|
||||
@ivar cdrdaoVersion: version of cdrdao used for the rip
|
||||
@ivar cdparanoiaVersion: version of cdparanoia used for the rip
|
||||
:cvar cdrdaoVersion: version of cdrdao used for the rip
|
||||
:cvar cdparanoiaVersion: version of cdparanoia used for the rip
|
||||
"""
|
||||
|
||||
offset = 0
|
||||
@@ -107,10 +107,10 @@ class RipResult:
|
||||
|
||||
def getTrackResult(self, number):
|
||||
"""
|
||||
@param number: the track number (0 for HTOA)
|
||||
:param number: the track number (0 for HTOA)
|
||||
|
||||
@type number: int
|
||||
@rtype: L{TrackResult}
|
||||
:type number: int
|
||||
:rtype: TrackResult
|
||||
"""
|
||||
for t in self.tracks:
|
||||
if t.number == number:
|
||||
@@ -128,11 +128,11 @@ class Logger(object):
|
||||
"""
|
||||
Create a log from the given ripresult.
|
||||
|
||||
@param epoch: when the log file gets generated
|
||||
@type epoch: float
|
||||
@type ripResult: L{RipResult}
|
||||
:param epoch: when the log file gets generated
|
||||
:type epoch: float
|
||||
:type ripResult: RipResult
|
||||
|
||||
@rtype: str
|
||||
:rtype: str
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@@ -153,7 +153,7 @@ def getLoggers():
|
||||
"""
|
||||
Get all logger plugins with entry point 'whipper.logger'.
|
||||
|
||||
@rtype: dict of C{str} -> C{Logger}
|
||||
:rtype: dict of :class:`str` -> :any:`Logger`
|
||||
"""
|
||||
d = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user