only get sequences for audio. fix offset calculation

This commit is contained in:
j 2014-04-11 12:05:57 +00:00
parent be7ecc4a03
commit 4dca348b6e
2 changed files with 27 additions and 27 deletions

View file

@ -99,7 +99,7 @@ class DataTimeline():
x = frame * 8 - tile * self.timeline_width
return self.timeline_image.crop((x, 0, x + 8, 8))
def get_cut_sequences(stream, position=0):
def get_cut_sequences(stream):
timeline = DataTimeline(stream.timeline_prefix)
cuts = list(stream.cuts) + [stream.duration]
modes = ['color', 'shape']
@ -120,4 +120,4 @@ def get_cut_sequences(stream, position=0):
'out': cut,
})
position = cut
return sequences, position
return sequences

View file

@ -13,8 +13,8 @@ def get_sequences(itemId):
models.Sequence.objects.filter(sort=i.sort).delete()
position = 0
for stream in i.streams():
#data, position = extract.get_sequences(stream.timeline_prefix, position)
data, position = extract.get_cut_sequences(stream, position)
if stream.file.is_video:
data = extract.get_cut_sequences(stream)
keys = None
values = []
for mode in data:
@ -22,8 +22,8 @@ def get_sequences(itemId):
sequence = {
'sort_id': i.sort.pk,
'mode': models.Sequence.MODE[mode],
'start': float('%0.03f' % s['in']),
'end': float('%0.03f' % s['out']),
'start': position + float('%0.03f' % s['in']),
'end': position + float('%0.03f' % s['out']),
'hash': models.parse_hash(s['hash'])
}
sequence['duration'] = sequence['end'] - sequence['start']
@ -37,4 +37,4 @@ def get_sequences(itemId):
sql = "INSERT INTO sequence_sequence (%s) VALUES %s" % (keys, ', '.join(values));
cursor.execute(sql)
transaction.commit_unless_managed()
position += stream.duration