extract some more

This commit is contained in:
j 2007-07-13 14:30:32 +00:00
parent 37e211dfea
commit 894d0399f0

View file

@ -390,6 +390,18 @@ class ArchiveFile(SQLObject):
if exists(self.mini_movie_file): if exists(self.mini_movie_file):
os.remove(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): def _findSubtitleByStart(self, start):
if self.srt: if self.srt:
d = srt2dict(self.srt) d = srt2dict(self.srt)
@ -403,6 +415,9 @@ class ArchiveFile(SQLObject):
self.updateMeta() self.updateMeta()
self.extractClipMovie() self.extractClipMovie()
self.extractTimeline() self.extractTimeline()
#enable this later
#self.extractFrames()
#self.extractClips()
self.extracted = True self.extracted = True
def extractClip(self, inpoint, outpoint=-1, flash_folder=-1): 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(movie_file, flash_movie, inpoint, outpoint, width, height, offset = 0)
#extract_flash_ng(self.absolutePath, flash_movie, inpoint, outpoint, width, height, offset) #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): def extractFrame(self, position, img_folder=-1):
if img_folder == -1: if img_folder == -1:
img_folder = self.frameFolder img_folder = self.frameFolder
@ -435,13 +454,9 @@ class ArchiveFile(SQLObject):
position = position.replace('.', ':') position = position.replace('.', ':')
extract_frame(movie_file, position, img_folder, offset = 0, redo = False) extract_frame(movie_file, position, img_folder, offset = 0, redo = False)
def extractFrames(self, img_folder=cache.frame_cache_root): def extractFrames(self, img_folder=cache.frame_cache_root):
if self.movieFile: for p in self._startPoints():
return self.movieFile.extractFrames(img_folder) self.extractFrame(p)
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 extractClipMovie(self, force = False): def extractClipMovie(self, force = False):
if self.broken: if self.broken: