extractSubtitles from idx/rar pics

This commit is contained in:
j 2007-07-26 08:36:47 +00:00
parent 49fd4d082e
commit 28b6fb3cb5
2 changed files with 12 additions and 9 deletions

View file

@ -3,7 +3,7 @@
# vi:si:et:sw=2:sts=2:ts=2
from model import *
import cache
def cronDaily():
findNew()
@ -40,10 +40,13 @@ def cleanClipMovieCache():
os.remove(os.path.join(cache, d, f))
#possible fuctions:
'''
def extractSubtitles():
#look for rar / sub or vob / sub subtitles and extract them with
#tools/subtitles.py path_to_file
#import srt after
'''
extractSubtitlesScript = abspath(join(dirname(cache.cache_root), "tools/subtitles.py"))
for f in ArchiveFile.select(LIKE(ArchiveFile.q.path, '%' + '.idx')):
base = f.absolutePath.replace('.idx', '')
srtFile = f.absolutePath.replace('.idx', '.srt')
if not os.path.exists(srtFile):
cmd = 'python "%s" "%s"' % (extractSubtitlesScript, base)
os.system(cmd)
#only one subtitle at a time
return

View file

@ -48,7 +48,7 @@ class Archive(SQLObject):
socket.setdefaulttimeout(100)
url = "%s/%s?md5sum=%s" % (self.baseUrlFrontend, action, md5sum)
result = read_url(url)
print "Frontend:", result
#print "Frontend:", result['result']
socket.setdefaulttimeout(dto)
def _get_files(self):
@ -491,7 +491,7 @@ class ArchiveFile(SQLObject):
options += ' "%s"' % movie_file.replace('"', '\\"')
options += ' -o "%s"' % mini_movie_file
cmd = "mencoder %s >/dev/null 2>&1" % options
print cmd.encode('utf-8')
#print cmd.encode('utf-8')
os.system(cmd.encode('utf-8'))
def removeTimeline(self):