diff --git a/trunk/development.ini b/trunk/development.ini
index 6fad922..b4f07f9 100644
--- a/trunk/development.ini
+++ b/trunk/development.ini
@@ -19,9 +19,13 @@ port = 5000
use = egg:Yolanda
full_stack = true
cache_dir = /tmp/yolanda/data
-beaker.session.key = yolanda
+beaker.session.key = yolandav
beaker.session.secret = somesecret
+directory_videos = videos
+directory_video-stills = video-stills
+directory_video-thumbnails = thumbnails
+
# If you'd like to fine-tune the individual locations of the cache data dirs
# for the Cache data, or the Session saves, un-comment the desired settings
# here:
@@ -33,7 +37,6 @@ beaker.session.secret = somesecret
# execute malicious code after an exception is raised.
#set debug = false
-
# Logging configuration
[loggers]
keys = root, yolanda
diff --git a/trunk/yolanda/config/routing.py b/trunk/yolanda/config/routing.py
index cb93028..9889229 100644
--- a/trunk/yolanda/config/routing.py
+++ b/trunk/yolanda/config/routing.py
@@ -32,14 +32,14 @@ def make_map():
video = kargs.pop('video')
kargs['id'] = video['id']
- kargs['title'] = video['title']
+ kargs['dc_title'] = video['dc_title']
return kargs
- map.connect('video_page', 'video/:id/:title', controller='video', _filter=video_expand)
+ map.connect('video_page', 'video/:id/:dc_title', controller='video', _filter=video_expand)
# map.connect('video_file', 'video/:id.ogv', controller='video', action='file' _filter=video_expand)
- map.connect('download_page', 'download/:id/:title', controller='download', action="download")
+ map.connect('download_page', 'download/:id/:dc_title', controller='download', action="download")
# everything else
map.connect(':controller/:action/:id')
diff --git a/trunk/yolanda/controllers/search.py b/trunk/yolanda/controllers/search.py
index 2c70d05..53c6619 100644
--- a/trunk/yolanda/controllers/search.py
+++ b/trunk/yolanda/controllers/search.py
@@ -1,4 +1,21 @@
+## Yolanda, a video CMS for the web
+## Copyright (C) 2007, 2008 Nils Dagsson Moskopp, Johannes Schauer
+
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Affero General Public License as
+## published by the Free Software Foundation, either version 3 of the
+## License, or (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Affero General Public License for more details.
+
+## You should have received a copy of the GNU Affero General Public License
+## along with this program. If not, see .
+
import logging
+import os
from yolanda.lib.base import *
@@ -8,23 +25,29 @@ class SearchController(BaseController):
def results(self):
- c.query = request.params['query']
-
- # c.results dummy
- c.results = [
- {'title': 'foobar', 'id': '23' },
- {'title': 'blablupp', 'id': '42'},
- {'title': 'uiae nrdt', 'id': '555'},
- {'title': 'uiaenrtd uiaenrtd uiaenrdt', 'id': '666666666'},
- {'title': 'foobar', 'id': '23'},
- {'title': 'blablupp', 'id': '42'},
- {'title': 'James Bond drives a bulletproof Aston Martin !!!', 'id': '555'},
- {'title': 'uiaenrtd uiaenrtd uiaenrdt uiaenrtd uiaenrtd', 'id': '666666666'},
- {'title': 'foobar', 'id': '123'},
- {'title': 'blablupp', 'id': '42'},
- {'title': 'lolwtf hax !!!11', 'id': '9001'}
- ]
+ c.query = request.params['query']
+
+ raw_results = model.Video.query.filter_by(dc_title=c.query).all()
+
+ if not raw_results:
+ c.message = {
+ 'type': 'warning'
+ }
+ c.message['text']='No results for query "%s".' % c.query
+ return render('/xhtml/results.mako')
+
+ c.results = []
+
+ for result in raw_results:
+ c.results.append(
+ {
+ 'dc_title': result.dc_title,
+ 'id': result.id,
+ 'snapshot': os.path.join(config['directory_video-stills'],str(result.id)),
+ 'thumbnail': os.path.join(config['directory_video-thumbnails'],str(result.id))
+ }
+ )
return render('/xhtml/results.mako')
# return request.params['query']
- # return h.form(h.url(action='search'), method='get')
+ # return h.form(h.url(action='search'), method='get'
diff --git a/trunk/yolanda/controllers/upload.py b/trunk/yolanda/controllers/upload.py
index fc68a5c..aa0096a 100644
--- a/trunk/yolanda/controllers/upload.py
+++ b/trunk/yolanda/controllers/upload.py
@@ -1,4 +1,4 @@
-##
+## Yolanda, a video CMS for the web
## Copyright (C) 2007, 2008 Nils Dagsson Moskopp, Johannes Schauer
## This program is free software: you can redistribute it and/or modify
@@ -70,23 +70,25 @@ class UploadController(BaseController):
# TODO: enable several contributors
dc_contributor = '',
- dc_created = '',
- dc_valid = '',
- dc_available = '',
- dc_issued = '',
- dc_modified = '',
- dc_dateAccepted = '',
- dc_dateCopyrighted = '',
- dc_dateSubmitted = datetime.today().isoformat(),
+ # TODO: insert real data
+ dc_created = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
+ dc_valid = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
+ dc_available = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
+ dc_issued = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
+ dc_modified = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
+ dc_dateAccepted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
+ dc_dateCopyrighted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
+ dc_dateSubmitted = datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
dc_identifier = '',
dc_source = '',
dc_language = request.params['language'],
- dc_extent = timedelta(0), # TODO: insert videolength
+ # TODO: insert videolength
+ dc_extent = timedelta(0),
dc_spatial = request.params['spatial'],
- dc_temporal = request.params['temporal'],
+ dc_temporal = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
dc_rightsHolder = '',
@@ -108,11 +110,12 @@ 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))
+ videodestination=os.path.join(config['pylons.paths']['static_files'], config['directory_videos'], str(video.id))
+ snapshotdestination=os.path.join(config['pylons.paths']['static_files'], config['directory_video-stills'], str(video.id))
+ thumbnaildestination=os.path.join(config['pylons.paths']['static_files'], config['directory_video-thumbnails'], str(video.id))
# start encoding thread in background
- threading.Thread(target=self.bgencode, args=(videosource, videodestination, imagedestination)).start()
+ threading.Thread(target=self.bgencode, args=(videosource, videodestination, snapshotdestination, thumbnaildestination)).start()
# return 'Successfully uploaded: %s'%video.query.all()
c.message = {
@@ -122,9 +125,11 @@ class UploadController(BaseController):
c.message['text']='Your file was successfully uploaded to "%s".'%videodestination
return render('/xhtml/index.mako')
- def bgencode(self, source, destination, snapshotdestination):
+ def bgencode(self, source, destination, snapshotdestination, thumbnaildestination):
videosnapshot = snapshot.Snapshot(source).get_snapshot()
- videosnapshot.save(snapshotdestination, "JPEG")
+ videosnapshot.save(snapshotdestination, 'JPEG')
+ videosnapshot.thumbnail((300,150))
+ videosnapshot.save(thumbnaildestination, 'JPEG')
videoencode = encode.Encode(source,destination)
videoencode.run()
os.unlink(source)
diff --git a/trunk/yolanda/lib/gstreamer/snapshot.py b/trunk/yolanda/lib/gstreamer/snapshot.py
index cece703..7930c13 100644
--- a/trunk/yolanda/lib/gstreamer/snapshot.py
+++ b/trunk/yolanda/lib/gstreamer/snapshot.py
@@ -55,10 +55,9 @@ class Snapshot:
#get current buffer's capabilities
caps = buffer.get_caps ()
#we are interested in it's dimension
- h, w = caps[0]['height'], caps[0]['width']
+ height, width = caps[0]['height'], caps[0]['width']
#using PIL we grab the image in raw RGB mode from the buffer data
- im = Image.frombuffer('RGB', (w, h), buffer.data,
- 'raw', 'RGB', 0, 1)
+ im = Image.frombuffer('RGB', (width, height), buffer.data,'raw', 'RGB', 0, 1)
#here we check the standard variance of a grayscale version of the
#current frame against the BORING_IMAGE_VARIANCE
if ImageStat.Stat(ImageOps.grayscale(im)).var[0] > \
diff --git a/trunk/yolanda/lib/helpers.py b/trunk/yolanda/lib/helpers.py
index bd34ba5..74c1284 100644
--- a/trunk/yolanda/lib/helpers.py
+++ b/trunk/yolanda/lib/helpers.py
@@ -6,4 +6,4 @@ available to Controllers. This module is available to both as 'h'.
from webhelpers import *
# between 0.9.6 and 0.9.7, some things are no longer imported by default
-from routes import url_for
+from pylons.controllers.util import url_for
diff --git a/trunk/yolanda/model/entities.py b/trunk/yolanda/model/entities.py
index 9809b57..2a21ed8 100644
--- a/trunk/yolanda/model/entities.py
+++ b/trunk/yolanda/model/entities.py
@@ -23,8 +23,8 @@ class Video(Entity):
dc_dateCopyrighted = Field(DateTime)
dc_dateSubmitted = Field(DateTime)
- dc_identifier = Field(Unicode(255))
- dc_source = Field(Unicode(255))
+ dc_identifier = Field(Unicode(255)) # URI
+ dc_source = Field(Unicode(255)) # URI
dc_language = Field(Unicode(3)) # see ISO 639-3
dc_extent = Field(Interval)
diff --git a/trunk/yolanda/templates/xhtml/base.mako b/trunk/yolanda/templates/xhtml/base.mako
index f4ecdd2..e854388 100644
--- a/trunk/yolanda/templates/xhtml/base.mako
+++ b/trunk/yolanda/templates/xhtml/base.mako
@@ -8,7 +8,7 @@
Search
-