fix some formating

This commit is contained in:
jean-marie winters 2015-03-02 22:11:33 +01:00
parent 1416846283
commit 5bc8ef7009
2 changed files with 12 additions and 15 deletions

View file

@ -88,12 +88,14 @@ class Backend(object):
raise NotImplementedError()
# bsg1770gain backend
class Bs1770gainBackend(Backend):
"""bs1770gain is a loudness scanner compliant with ITU-R BS.1770 and its
flavors EBU R128,ATSC A/85 and Replaygain 2.0. It uses a special
designed algorithm to normalize audio to the same level.
"""
def __init__(self, config, log):
super(Bs1770gainBackend, self).__init__(config, log)
cmd = 'bs1770gain'
@ -107,19 +109,17 @@ class Bs1770gainBackend(Backend):
call([cmd, self.method])
self.command = cmd
except OSError:
pass
pass
if not self.command:
raise FatalReplayGainError(
'no replaygain command found: install bs1770gain'
)
def compute_track_gain(self, items):
"""Computes the track gain of the given tracks, returns a list
of TrackGain objects.
"""
output = self.compute_gain(items, False)
return output
@ -135,8 +135,6 @@ class Bs1770gainBackend(Backend):
return AlbumGain(output[-1], output[:-1])
def compute_gain(self, items, is_album):
"""Computes the track or album gain of a list of items, returns
a list of TrackGain objects.
@ -147,7 +145,6 @@ class Bs1770gainBackend(Backend):
if len(items) == 0:
return []
"""Compute ReplayGain values and return a list of results
dictionaries as given by `parse_tool_output`.
"""
@ -171,7 +168,7 @@ class Bs1770gainBackend(Backend):
containing information about each analyzed file.
"""
out = []
data = unicode(text, errors='ignore')
data = text.decode('utf8', errors='ignore')
regex = ("(\s{2,2}\[\d+\/\d+\].*?|\[ALBUM\].*?)(?=\s{2,2}\[\d+\/\d+\]"
"|\s{2,2}\[ALBUM\]:|done\.$)")
@ -179,7 +176,7 @@ class Bs1770gainBackend(Backend):
for ll in results[0:num_lines]:
parts = ll.split(b'\n')
if len(parts) == 0:
self._log.debug(u'bad tool output: {0}', text)
self._log.debug(u'bad tool output: {0!r}', text)
raise ReplayGainError('bs1770gain failed')
d = {

View file

@ -118,11 +118,11 @@ These options only work with the "command" backend:
This option only works with the "bs1770gain" backend:
- **method**:either replaygain, ebu or atsc. Default: replaygain
- **method**: The loudness scanning standard: either 'replaygain' for ReplayGain 2.0,
'ebu' for EBU R128 or 'atsc' for ATSC A/85.
This dictates the reference level: -18, -23, or -24 LUFS respectively. Default: replaygain
replaygain measures loudness with a reference level of -18 LUFS.
ebu measures loudness with a reference level of -23 LUFS.
atsc measures loudness with a reference level of -24 LUFS.
Manual Analysis