remove just needs md5sum
This commit is contained in:
parent
4ff287b98b
commit
5a116a1be3
2 changed files with 19 additions and 12 deletions
|
@ -22,7 +22,7 @@ from scrapeit.utils import read_url
|
|||
|
||||
import cache
|
||||
import oxdb_import
|
||||
from oxdb_utils import oxdb_title, oxdb_director, oxdb_id
|
||||
from oxdb_utils import oxdb_title, oxdb_director, oxdb_id, oxdb_makedir
|
||||
from subtitles import *
|
||||
import midentify
|
||||
|
||||
|
@ -168,7 +168,7 @@ class Archive(SQLObject):
|
|||
print self.addFile(meta), f
|
||||
else:
|
||||
print "remove", f
|
||||
self.removeFile({'md5sum':meta['md5sum']})
|
||||
self.removeFile(meta['md5sum'])
|
||||
|
||||
def importFiles(self):
|
||||
stats = {'skipped': 0, 'added': 0, 'remove':0}
|
||||
|
@ -380,8 +380,7 @@ class ArchiveFile(SQLObject):
|
|||
|
||||
def _get_frameFolder(self):
|
||||
f = join(cache.cache_root, 'frame', self.md5sum[:4], self.md5sum)
|
||||
if not exists(f):
|
||||
os.makedirs(f)
|
||||
oxdb_makedir(f)
|
||||
return f
|
||||
|
||||
def _get_timelineFile(self):
|
||||
|
@ -431,8 +430,7 @@ class ArchiveFile(SQLObject):
|
|||
if self.movieFile:
|
||||
return self.movieFile.extractFrame(position, img_folder)
|
||||
movie_file = self.mini_movie_file
|
||||
if not exists(img_folder):
|
||||
os.makedirs(img_folder)
|
||||
oxdb_makedir(img_folder)
|
||||
|
||||
position = position.replace('.', ':')
|
||||
extract_frame(movie_file, position, img_folder, offset = 0, redo = False)
|
||||
|
@ -441,8 +439,8 @@ class ArchiveFile(SQLObject):
|
|||
if self.movieFile:
|
||||
return self.movieFile.extractFrames(img_folder)
|
||||
movie_file = self.absolutePath
|
||||
if not exists(img_folder):
|
||||
os.makedirs(img_folder)
|
||||
|
||||
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):
|
||||
|
@ -461,8 +459,8 @@ class ArchiveFile(SQLObject):
|
|||
if exists(mini_movie_file) and not force:
|
||||
print "clip exists, skipping extraction", mini_movie_file
|
||||
return
|
||||
if not exists(dirname(mini_movie_file)):
|
||||
os.makedirs(dirname(mini_movie_file))
|
||||
oxdb_makedir(dirname(mini_movie_file))
|
||||
|
||||
options = ''
|
||||
options += " -ovc lavc -lavcopts vcodec=mjpeg"
|
||||
options += " -af volnorm=1 -oac mp3lame -lameopts br=64:mode=3 -af resample=44100"
|
||||
|
@ -496,8 +494,9 @@ class ArchiveFile(SQLObject):
|
|||
if exists(t):
|
||||
print "skipping, ", self.path
|
||||
return
|
||||
if not exists(dirname(t)):
|
||||
os.makedirs(dirname(t))
|
||||
|
||||
oxdb_makedir(dirname(t))
|
||||
|
||||
#this fails in tg-admin shell
|
||||
#extractTimelineScript = abspath(join(dirname(__file__), "tools/extract_timeline.py"))
|
||||
extractTimelineScript = abspath(join(dirname(cache.cache_root), "tools/extract_timeline.py"))
|
||||
|
|
|
@ -208,3 +208,11 @@ languages = ('be', 'bg', 'ba', 'wo', 'bn', 'bo', 'bh', 'bi', 'ji', 'br', 'ja',
|
|||
'la', 'ln', 'lo', 'tt', 'tr', 'ts', 'lv', 'to', 'lt', 'tk', 'th', 'ti', 'tg',
|
||||
'te', 'ta', 'aa', 'ab', 'uk', 'af', 'vi', 'is', 'am', 'it', 'iw', 'vo', 'ik',
|
||||
'ar', 'in', 'ay', 'az', 'ie', 'qu', 'st', 'tw')
|
||||
|
||||
def oxdb_makedir(folder):
|
||||
if not exists(folder):
|
||||
try:
|
||||
os.makedirs(folder)
|
||||
except os.error, e:
|
||||
if e.errno != errno.EEXIST or not os.path.isdir(folder):
|
||||
raise
|
Loading…
Reference in a new issue