save audio overview of only audio

This commit is contained in:
j 2012-06-19 21:30:46 +02:00
parent 3257e362cf
commit 008b1c0d81

View file

@ -316,7 +316,7 @@ class Timelines():
self.small_tile_n = int(math.ceil(self.duration / self.small_tile_w)) self.small_tile_n = int(math.ceil(self.duration / self.small_tile_w))
self.small_tile_last_w =int(math.ceil(self.duration % self.small_tile_w)) or self.small_tile_w self.small_tile_last_w =int(math.ceil(self.duration % self.small_tile_w)) or self.small_tile_w
if self.render_antialias: if self.render_antialias or self.render_audio:
self._open_full_tile() self._open_full_tile()
if self.render_keyframes: if self.render_keyframes:
self.large_keyframes_tile_i = -1 self.large_keyframes_tile_i = -1
@ -431,12 +431,7 @@ class Timelines():
for mode in filter(lambda x: x in ['antialias', 'slitscan', 'cuts', 'data'], self.modes): for mode in filter(lambda x: x in ['antialias', 'slitscan', 'cuts', 'data'], self.modes):
self._save_tile(mode, self.large_tile_i) self._save_tile(mode, self.large_tile_i)
if self.render_antialias: if self.render_antialias:
resized = self.large_tile_image['antialias'].resize(( self._save_full_tile_image('antialias')
self.full_tile_widths[0], self.large_tile_h
), Image.ANTIALIAS)
self.full_tile_image.paste(resized, (self.full_tile_offset, 0))
self.full_tile_offset += self.full_tile_widths[0]
self.full_tile_widths = self.full_tile_widths[1:]
self.frame_i += 1 self.frame_i += 1
self.log and self.profiler.set_task('gst') self.log and self.profiler.set_task('gst')
@ -518,6 +513,8 @@ class Timelines():
is_last_tile = self.frame_i == self.frame_n - 1 is_last_tile = self.frame_i == self.frame_n - 1
if large_tile_x == self.large_tile_w - 1 or is_last_tile: if large_tile_x == self.large_tile_w - 1 or is_last_tile:
self._save_tile('audio', large_tile_i) self._save_tile('audio', large_tile_i)
if not self.render_video:
self._save_full_tile_image('audio')
if not self.render_video: if not self.render_video:
self.large_tile_i = large_tile_i self.large_tile_i = large_tile_i
@ -562,10 +559,10 @@ class Timelines():
self.full_tile_offset = 0 self.full_tile_offset = 0
self.full_tile_image = Image.new('RGB', (self.full_tile_w, self.large_tile_h)) self.full_tile_image = Image.new('RGB', (self.full_tile_w, self.large_tile_h))
def _save_full_tile(self): def _save_full_tile(self, mode):
self.log and self.profiler.set_task('_save_full_tile()') self.log and self.profiler.set_task('_save_full_tile()')
tile_file = '%stimelineantialias%dp.jpg' % ( tile_file = '%stimeline%s%dp.jpg' % (
self.tile_path, self.large_tile_h self.tile_path, mode, self.large_tile_h
) )
self.full_tile_image.save(tile_file) self.full_tile_image.save(tile_file)
if self.log: if self.log:
@ -573,14 +570,22 @@ class Timelines():
if self.render_small_tiles: if self.render_small_tiles:
resize = (self.full_tile_w, self.small_tile_h) resize = (self.full_tile_w, self.small_tile_h)
self.full_tile_image = self.full_tile_image.resize(resize, Image.ANTIALIAS) self.full_tile_image = self.full_tile_image.resize(resize, Image.ANTIALIAS)
tile_file = '%stimelineantialias%dp.jpg' % ( tile_file = '%stimeline%s%dp.jpg' % (
self.tile_path, self.small_tile_h self.tile_path, mode, self.small_tile_h
) )
self.full_tile_image.save(tile_file) self.full_tile_image.save(tile_file)
if self.log: if self.log:
print tile_file print tile_file
self.log and self.profiler.unset_task() self.log and self.profiler.unset_task()
def _save_full_tile_image(self, mode):
resized = self.large_tile_image[mode].resize((
self.full_tile_widths[0], self.large_tile_h
), Image.ANTIALIAS)
self.full_tile_image.paste(resized, (self.full_tile_offset, 0))
self.full_tile_offset += self.full_tile_widths[0]
self.full_tile_widths = self.full_tile_widths[1:]
def _save_tile(self, mode, index): def _save_tile(self, mode, index):
self.log and self.profiler.set_task('_save_tile()') self.log and self.profiler.set_task('_save_tile()')
# save large tile (or data tile) # save large tile (or data tile)
@ -647,7 +652,7 @@ class Timelines():
else: else:
if self.render_video: if self.render_video:
if self.render_antialias: if self.render_antialias:
self._save_full_tile() self._save_full_tile('antialias')
if self.cuts_path: if self.cuts_path:
# remove cuts at max_cut_len # remove cuts at max_cut_len
self.cuts = filter(lambda x: x not in self.no_cuts, self.cuts) self.cuts = filter(lambda x: x not in self.no_cuts, self.cuts)
@ -657,6 +662,8 @@ class Timelines():
f.write('[' + ', '.join(map(lambda x: '%.2f' % (x / FPS), self.cuts[1:-1])) + ']') f.write('[' + ', '.join(map(lambda x: '%.2f' % (x / FPS), self.cuts[1:-1])) + ']')
if self.render_audio: if self.render_audio:
self._render_audio(self.volume) self._render_audio(self.volume)
if not self.render_video:
self._save_full_tile('audio')
if self.log: if self.log:
if self.render_video: if self.render_video:
maximum = 0 maximum = 0