forked from 0x2620/pandora
return empty sequences if no data timeline exists
This commit is contained in:
parent
af0e0cffe8
commit
f4cbe6a114
1 changed files with 8 additions and 2 deletions
|
@ -81,13 +81,17 @@ def get_sequences(path, position=0):
|
||||||
|
|
||||||
class DataTimeline():
|
class DataTimeline():
|
||||||
fps = 25
|
fps = 25
|
||||||
|
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
file_names = filter(lambda x: 'timelinedata8p' in x, os.listdir(path))
|
file_names = filter(lambda x: 'timelinedata8p' in x, os.listdir(path))
|
||||||
file_names = sorted(file_names, key=lambda x: int(x[14:-4]))
|
file_names = sorted(file_names, key=lambda x: int(x[14:-4]))
|
||||||
file_names = map(lambda x: path + x, file_names)
|
file_names = map(lambda x: path + x, file_names)
|
||||||
self.file_names = file_names
|
self.file_names = file_names
|
||||||
self.timeline_image = Image.open(file_names[0])
|
if file_names:
|
||||||
self.timeline_width = self.timeline_image.size[0]
|
self.timeline_image = Image.open(file_names[0])
|
||||||
|
self.timeline_width = self.timeline_image.size[0]
|
||||||
|
else:
|
||||||
|
self.timeline_width = 0
|
||||||
self.current_tile = 0
|
self.current_tile = 0
|
||||||
|
|
||||||
def get_frame(self, pos):
|
def get_frame(self, pos):
|
||||||
|
@ -101,6 +105,8 @@ class DataTimeline():
|
||||||
|
|
||||||
def get_cut_sequences(stream):
|
def get_cut_sequences(stream):
|
||||||
timeline = DataTimeline(stream.timeline_prefix)
|
timeline = DataTimeline(stream.timeline_prefix)
|
||||||
|
if not time.timeline_width:
|
||||||
|
return {}
|
||||||
cuts = list(stream.cuts) + [stream.duration]
|
cuts = list(stream.cuts) + [stream.duration]
|
||||||
modes = ['color', 'shape']
|
modes = ['color', 'shape']
|
||||||
sequences = {}
|
sequences = {}
|
||||||
|
|
Loading…
Reference in a new issue