def clips_of_tub(self, tub_path):
seqs = [ int(f.split("_")[0]) for f in os.listdir(tub_path) if f.endswith('.jpg') ]
seqs.sort()
entries = ((os.stat(self.image_path(tub_path, seq))[ST_ATIME], seq) for seq in seqs)
(last_ts, seq) = next(entries)
clips = [[seq]]
for next_ts, next_seq in entries:
if next_ts - last_ts > 100: #greater than 1s apart
clips.append([next_seq])
else:
clips[-1].append(next_seq)
last_ts = next_ts
return clips
评论列表
文章目录