only get sequences for audio. fix offset calculation
This commit is contained in:
parent
be7ecc4a03
commit
4dca348b6e
2 changed files with 27 additions and 27 deletions
|
@ -99,7 +99,7 @@ class DataTimeline():
|
||||||
x = frame * 8 - tile * self.timeline_width
|
x = frame * 8 - tile * self.timeline_width
|
||||||
return self.timeline_image.crop((x, 0, x + 8, 8))
|
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)
|
timeline = DataTimeline(stream.timeline_prefix)
|
||||||
cuts = list(stream.cuts) + [stream.duration]
|
cuts = list(stream.cuts) + [stream.duration]
|
||||||
modes = ['color', 'shape']
|
modes = ['color', 'shape']
|
||||||
|
@ -120,4 +120,4 @@ def get_cut_sequences(stream, position=0):
|
||||||
'out': cut,
|
'out': cut,
|
||||||
})
|
})
|
||||||
position = cut
|
position = cut
|
||||||
return sequences, position
|
return sequences
|
||||||
|
|
|
@ -13,8 +13,8 @@ def get_sequences(itemId):
|
||||||
models.Sequence.objects.filter(sort=i.sort).delete()
|
models.Sequence.objects.filter(sort=i.sort).delete()
|
||||||
position = 0
|
position = 0
|
||||||
for stream in i.streams():
|
for stream in i.streams():
|
||||||
#data, position = extract.get_sequences(stream.timeline_prefix, position)
|
if stream.file.is_video:
|
||||||
data, position = extract.get_cut_sequences(stream, position)
|
data = extract.get_cut_sequences(stream)
|
||||||
keys = None
|
keys = None
|
||||||
values = []
|
values = []
|
||||||
for mode in data:
|
for mode in data:
|
||||||
|
@ -22,8 +22,8 @@ def get_sequences(itemId):
|
||||||
sequence = {
|
sequence = {
|
||||||
'sort_id': i.sort.pk,
|
'sort_id': i.sort.pk,
|
||||||
'mode': models.Sequence.MODE[mode],
|
'mode': models.Sequence.MODE[mode],
|
||||||
'start': float('%0.03f' % s['in']),
|
'start': position + float('%0.03f' % s['in']),
|
||||||
'end': float('%0.03f' % s['out']),
|
'end': position + float('%0.03f' % s['out']),
|
||||||
'hash': models.parse_hash(s['hash'])
|
'hash': models.parse_hash(s['hash'])
|
||||||
}
|
}
|
||||||
sequence['duration'] = sequence['end'] - sequence['start']
|
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));
|
sql = "INSERT INTO sequence_sequence (%s) VALUES %s" % (keys, ', '.join(values));
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
transaction.commit_unless_managed()
|
transaction.commit_unless_managed()
|
||||||
|
position += stream.duration
|
||||||
|
|
Loading…
Reference in a new issue