from timeside.core import *
import subprocess
-class SubProcessPipe:
+class SubProcessPipe(object):
"""Read media and stream data through a generator.
Taken from Telemeta (see http://telemeta.org)"""
self.input = self.proc.stdin
self.output = self.proc.stdout
+
class EncoderSubProcessCore(Processor):
"""Defines the main parts of the encoding tools :
paths, metadata parsing, data streaming thru system command"""
if len(__chunk) == 0:
break
yield __chunk
-
-
-
self.image.save(filename)
-class WaveformImageSimple(WaveformImage):
+class WaveformImageSimple(object):
""" Builds a PIL image representing a waveform of the audio stream.
Adds pixels iteratively thanks to the adapter providing fixed size frame buffers.
- Peaks are colored relative to the spectral centroids of each frame packet. """
+ """
def __init__(self, image_width, image_height, nframes, samplerate, fft_size, bg_color, color_scheme):
self.image_width = image_width
y1 = self.image_height * 0.5 - peaks[0] * (self.image_height - 4) * 0.5
y2 = self.image_height * 0.5 - peaks[1] * (self.image_height - 4) * 0.5
- if self.previous_y and x < self.image_width-1 and self.pixel_cursor % 2:
+ if self.previous_y and x < self.image_width-1:
if y1 < y2:
self.draw.line((x, 0, x, y1), self.line_color)
self.draw.line((x, self.image_height , x, y2), self.line_color)
# Nb of threads
# FIXME: memory leak for > 1 !
- self.threads = 1
+ self.threads = 2
class Media2Waveform(object):
for media, image in self.path_dict.iteritems():
q.put((media, image))
- print media, image
-
q.join()
logger.write_info(mess)
grapher.release()
q.task_done()
- return
if __name__ == '__main__':
if len(sys.argv) <= 2: