diff --git a/oxdbarchive/model.py b/oxdbarchive/model.py index ce1f20c..be4c074 100644 --- a/oxdbarchive/model.py +++ b/oxdbarchive/model.py @@ -390,6 +390,18 @@ class ArchiveFile(SQLObject): if exists(self.mini_movie_file): os.remove(self.mini_movie_file) + def _startPoints(self): + inpoints = [] + if self.srt: + d = srt2dict(self.srt) + for s in d.values(): + inpoints.append(s['start']) + elif self.length: + minutes = int((float(self.length) / 1000) / 60) + minute = 1000 * 60 + inpoints = [msec2time_str(m*minute) for m in range(0, minutes)] + return inpoints + def _findSubtitleByStart(self, start): if self.srt: d = srt2dict(self.srt) @@ -403,6 +415,9 @@ class ArchiveFile(SQLObject): self.updateMeta() self.extractClipMovie() self.extractTimeline() + #enable this later + #self.extractFrames() + #self.extractClips() self.extracted = True def extractClip(self, inpoint, outpoint=-1, flash_folder=-1): @@ -424,6 +439,10 @@ class ArchiveFile(SQLObject): extract_flash(movie_file, flash_movie, inpoint, outpoint, width, height, offset = 0) #extract_flash_ng(self.absolutePath, flash_movie, inpoint, outpoint, width, height, offset) + def extractClips(self, img_folder=cache.frame_cache_root): + for p in self._startPoints(): + self.extractClip(p) + def extractFrame(self, position, img_folder=-1): if img_folder == -1: img_folder = self.frameFolder @@ -435,13 +454,9 @@ class ArchiveFile(SQLObject): position = position.replace('.', ':') extract_frame(movie_file, position, img_folder, offset = 0, redo = False) - def extractFrames(self, img_folder=cache.frame_cache_root): - if self.movieFile: - return self.movieFile.extractFrames(img_folder) - movie_file = self.absolutePath - - oxdb_makedir(img_folder) - extract_subtitles(movie_file, self.srt.encode('utf-8'), img_folder, width=100, offset=self.offset) + def extractFrames(self, img_folder=cache.frame_cache_root): + for p in self._startPoints(): + self.extractFrame(p) def extractClipMovie(self, force = False): if self.broken: