From 5ffe89f08d0d8c4e386016f2be717f5b0130ad7b Mon Sep 17 00:00:00 2001 From: erlehmann Date: Wed, 3 Dec 2008 04:16:23 +0000 Subject: [PATCH] thumbnail generation on upload git-svn-id: http://yolanda.mister-muffin.de/svn@402 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/yolanda/controllers/search.py | 1 - trunk/yolanda/controllers/upload.py | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/trunk/yolanda/controllers/search.py b/trunk/yolanda/controllers/search.py index facd4a3..2c70d05 100644 --- a/trunk/yolanda/controllers/search.py +++ b/trunk/yolanda/controllers/search.py @@ -8,7 +8,6 @@ class SearchController(BaseController): def results(self): - # maybe c.query could / should be a dictionary ? c.query = request.params['query'] # c.results dummy diff --git a/trunk/yolanda/controllers/upload.py b/trunk/yolanda/controllers/upload.py index 1bdd9f4..59bcda0 100644 --- a/trunk/yolanda/controllers/upload.py +++ b/trunk/yolanda/controllers/upload.py @@ -109,9 +109,10 @@ class UploadController(BaseController): # define stuff videosource=os.path.join(config['cache.dir'], str(video.id)) videodestination=os.path.join(config['pylons.paths']['static_files'], "videos", str(video.id)) + imagedestination=os.path.join(config['pylons.paths']['static_files'], "video-stills", str(video.id)) - # start encoding in background - threading.Thread(target=self.bgencode, args=(videosource, videodestination)).start() + # start encoding unt snapshot threads in background + threading.Thread(target=self.bgencode, args=(videosource, videodestination, imagedestination)).start() # return 'Successfully uploaded: %s'%video.query.all() c.message = { @@ -121,7 +122,9 @@ class UploadController(BaseController): c.message['text']='Your file was successfully uploaded to "%s".'%videodestination return render('/xhtml/index.mako') - def bgencode(self, source, destination): + def bgencode(self, source, destination, snapshotdestination): + videosnapshot = snapshot.Snapshot(source).get_snapshot() + videosnapshot.save(snapshotdestination, "JPEG") videoencode = encode.Encode(source,destination) videoencode.run() os.unlink(source)