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 cache
|
||||||
import oxdb_import
|
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 *
|
from subtitles import *
|
||||||
import midentify
|
import midentify
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ class Archive(SQLObject):
|
||||||
print self.addFile(meta), f
|
print self.addFile(meta), f
|
||||||
else:
|
else:
|
||||||
print "remove", f
|
print "remove", f
|
||||||
self.removeFile({'md5sum':meta['md5sum']})
|
self.removeFile(meta['md5sum'])
|
||||||
|
|
||||||
def importFiles(self):
|
def importFiles(self):
|
||||||
stats = {'skipped': 0, 'added': 0, 'remove':0}
|
stats = {'skipped': 0, 'added': 0, 'remove':0}
|
||||||
|
@ -380,8 +380,7 @@ class ArchiveFile(SQLObject):
|
||||||
|
|
||||||
def _get_frameFolder(self):
|
def _get_frameFolder(self):
|
||||||
f = join(cache.cache_root, 'frame', self.md5sum[:4], self.md5sum)
|
f = join(cache.cache_root, 'frame', self.md5sum[:4], self.md5sum)
|
||||||
if not exists(f):
|
oxdb_makedir(f)
|
||||||
os.makedirs(f)
|
|
||||||
return f
|
return f
|
||||||
|
|
||||||
def _get_timelineFile(self):
|
def _get_timelineFile(self):
|
||||||
|
@ -431,8 +430,7 @@ class ArchiveFile(SQLObject):
|
||||||
if self.movieFile:
|
if self.movieFile:
|
||||||
return self.movieFile.extractFrame(position, img_folder)
|
return self.movieFile.extractFrame(position, img_folder)
|
||||||
movie_file = self.mini_movie_file
|
movie_file = self.mini_movie_file
|
||||||
if not exists(img_folder):
|
oxdb_makedir(img_folder)
|
||||||
os.makedirs(img_folder)
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -441,8 +439,8 @@ class ArchiveFile(SQLObject):
|
||||||
if self.movieFile:
|
if self.movieFile:
|
||||||
return self.movieFile.extractFrames(img_folder)
|
return self.movieFile.extractFrames(img_folder)
|
||||||
movie_file = self.absolutePath
|
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)
|
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):
|
||||||
|
@ -461,8 +459,8 @@ class ArchiveFile(SQLObject):
|
||||||
if exists(mini_movie_file) and not force:
|
if exists(mini_movie_file) and not force:
|
||||||
print "clip exists, skipping extraction", mini_movie_file
|
print "clip exists, skipping extraction", mini_movie_file
|
||||||
return
|
return
|
||||||
if not exists(dirname(mini_movie_file)):
|
oxdb_makedir(dirname(mini_movie_file))
|
||||||
os.makedirs(dirname(mini_movie_file))
|
|
||||||
options = ''
|
options = ''
|
||||||
options += " -ovc lavc -lavcopts vcodec=mjpeg"
|
options += " -ovc lavc -lavcopts vcodec=mjpeg"
|
||||||
options += " -af volnorm=1 -oac mp3lame -lameopts br=64:mode=3 -af resample=44100"
|
options += " -af volnorm=1 -oac mp3lame -lameopts br=64:mode=3 -af resample=44100"
|
||||||
|
@ -496,8 +494,9 @@ class ArchiveFile(SQLObject):
|
||||||
if exists(t):
|
if exists(t):
|
||||||
print "skipping, ", self.path
|
print "skipping, ", self.path
|
||||||
return
|
return
|
||||||
if not exists(dirname(t)):
|
|
||||||
os.makedirs(dirname(t))
|
oxdb_makedir(dirname(t))
|
||||||
|
|
||||||
#this fails in tg-admin shell
|
#this fails in tg-admin shell
|
||||||
#extractTimelineScript = abspath(join(dirname(__file__), "tools/extract_timeline.py"))
|
#extractTimelineScript = abspath(join(dirname(__file__), "tools/extract_timeline.py"))
|
||||||
extractTimelineScript = abspath(join(dirname(cache.cache_root), "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',
|
'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',
|
'te', 'ta', 'aa', 'ab', 'uk', 'af', 'vi', 'is', 'am', 'it', 'iw', 'vo', 'ik',
|
||||||
'ar', 'in', 'ay', 'az', 'ie', 'qu', 'st', 'tw')
|
'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