aboutsummaryrefslogtreecommitdiff
path: root/src/components/waveform.py
diff options
context:
space:
mode:
authortassaron2017-08-27 12:10:21 -0400
committertassaron2017-08-27 12:10:21 -0400
commit4a310ffb2870babf6774da843cad271f8a477bcc (patch)
treee9a671c182afc46e85ccb2145dcb5ef2eb9c4870 /src/components/waveform.py
parente8a7b18293768497df272bb4cb64b678d57f58da (diff)
file logging can be turned completely off
and various changes to log levels and messages everywhere
Diffstat (limited to 'src/components/waveform.py')
-rw-r--r--src/components/waveform.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/components/waveform.py b/src/components/waveform.py
index 5c02bbf..cbfc47f 100644
--- a/src/components/waveform.py
+++ b/src/components/waveform.py
@@ -110,15 +110,21 @@ class Component(Component):
'-codec:v', 'rawvideo', '-',
'-frames:v', '1',
])
- logFilename = os.path.join(
- self.core.logDir, 'preview_%s.log' % str(self.compPos))
- log.debug('Creating ffmpeg process (log at %s)' % logFilename)
- with open(logFilename, 'w') as logf:
- logf.write(" ".join(command) + '\n\n')
- with open(logFilename, 'a') as logf:
+ if self.core.logEnabled:
+ logFilename = os.path.join(
+ self.core.logDir, 'preview_%s.log' % str(self.compPos))
+ log.debug('Creating ffmpeg log at %s', logFilename)
+ with open(logFilename, 'w') as logf:
+ logf.write(" ".join(command) + '\n\n')
+ with open(logFilename, 'a') as logf:
+ pipe = openPipe(
+ command, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
+ stderr=logf, bufsize=10**8
+ )
+ else:
pipe = openPipe(
command, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
- stderr=logf, bufsize=10**8
+ stderr=subprocess.DEVNULL, bufsize=10**8
)
byteFrame = pipe.stdout.read(self.chunkSize)
closePipe(pipe)