diff options
| author | tassaron | 2017-08-27 12:10:21 -0400 |
|---|---|---|
| committer | tassaron | 2017-08-27 12:10:21 -0400 |
| commit | 4a310ffb2870babf6774da843cad271f8a477bcc (patch) | |
| tree | e9a671c182afc46e85ccb2145dcb5ef2eb9c4870 /src/components/spectrum.py | |
| parent | e8a7b18293768497df272bb4cb64b678d57f58da (diff) | |
file logging can be turned completely off
and various changes to log levels and messages everywhere
Diffstat (limited to 'src/components/spectrum.py')
| -rw-r--r-- | src/components/spectrum.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/components/spectrum.py b/src/components/spectrum.py index 2b98dc2..77cb086 100644 --- a/src/components/spectrum.py +++ b/src/components/spectrum.py @@ -148,15 +148,22 @@ 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 process (log at %s)' % logFilename) + with open(logFilename, 'w') as logf: + logf.write(" ".join(command) + '\n\n') + with open(logFilename, 'a') as logf: + self.previewPipe = openPipe( + command, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, + stderr=logf, bufsize=10**8 + ) + else: self.previewPipe = openPipe( command, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, - stderr=logf, bufsize=10**8 + stderr=subprocess.DEVNULL, bufsize=10**8 ) byteFrame = self.previewPipe.stdout.read(self.chunkSize) closePipe(self.previewPipe) |
