thumbnail generation on upload
git-svn-id: http://yolanda.mister-muffin.de/svn@402 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
9fed815064
commit
5ffe89f08d
2 changed files with 6 additions and 4 deletions
|
@ -8,7 +8,6 @@ class SearchController(BaseController):
|
||||||
|
|
||||||
def results(self):
|
def results(self):
|
||||||
|
|
||||||
# maybe c.query could / should be a dictionary ?
|
|
||||||
c.query = request.params['query']
|
c.query = request.params['query']
|
||||||
|
|
||||||
# c.results dummy
|
# c.results dummy
|
||||||
|
|
|
@ -109,9 +109,10 @@ class UploadController(BaseController):
|
||||||
# define stuff
|
# define stuff
|
||||||
videosource=os.path.join(config['cache.dir'], str(video.id))
|
videosource=os.path.join(config['cache.dir'], str(video.id))
|
||||||
videodestination=os.path.join(config['pylons.paths']['static_files'], "videos", 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
|
# start encoding unt snapshot threads in background
|
||||||
threading.Thread(target=self.bgencode, args=(videosource, videodestination)).start()
|
threading.Thread(target=self.bgencode, args=(videosource, videodestination, imagedestination)).start()
|
||||||
|
|
||||||
# return 'Successfully uploaded: %s'%video.query.all()
|
# return 'Successfully uploaded: %s'%video.query.all()
|
||||||
c.message = {
|
c.message = {
|
||||||
|
@ -121,7 +122,9 @@ class UploadController(BaseController):
|
||||||
c.message['text']='Your file was successfully uploaded to "%s".'%videodestination
|
c.message['text']='Your file was successfully uploaded to "%s".'%videodestination
|
||||||
return render('/xhtml/index.mako')
|
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 = encode.Encode(source,destination)
|
||||||
videoencode.run()
|
videoencode.run()
|
||||||
os.unlink(source)
|
os.unlink(source)
|
||||||
|
|
Loading…
Reference in a new issue