don't break 80 character line limit
This commit is contained in:
parent
fa3302cebc
commit
6cd8938e47
|
@ -71,8 +71,10 @@ def get_file_type(file_path):
|
||||||
|
|
||||||
def calculate_replay_gain(file_path):
|
def calculate_replay_gain(file_path):
|
||||||
"""
|
"""
|
||||||
This function accepts files of type mp3/ogg/flac and returns a calculated ReplayGain value in dB.
|
This function accepts files of type mp3/ogg/flac and returns a calculated
|
||||||
If the value cannot be calculated for some reason, then we default to 0 (Unity Gain).
|
ReplayGain value in dB.
|
||||||
|
If the value cannot be calculated for some reason, then we default to 0
|
||||||
|
(Unity Gain).
|
||||||
|
|
||||||
http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification
|
http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification
|
||||||
"""
|
"""
|
||||||
|
@ -92,13 +94,21 @@ def calculate_replay_gain(file_path):
|
||||||
if file_type:
|
if file_type:
|
||||||
if file_type == 'mp3':
|
if file_type == 'mp3':
|
||||||
if run_process("which mp3gain > /dev/null") == 0:
|
if run_process("which mp3gain > /dev/null") == 0:
|
||||||
out = get_process_output('nice -n %s mp3gain -q "%s" 2> /dev/null' % (nice_level, temp_file_path))
|
command = 'nice -n %s mp3gain -q "%s" 2> /dev/null' \
|
||||||
search = re.search(r'Recommended "Track" dB change: (.*)', out)
|
% (nice_level, temp_file_path)
|
||||||
|
out = get_process_output()
|
||||||
|
search = re.search(r'Recommended "Track" dB change: (.*)', \
|
||||||
|
out)
|
||||||
else:
|
else:
|
||||||
logger.warn("mp3gain not found")
|
logger.warn("mp3gain not found")
|
||||||
elif file_type == 'vorbis':
|
elif file_type == 'vorbis':
|
||||||
if run_process("which vorbisgain > /dev/null && which ogginfo > /dev/null") == 0:
|
command = "which vorbisgain > /dev/null && which ogginfo > \
|
||||||
run_process('nice -n %s vorbisgain -q -f "%s" 2>/dev/null >/dev/null' % (nice_level,temp_file_path))
|
/dev/null"
|
||||||
|
if run_process() == 0:
|
||||||
|
command = 'nice -n %s vorbisgain -q -f "%s" 2>/dev/null \
|
||||||
|
>/dev/null' % (nice_level,temp_file_path)
|
||||||
|
run_process(command)
|
||||||
|
|
||||||
out = get_process_output('ogginfo "%s"' % temp_file_path)
|
out = get_process_output('ogginfo "%s"' % temp_file_path)
|
||||||
search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out)
|
search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue