Close file descriptors in airtime_analyzer before forking subprocesses
This commit is contained in:
parent
dbfb2fc69b
commit
70a2190494
|
@ -26,7 +26,7 @@ class CuePointAnalyzer(Analyzer):
|
||||||
'''
|
'''
|
||||||
command = [CuePointAnalyzer.SILAN_EXECUTABLE, '-b', '-F', '0.99', '-f', 'JSON', filename]
|
command = [CuePointAnalyzer.SILAN_EXECUTABLE, '-b', '-F', '0.99', '-f', 'JSON', filename]
|
||||||
try:
|
try:
|
||||||
results_json = subprocess.check_output(command, stderr=subprocess.STDOUT)
|
results_json = subprocess.check_output(command, stderr=subprocess.STDOUT, close_fds=True)
|
||||||
silan_results = json.loads(results_json)
|
silan_results = json.loads(results_json)
|
||||||
metadata['length_seconds'] = float(silan_results['file duration'])
|
metadata['length_seconds'] = float(silan_results['file duration'])
|
||||||
# Conver the length into a formatted time string
|
# Conver the length into a formatted time string
|
||||||
|
|
|
@ -21,7 +21,7 @@ class PlayabilityAnalyzer(Analyzer):
|
||||||
'''
|
'''
|
||||||
command = [PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE, '-v', '-c', "output.dummy(audio_to_stereo(single('%s')))" % filename]
|
command = [PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE, '-v', '-c', "output.dummy(audio_to_stereo(single('%s')))" % filename]
|
||||||
try:
|
try:
|
||||||
subprocess.check_output(command, stderr=subprocess.STDOUT)
|
subprocess.check_output(command, stderr=subprocess.STDOUT, close_fds=True)
|
||||||
|
|
||||||
except OSError as e: # liquidsoap was not found
|
except OSError as e: # liquidsoap was not found
|
||||||
logging.warn("Failed to run: %s - %s. %s" % (command[0], e.strerror, "Do you have liquidsoap installed?"))
|
logging.warn("Failed to run: %s - %s. %s" % (command[0], e.strerror, "Do you have liquidsoap installed?"))
|
||||||
|
|
|
@ -19,7 +19,7 @@ class ReplayGainAnalyzer(Analyzer):
|
||||||
'''
|
'''
|
||||||
command = [ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE, '-d', filename]
|
command = [ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE, '-d', filename]
|
||||||
try:
|
try:
|
||||||
results = subprocess.check_output(command, stderr=subprocess.STDOUT)
|
results = subprocess.check_output(command, stderr=subprocess.STDOUT, close_fds=True)
|
||||||
filename_token = "%s: " % filename
|
filename_token = "%s: " % filename
|
||||||
rg_pos = results.find(filename_token, results.find("Calculating Replay Gain information")) + len(filename_token)
|
rg_pos = results.find(filename_token, results.find("Calculating Replay Gain information")) + len(filename_token)
|
||||||
db_pos = results.find(" dB", rg_pos)
|
db_pos = results.find(" dB", rg_pos)
|
||||||
|
|
Loading…
Reference in New Issue