extracted saves state of minimovie now, do not try to extract timeline if minimovie is not done or failed

This commit is contained in:
j 2007-12-04 15:38:34 +00:00
parent 52301794f7
commit 4830a3bc5c
2 changed files with 22 additions and 7 deletions

View file

@ -8,6 +8,7 @@ import sys
_audio_codec_map = {
'ffmp3': 'mp3',
'mad': 'mp3',
'faad': 'aac'
}
_video_codec_map = {

View file

@ -190,12 +190,12 @@ class Archive(SQLObject):
for key in ('bpp', 'size', 'length', 'date'):
meta[key] = int(float(meta[key]))
meta['date'] = datetime.fromtimestamp(meta['date'])
print self.addFile(meta), f
print self.addFile(meta), f.encode('utf-8')
stats['added'] += 1
md5sum_on_disk.append(meta['md5sum'])
for f in oxdb_files:
if oxdb_files[f]['md5sum'] not in md5sum_on_disk:
print "remove", f
print "remove", f.encode('utf-8')
self.removeFile(oxdb_files[f]['md5sum'])
stats['remove'] += 1
print stats
@ -208,6 +208,19 @@ class Archive(SQLObject):
for f in self.files:
self.notifyFrontend('add', f.md5sum)
def cleanupFrontend(self):
dto = socket.getdefaulttimeout()
socket.setdefaulttimeout(256)
data = read_url("%s/list" % self.baseUrlFrontend)
files = simplejson.loads(data)['files']
socket.setdefaulttimeout(dto)
md5sums = [str(f['md5sum']) for f in files.values()]
for md5sum in md5sums:
try:
f = ArchiveFile.byMd5sum(md5sum)
except SQLObjectNotFound:
self.notifyFrontend('remove', md5sum)
def fillFrontend(self):
dto = socket.getdefaulttimeout()
socket.setdefaulttimeout(256)
@ -429,12 +442,11 @@ class ArchiveFile(SQLObject):
def extractAll(self, force = False):
if not self.extracted or force:
self.updateMeta()
self.extractClipMovie()
self.extractTimeline()
self.extractClipMovie(force)
self.extractTimeline(force)
#enable this later
#self.extractFrames()
#self.extractClips()
self.extracted = True
def extractClip(self, inpoint, outpoint=-1, flash_folder=-1):
if flash_folder == -1:
@ -506,7 +518,9 @@ class ArchiveFile(SQLObject):
options += ' -o "%s"' % mini_movie_file
cmd = "mencoder %s >/dev/null 2>&1" % options
#print cmd.encode('utf-8')
os.system(cmd.encode('utf-8'))
r = os.system(cmd.encode('utf-8'))
if r == 0:
self.extracted = True
def removeTimeline(self):
if exists(self.timelineFile):
@ -522,7 +536,7 @@ class ArchiveFile(SQLObject):
if self.height <= 0:
return
if not exists(self.mini_movie_file):
if not (self.extracted and exists(self.mini_movie_file)):
print "mini movie missing, skipping", self.path
return