more lintian fixes
-mostly lines with length > 79
This commit is contained in:
parent
d0a0487840
commit
e51e046dd0
11 changed files with 162 additions and 113 deletions
|
@ -82,8 +82,8 @@ def calculate_replay_gain(file_path):
|
|||
|
||||
try:
|
||||
"""
|
||||
Making a duplicate is required because the ReplayGain extraction utilities we use
|
||||
make unwanted modifications to the file.
|
||||
Making a duplicate is required because the ReplayGain extraction
|
||||
utilities we use make unwanted modifications to the file.
|
||||
"""
|
||||
|
||||
search = None
|
||||
|
@ -95,16 +95,18 @@ def calculate_replay_gain(file_path):
|
|||
if file_type:
|
||||
if file_type == 'mp3':
|
||||
if run_process(['which', 'mp3gain']) == 0:
|
||||
command = ['nice', '-n', nice_level, 'mp3gain', '-q', temp_file_path]
|
||||
command = ['nice', '-n', nice_level, 'mp3gain', '-q',
|
||||
temp_file_path]
|
||||
out = get_process_output(command)
|
||||
search = re.search(r'Recommended "Track" dB change: (.*)', \
|
||||
search = re.search(r'Recommended "Track" dB change: (.*)',
|
||||
out)
|
||||
else:
|
||||
logger.warn("mp3gain not found")
|
||||
elif file_type == 'vorbis':
|
||||
if run_process(['which', 'ogginfo']) == 0 and \
|
||||
run_process(['which', 'vorbisgain']) == 0:
|
||||
command = ['nice', '-n', nice_level, 'vorbisgain', '-q', '-f', temp_file_path]
|
||||
command = ['nice', '-n', nice_level, 'vorbisgain', '-q',
|
||||
'-f', temp_file_path]
|
||||
run_process(command)
|
||||
|
||||
out = get_process_output(['ogginfo', temp_file_path])
|
||||
|
|
|
@ -50,16 +50,19 @@ class ReplayGainUpdater(Thread):
|
|||
# return a list of pairs where the first value is the
|
||||
# file's database row id and the second value is the
|
||||
# filepath
|
||||
files = self.api_client.get_files_without_replay_gain_value(dir_id)
|
||||
files = self.api_client.\
|
||||
get_files_without_replay_gain_value(dir_id)
|
||||
processed_data = []
|
||||
for f in files:
|
||||
full_path = os.path.join(dir_path, f['fp'])
|
||||
processed_data.append((f['id'], replaygain.calculate_replay_gain(full_path)))
|
||||
processed_data.append((f['id'],
|
||||
replaygain.calculate_replay_gain(full_path)))
|
||||
total += 1
|
||||
|
||||
try:
|
||||
if len(processed_data):
|
||||
self.api_client.update_replay_gain_values(processed_data)
|
||||
self.api_client.\
|
||||
update_replay_gain_values(processed_data)
|
||||
except Exception as e:
|
||||
self.logger.error(e)
|
||||
self.logger.debug(traceback.format_exc())
|
||||
|
@ -77,7 +80,8 @@ class ReplayGainUpdater(Thread):
|
|||
self.main()
|
||||
# Sleep for 5 minutes in case new files have been added
|
||||
except Exception, e:
|
||||
self.logger.error('ReplayGainUpdater Exception: %s', traceback.format_exc())
|
||||
self.logger.error('ReplayGainUpdater Exception: %s',
|
||||
traceback.format_exc())
|
||||
self.logger.error(e)
|
||||
time.sleep(60 * 5)
|
||||
|
||||
|
|
|
@ -42,18 +42,23 @@ class SilanAnalyzer(Thread):
|
|||
# silence detect(set default queue in and out)
|
||||
try:
|
||||
data = {}
|
||||
command = ['nice', '-n', '19', 'silan', '-b', '-f', 'JSON', full_path]
|
||||
command = ['nice', '-n', '19', 'silan', '-b', '-f', 'JSON',
|
||||
full_path]
|
||||
try:
|
||||
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
|
||||
proc = subprocess.Popen(command,
|
||||
stdout=subprocess.PIPE)
|
||||
comm = proc.communicate()
|
||||
if len(comm):
|
||||
out = comm[0].strip('\r\n')
|
||||
info = json.loads(out)
|
||||
try: data['length'] = str('{0:f}'.format(info['file duration']))
|
||||
try: data['length'] = \
|
||||
str('{0:f}'.format(info['file duration']))
|
||||
except: pass
|
||||
try: data['cuein'] = str('{0:f}'.format(info['sound'][0][0]))
|
||||
try: data['cuein'] = \
|
||||
str('{0:f}'.format(info['sound'][0][0]))
|
||||
except: pass
|
||||
try: data['cueout'] = str('{0:f}'.format(info['sound'][-1][1]))
|
||||
try: data['cueout'] = \
|
||||
str('{0:f}'.format(info['sound'][-1][1]))
|
||||
except: pass
|
||||
except Exception, e:
|
||||
self.logger.error(str(command))
|
||||
|
@ -61,7 +66,9 @@ class SilanAnalyzer(Thread):
|
|||
processed_data.append((f['id'], data))
|
||||
total += 1
|
||||
if total % 5 == 0:
|
||||
self.logger.info("Total %s / %s files has been processed.." % (total, total_files))
|
||||
self.logger.info("Total %s / %s files has been" +
|
||||
"processed..",
|
||||
total, total_files)
|
||||
except Exception, e:
|
||||
self.logger.error(e)
|
||||
self.logger.error(traceback.format_exc())
|
||||
|
@ -80,7 +87,8 @@ class SilanAnalyzer(Thread):
|
|||
self.logger.info("Running Silan analyzer")
|
||||
self.main()
|
||||
except Exception, e:
|
||||
self.logger.error('Silan Analyzer Exception: %s', traceback.format_exc())
|
||||
self.logger.error('Silan Analyzer Exception: %s',
|
||||
traceback.format_exc())
|
||||
self.logger.error(e)
|
||||
self.logger.info("Sleeping for 5...")
|
||||
time.sleep(60 * 5)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue