aboutsummaryrefslogtreecommitdiff
path: root/src/components/waveform.py
diff options
context:
space:
mode:
authorBrianna2017-08-10 16:16:07 -0400
committerGitHub2017-08-10 16:16:07 -0400
commitc5a0c9b364f6d6228a3027b5668915a838c1ba95 (patch)
treef04e4117c133a539a87ffcae00d0cd66fa1517f4 /src/components/waveform.py
parent2603c639254d8ab8e87e201613d123da367cae21 (diff)
parent1c4afc96d69789f16284c067ffd7098dc7b2ca70 (diff)
Merge pull request #55 from djfun/logging
using the builtin logging module
Diffstat (limited to 'src/components/waveform.py')
-rw-r--r--src/components/waveform.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/components/waveform.py b/src/components/waveform.py
index 71cbcac..1517be2 100644
--- a/src/components/waveform.py
+++ b/src/components/waveform.py
@@ -4,6 +4,7 @@ from PyQt5.QtGui import QColor
import os
import math
import subprocess
+import logging
from component import Component
from toolkit.frame import BlankFrame, scale
@@ -13,6 +14,9 @@ from toolkit.ffmpeg import (
)
+log = logging.getLogger('AVP.Components.Waveform')
+
+
class Component(Component):
name = 'Waveform'
version = '1.0.0'
@@ -106,10 +110,16 @@ class Component(Component):
'-codec:v', 'rawvideo', '-',
'-frames:v', '1',
])
- pipe = openPipe(
- command, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
- stderr=subprocess.DEVNULL, bufsize=10**8
- )
+ 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:
+ pipe = openPipe(
+ command, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
+ stderr=logf, bufsize=10**8
+ )
byteFrame = pipe.stdout.read(self.chunkSize)
closePipe(pipe)