-fix infinite loop on invalid files

This commit is contained in:
Martin Konecny 2013-03-26 15:01:44 -04:00
parent fc6742869f
commit d79bfaaef9
1 changed files with 10 additions and 6 deletions

View File

@ -41,13 +41,17 @@ class SilanAnalyzer(Thread):
full_path = f['fp']
# silence detect(set default queue in and out)
try:
command = ['nice', '-n', '19', 'silan', '-b', '-f', 'JSON', full_path]
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
out = proc.communicate()[0].strip('\r\n')
info = json.loads(out)
data = {}
data['cuein'] = str('{0:f}'.format(info['sound'][0][0]))
data['cueout'] = str('{0:f}'.format(info['sound'][-1][1]))
command = ['nice', '-n', '19', 'silan', '-b', '-f', 'JSON', full_path]
try:
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
out = proc.communicate()[0].strip('\r\n')
info = json.loads(out)
data['cuein'] = str('{0:f}'.format(info['sound'][0][0]))
data['cueout'] = str('{0:f}'.format(info['sound'][-1][1]))
except Exception, e:
self.logger.error(str(command))
self.logger.error(e)
processed_data.append((f['id'], data))
total += 1
if total % 5 == 0: