diff --git a/oxdbarchive/extract.py b/oxdbarchive/extract.py index 85115da..177ee21 100644 --- a/oxdbarchive/extract.py +++ b/oxdbarchive/extract.py @@ -163,47 +163,6 @@ def extract_frame(movie_file, timestamp, img_folder, width=128, offset = 0, redo print "update the cache %s missing" % movie_file shutil.rmtree(framedir) -def extract_still(movie_file, timestamp, img_folder, width=128, offset = 0, redo = False): - import warnings - warnings.filterwarnings("ignore", "tempnam") - ext = movie_file.split('.')[-1] - if ext in ('sub', 'srt'): - print "this is not a movie file, will not try to extract frames" - return - framedir = os.tempnam() - - os.mkdir(framedir) - os.chdir(framedir) - if offset: - timestamp_in_file = shift_time(-offset, timestamp) - else: - timestamp_in_file = timestamp - if os.path.exists(movie_file): - mplayer_options = '' - mplayer_options += " '%s'" % movie_file - mplayer_options += " -ss '%s' -frames 2" % (timestamp_in_file) - mplayer_options += " -vo png " - if width > 0: - mplayer_options += " -vf scale -zoom -xy %d " % width - mplayer_options += " -ao null" - mplayer = "mplayer %s >/dev/null 2>&1" % mplayer_options - frame = os.path.join(img_folder, "%s.%s" % (timestamp.replace(':', '.'), 'png')) - if redo or not os.path.exists(frame): - print mplayer.encode('utf-8') - os.system (mplayer.encode('utf-8')) - files = os.listdir(framedir) - if files: - print "creating frame ", frame - shutil.move(os.path.join(framedir,files[-1]), frame) - if len(files)>1: - for f in files[:-2]: - print "unlink", f - os.unlink(f) - time.sleep(0.1) - else: - print "update the cache %s missing" % movie_file - shutil.rmtree(framedir) - def extract_poster_still(movie_file, png_file, inpoint): ext = movie_file.split('.')[-1] if ext in ('sub', 'srt'): diff --git a/oxdbarchive/model.py b/oxdbarchive/model.py index fd1fc5e..9691897 100644 --- a/oxdbarchive/model.py +++ b/oxdbarchive/model.py @@ -741,13 +741,13 @@ class ArchiveFile(SQLObject): return cache.loadPosterStill(self, position) def still(self, position): - still = os.path.join(self.stillFolder, "%s.%s" % (position.replace(':', '.'), 'png')) + still = os.path.join(self.stillFolder, "%s.%s" % (position.replace(':', '.'), 'jpg')) if not exists(still): oxdb_makedir(dirname(still)) movieFile = self.absolutePath if os.path.splitext(movieFile)[-1] in ('.mov', '.mpg', '.mpeg'): movieFile = self.mini_movie_file - extract_still(movieFile, position, self.stillFolder, -1) + extract_frame(movieFile, position, self.stillFolder, -1) if exists(still): return cache.loadFile(still) return ''