migrate to pysubtitles, remove local outdated version
This commit is contained in:
parent
2e0b0605a2
commit
3f9407c944
4 changed files with 29 additions and 210 deletions
|
|
@ -17,14 +17,13 @@ from glob import glob
|
|||
import shutil
|
||||
import socket
|
||||
|
||||
|
||||
import simplejson
|
||||
from scrapeit.utils import read_url
|
||||
import subtitles
|
||||
|
||||
import cache
|
||||
import oxdb_import
|
||||
from oxdb_utils import oxdb_title, oxdb_director, oxdb_id, oxdb_makedir
|
||||
from subtitles import *
|
||||
from extract import *
|
||||
import midentify
|
||||
|
||||
|
|
@ -412,20 +411,20 @@ class ArchiveFile(SQLObject):
|
|||
def _startPoints(self):
|
||||
inpoints = []
|
||||
if self.srt:
|
||||
d = srt2dict(self.srt)
|
||||
for s in d.values():
|
||||
inpoints.append(s['start'])
|
||||
d = subtitles.Subtitle(self.srt)
|
||||
for s in d:
|
||||
inpoints.append(s['in'])
|
||||
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 _findSubtitleByInPoint(self, inpoint):
|
||||
if self.srt:
|
||||
d = srt2dict(self.srt)
|
||||
for s in d.values():
|
||||
if s['start'] == start:
|
||||
d = subtitles.Subtitle(self.srt)
|
||||
for s in d:
|
||||
if s['in'] == inpoint:
|
||||
return s
|
||||
return None
|
||||
|
||||
|
|
@ -449,11 +448,11 @@ class ArchiveFile(SQLObject):
|
|||
height = height - height % 2
|
||||
inpoint = inpoint.replace('.', ':')
|
||||
if outpoint == -1:
|
||||
s = self._findSubtitleByStart(inpoint)
|
||||
s = self._findSubtitleByInPoint(inpoint)
|
||||
if s:
|
||||
outpoint = s['stop']
|
||||
outpoint = s['out']
|
||||
else:
|
||||
outpoint = shift_time(5000, inpoint)
|
||||
outpoint = subtitles.shiftTime(5000, inpoint)
|
||||
else:
|
||||
outpoint = outpoint.replace('.', ':')
|
||||
extract_flash(movie_file, flash_movie, inpoint, outpoint, width, height, offset = 0)
|
||||
|
|
@ -470,11 +469,11 @@ class ArchiveFile(SQLObject):
|
|||
height = height - height % 2
|
||||
inpoint = inpoint.replace('.', ':')
|
||||
if outpoint == -1:
|
||||
s = self._findSubtitleByStart(inpoint)
|
||||
s = self._findSubtitleByInPoint(inpoint)
|
||||
if s:
|
||||
outpoint = s['stop']
|
||||
outpoint = s['out']
|
||||
else:
|
||||
outpoint = shift_time(5000, inpoint)
|
||||
outpoint = subtitles.shiftTime(5000, inpoint)
|
||||
else:
|
||||
outpoint = outpoint.replace('.', ':')
|
||||
extract_ogg(movie_file, clip_movie, inpoint, outpoint, width, height, offset = 0)
|
||||
|
|
@ -585,8 +584,8 @@ class ArchiveFile(SQLObject):
|
|||
if not subtitle.absolutePath.endswith('.srt'):
|
||||
debug("this is not a subtitle %s" % subtitle.absolutePath)
|
||||
return
|
||||
movieFile.srt = loadSrt(subtitle.absolutePath)
|
||||
|
||||
movieFile.srt = subtitles.Subtitle(subtitle.absolutePath).toSrt()
|
||||
|
||||
def _set_fps(self, fps):
|
||||
fps = int(fps * 10000)
|
||||
self._SO_set_fps(fps)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue