[xiph-commits] r3206 - / arkaiv arkaiv/trunk arkaiv/trunk/arkaiv
arkaiv/trunk/arkaiv/config arkaiv/trunk/arkaiv/controllers
arkaiv/trunk/arkaiv/lib arkaiv/trunk/arkaiv/model
arkaiv/trunk/arkaiv/public arkaiv/trunk/arkaiv/public/images
arkaiv/trunk/arkaiv/templates arkaiv/trunk/arkaiv/tests
arkaiv/trunk/arkaiv/tests/functional
arkaiv/trunk/arkaiv.egg-info arkaiv/trunk/data
arkaiv/trunk/data/templates arkaiv/trunk/docs arkaiv/trunk/ez_setup
dcrowdy at svn.annodex.net
dcrowdy at svn.annodex.net
Tue Aug 28 18:05:37 PDT 2007
Author: dcrowdy
Date: 2007-08-28 18:05:37 -0700 (Tue, 28 Aug 2007)
New Revision: 3206
Added:
arkaiv/
arkaiv/trunk/
arkaiv/trunk/COPYING
arkaiv/trunk/README.txt
arkaiv/trunk/TODO
arkaiv/trunk/arkaiv.egg-info/
arkaiv/trunk/arkaiv.egg-info/PKG-INFO
arkaiv/trunk/arkaiv.egg-info/SOURCES.txt
arkaiv/trunk/arkaiv.egg-info/dependency_links.txt
arkaiv/trunk/arkaiv.egg-info/entry_points.txt
arkaiv/trunk/arkaiv.egg-info/paste_deploy_config.ini_tmpl
arkaiv/trunk/arkaiv.egg-info/paster_plugins.txt
arkaiv/trunk/arkaiv.egg-info/requires.txt
arkaiv/trunk/arkaiv.egg-info/top_level.txt
arkaiv/trunk/arkaiv/
arkaiv/trunk/arkaiv/__init__.py
arkaiv/trunk/arkaiv/__init__.pyc
arkaiv/trunk/arkaiv/config/
arkaiv/trunk/arkaiv/config/.middleware.py.swp
arkaiv/trunk/arkaiv/config/__init__.py
arkaiv/trunk/arkaiv/config/__init__.pyc
arkaiv/trunk/arkaiv/config/environment.py
arkaiv/trunk/arkaiv/config/environment.pyc
arkaiv/trunk/arkaiv/config/middleware.py
arkaiv/trunk/arkaiv/config/middleware.pyc
arkaiv/trunk/arkaiv/config/routing.py
arkaiv/trunk/arkaiv/config/routing.pyc
arkaiv/trunk/arkaiv/controllers/
arkaiv/trunk/arkaiv/controllers/__init__.py
arkaiv/trunk/arkaiv/controllers/__init__.pyc
arkaiv/trunk/arkaiv/controllers/error.py
arkaiv/trunk/arkaiv/controllers/error.pyc
arkaiv/trunk/arkaiv/controllers/page.py
arkaiv/trunk/arkaiv/controllers/page.pyc
arkaiv/trunk/arkaiv/controllers/play.py
arkaiv/trunk/arkaiv/controllers/template.py
arkaiv/trunk/arkaiv/lib/
arkaiv/trunk/arkaiv/lib/__init__.py
arkaiv/trunk/arkaiv/lib/__init__.pyc
arkaiv/trunk/arkaiv/lib/app_globals.py
arkaiv/trunk/arkaiv/lib/app_globals.pyc
arkaiv/trunk/arkaiv/lib/base.py
arkaiv/trunk/arkaiv/lib/base.pyc
arkaiv/trunk/arkaiv/lib/helpers.py
arkaiv/trunk/arkaiv/lib/helpers.pyc
arkaiv/trunk/arkaiv/model/
arkaiv/trunk/arkaiv/model/__init__.py
arkaiv/trunk/arkaiv/model/__init__.py.old
arkaiv/trunk/arkaiv/model/__init__.pyc
arkaiv/trunk/arkaiv/model/cmmlparser.py
arkaiv/trunk/arkaiv/model/cmmlparser.pyc
arkaiv/trunk/arkaiv/model/oggzinfo.py
arkaiv/trunk/arkaiv/model/oggzinfo.pyc
arkaiv/trunk/arkaiv/public/
arkaiv/trunk/arkaiv/public/images/
arkaiv/trunk/arkaiv/public/images/blank.png
arkaiv/trunk/arkaiv/public/index.html
arkaiv/trunk/arkaiv/public/quick.css
arkaiv/trunk/arkaiv/templates/
arkaiv/trunk/arkaiv/templates/addannodexform.mak
arkaiv/trunk/arkaiv/templates/addform.mak
arkaiv/trunk/arkaiv/templates/autohandler
arkaiv/trunk/arkaiv/templates/collectionexpanded.mak
arkaiv/trunk/arkaiv/templates/collections.mak
arkaiv/trunk/arkaiv/templates/confirmadd.mak
arkaiv/trunk/arkaiv/templates/displayitem.mak
arkaiv/trunk/arkaiv/templates/mainpage.mak
arkaiv/trunk/arkaiv/templates/quick.css
arkaiv/trunk/arkaiv/templates/search.mak
arkaiv/trunk/arkaiv/templates/searchresults.mak
arkaiv/trunk/arkaiv/templates/serverinfo.mak
arkaiv/trunk/arkaiv/tests/
arkaiv/trunk/arkaiv/tests/__init__.py
arkaiv/trunk/arkaiv/tests/functional/
arkaiv/trunk/arkaiv/tests/functional/__init__.py
arkaiv/trunk/arkaiv/tests/functional/test_play.py
arkaiv/trunk/arkaiv/tests/test_models.py
arkaiv/trunk/arkaiv/websetup.py
arkaiv/trunk/arkaiv/websetup.pyc
arkaiv/trunk/data/
arkaiv/trunk/data/templates/
arkaiv/trunk/data/templates/addannodexform.mak.py
arkaiv/trunk/data/templates/addannodexform.mak.pyc
arkaiv/trunk/data/templates/addform.mak.py
arkaiv/trunk/data/templates/addform.mak.pyc
arkaiv/trunk/data/templates/autohandler.py
arkaiv/trunk/data/templates/autohandler.pyc
arkaiv/trunk/data/templates/collectionexpanded.mak.py
arkaiv/trunk/data/templates/collectionexpanded.mak.pyc
arkaiv/trunk/data/templates/collections.mak.py
arkaiv/trunk/data/templates/collections.mak.pyc
arkaiv/trunk/data/templates/confirmadd.mak.py
arkaiv/trunk/data/templates/confirmadd.mak.pyc
arkaiv/trunk/data/templates/displayitem.mak.py
arkaiv/trunk/data/templates/displayitem.mak.pyc
arkaiv/trunk/data/templates/mainpage.mak.py
arkaiv/trunk/data/templates/mainpage.mak.pyc
arkaiv/trunk/development.ini
arkaiv/trunk/docs/
arkaiv/trunk/docs/index.txt
arkaiv/trunk/ez_setup/
arkaiv/trunk/ez_setup/README.txt
arkaiv/trunk/ez_setup/__init__.py
arkaiv/trunk/ez_setup/__init__.pyc
arkaiv/trunk/production.ini
arkaiv/trunk/setup.cfg
arkaiv/trunk/setup.py
Log:
Initial import.
Added: arkaiv/trunk/COPYING
===================================================================
--- arkaiv/trunk/COPYING (rev 0)
+++ arkaiv/trunk/COPYING 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,30 @@
+Copyright (c) 2007, Denis Crowdy
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of Denis Crowdy nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
Added: arkaiv/trunk/README.txt
===================================================================
--- arkaiv/trunk/README.txt (rev 0)
+++ arkaiv/trunk/README.txt 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,102 @@
+REQUIREMENTS:
+
+The python build tools for your distribution.
+python-lxml
+sqlite3
+
+Recent annodex libraries - including python-annodex and mod_annodex for apache
+- see http://www.annodex.net
+
+
+Pylons 0.9.6
+AuthKit 0.3.0pre5
+SQLAlchemy 0.3.10
+
+
+All things pylons can be found at: http://pylonshq.com/ and info about
+installation is at
+http://wiki.pylonshq.com/display/pylonsdocs/Installing+Pylons.
+
+The best way to install these is using the easy_install script. Note that I
+haven't tested the app with later versions of these.
+
+NOTE: This application currently works with SQLAlchemy 0.3. 0.4 is slated to
+be released soon, but has some significant changes to it. I doubt this
+application will work at all with 0.4, but I will upgrade it eventually.
+
+
+INSTALLATION
+
+Unpack the tarball, enter the directory, and edit production.ini to suit your
+environment. At the moment the media files are kept in /var/www/arkaiv, so
+you'll need to make sure that directory exists, and that you have write
+permissions on it (or whatever location you choose). At the moment the
+approach is to use the "paster" server rather than apache, but apparently using
+Apache and the fastcgi module is possible.
+
+Then run:
+
+paster setup-app production.ini
+
+and to serve it:
+
+paster serve --reload production.ini
+
+Point your browser at http://localhost:5000/page/mainpage
+
+At the moment, very basic authorisation is built in - with the user/password
+info stored in production.ini on the "authkit.users.setup" line.
+
+GENERAL INFO
+
+The application currently runs from wherever you have the code and run the
+paster server. The media files are copied to /var/www/arkaiv (or wherever you
+choose) and are served by Apache using mod_annodex. The media directory will
+contain .ogg files (the source media) and .cmml files with the same basename.
+The application makes a request for a .anx file, and mod_annodex streams
+annodex media with annotations from the cmml file.
+
+In the particular approach I have taken here, the sql database is really only
+used for searching - the information is mirrored in the cmml files. There is
+an obvius disadvantage compared to cmmlwiki here in that the database could get
+out of sync with the cmml, but there is the advantage that an archive can be
+lifted by simply moving the cmml and ogg files, then pointing a new instance of
+the application at it.
+
+There is a script to import data from a directory - see page.py in the
+controllers directory.
+
+=========================================================================
+These are the generic instructions as to how it is to work, but doesn't work for me...
+Installation and Setup
+======================
+
+Install ``arkaiv`` using easy_install::
+
+ easy_install arkaiv
+
+Make a config file as follows::
+
+ paster make-config arkaiv config.ini
+
+Tweak the config file as appropriate and then setup the application::
+
+ paster setup-app config.ini
+
+Then you are ready to go.
+
+Authors
+=======
+
+Denis Crowdy (Denis.Crowdy at mq.edu.au), Macquarie University.
+
+The original idea for this was suggested by Shane Stephens - I took it on out
+of interest and it became useful.
+
+Parts of the code in this distribution are modifications and paraphrasings of
+cmmlwiki code released under the BSD license by CSIRO Australia.
+
+The code in this distribution is released under the new BSD license, detailed
+in the file "COPYING".
+
+
Added: arkaiv/trunk/TODO
===================================================================
--- arkaiv/trunk/TODO (rev 0)
+++ arkaiv/trunk/TODO 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,57 @@
+TODO
+
+Better screen layout in the main display page needed
+
+Clips should have an image generated for the link display
+
+Just been at a coding gathering at Silvia Pfeiffer's house, and Marcin Lubonski
+suggested it'd be good to be able to locally annotate remote media. A feature
+well worth considering. The idea of leaving the media files in their original
+location, and just modifying cmml files with the www directory is a great one.
+
+The anxparser (to be cmmlparser) should have the ELementTree and document root
+as attributes of the instance of the class - ridiculous repetition going on at
+the moment.
+
+In the model, sometimes a dictionary is being returned, sometimes actual
+database objects... Should probably decide on one approach and be consistent.
+
+
+
+DONE
+
+Mon Aug 27 11:09:20 EST 2007
+
+Should really rename anxParser to cmmlParser, as that is what it is...
+
+Sat Aug 25 10:05:09 EST 2007
+
+Shoud be able to edit the item title - question is whether it should be the
+same as the head title.
+
+Need to fix the edit head section - not working on the cmml file at all at the
+moment.
+
+The cmmlParser should have a file as one of its attributes - otherwise why have
+it as a separate class? Quite a bit of cleaning up to do with functions that
+pass a cmmlfile name variable into functions of that class.
+
+Fri Aug 24 12:04:05 EST 2007
+
+The local dir import function needs to have the meta tag syncing ability added
+to it - ie get it in line with the add media function.
+
+Thu Aug 23 09:40:06 EST 2007
+Fix the clip annotation function, so that the cmml source is parsed and
+modified.
+
+When adding a head meta tag - no id is given; need to sync that up too.
+
+General policy notes
+====================
+
+When we display an item, are we taking data just from the database or from the
+cmml file? Given that in this particular model, the database is really used as
+a cache for searching purposes, probably best to grab data from the cmml file.
+That's a to do to clean up the displayiten function in page.py
+
Added: arkaiv/trunk/arkaiv/__init__.py
===================================================================
--- arkaiv/trunk/arkaiv/__init__.py (rev 0)
+++ arkaiv/trunk/arkaiv/__init__.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,5 @@
+"""arkaiv
+
+This file loads the finished app from arkaiv.config.middleware.
+"""
+from arkaiv.config.middleware import make_app
Added: arkaiv/trunk/arkaiv/__init__.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/__init__.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/config/.middleware.py.swp
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/config/.middleware.py.swp
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/config/__init__.py
===================================================================
Added: arkaiv/trunk/arkaiv/config/__init__.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/config/__init__.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/config/environment.py
===================================================================
--- arkaiv/trunk/arkaiv/config/environment.py (rev 0)
+++ arkaiv/trunk/arkaiv/config/environment.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,31 @@
+"""Pylons environment configuration"""
+import os
+
+from pylons import config
+
+from arkaiv.config.routing import make_map
+import arkaiv.lib.app_globals as app_globals
+import arkaiv.lib.helpers
+
+def load_environment(global_conf, app_conf):
+ """Configure the Pylons environment via the pylons.config object"""
+ # Pylons paths
+ root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ paths = dict(root=root,
+ controllers=os.path.join(root, 'controllers'),
+ static_files=os.path.join(root, 'public'),
+ templates=[os.path.join(root, 'templates')])
+
+ # Initialize config with the basic options
+ config.init_app(global_conf, app_conf, package='arkaiv',
+ template_engine='mako', paths=paths)
+
+ config['pylons.g'] = app_globals.Globals()
+ config['pylons.h'] = arkaiv.lib.helpers
+ config['routes.map'] = make_map()
+
+ # Customize templating options via this variable
+ tmpl_options = config['buffet.template_options']
+
+ # CONFIGURATION OPTIONS HERE (note: all config options will override any
+ # Pylons config options)
Added: arkaiv/trunk/arkaiv/config/environment.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/config/environment.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/config/middleware.py
===================================================================
--- arkaiv/trunk/arkaiv/config/middleware.py (rev 0)
+++ arkaiv/trunk/arkaiv/config/middleware.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,58 @@
+"""Pylons middleware initialization"""
+from paste.cascade import Cascade
+from paste.registry import RegistryManager
+from paste.urlparser import StaticURLParser
+from paste.deploy.converters import asbool
+
+from pylons import config
+from pylons.error import error_template
+from pylons.middleware import error_mapper, ErrorDocuments, ErrorHandler, \
+ StaticJavascripts
+from pylons.wsgiapp import PylonsApp
+
+from arkaiv.config.environment import load_environment
+
+def make_app(global_conf, full_stack=True, **app_conf):
+ """Create a Pylons WSGI application and return it
+
+ `global_conf`
+ The inherited configuration for this application. Normally from the
+ [DEFAULT] section of the Paste ini file.
+
+ `full_stack`
+ Whether or not this application provides a full WSGI stack (by default,
+ meaning it handles its own exceptions and errors). Disable full_stack
+ when this application is "managed" by another WSGI middleware.
+
+ `app_conf`
+ The application's local configuration. Normally specified in the
+ [app:<name>] section of the Paste ini file (where <name> defaults to
+ main).
+ """
+ # Configure the Pylons environment
+ load_environment(global_conf, app_conf)
+
+ # The Pylons WSGI app
+ app = PylonsApp()
+
+ # CUSTOM MIDDLEWARE HERE (filtered by the error handling middlewares)
+ import authkit.authenticate
+ app = authkit.authenticate.middleware(app, config_paste=app_conf)
+
+ if asbool(full_stack):
+ # Handle Python exceptions
+ app = ErrorHandler(app, global_conf, error_template=error_template,
+ **config['pylons.errorware'])
+
+ # Display error documents for 401, 403, 404 status codes (and 500 when
+ # debug is disabled)
+ app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf)
+
+ # Establish the Registry for this application
+ app = RegistryManager(app)
+
+ # Static files
+ javascripts_app = StaticJavascripts()
+ static_app = StaticURLParser(config['pylons.paths']['static_files'])
+ app = Cascade([static_app, javascripts_app, app])
+ return app
Added: arkaiv/trunk/arkaiv/config/middleware.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/config/middleware.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/config/routing.py
===================================================================
--- arkaiv/trunk/arkaiv/config/routing.py (rev 0)
+++ arkaiv/trunk/arkaiv/config/routing.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,27 @@
+"""Routes configuration
+
+The more specific and detailed routes should be defined first so they may take
+precedent over the more generic routes. For more information refer to the
+routes manual at http://routes.groovie.org/docs/
+"""
+from pylons import config
+from routes import Mapper
+
+def make_map():
+ """Create, configure and return the routes Mapper"""
+ map = Mapper(directory=config['pylons.paths']['controllers'],
+ always_scan=config['debug'])
+
+ # The ErrorController route (handles 404/500 error pages); it should likely
+ # stay at the top, ensuring it can always be resolved
+ map.connect('error/:action/:id', controller='error')
+
+ # CUSTOM ROUTES HERE
+
+# map.connect('playit', '/play/playit/:filetoplay', controller='play', action='playit', filetoplay=['blank'])
+ map.connect(':controller/:action')
+ #map.connect(':controller/:action/:id')
+ #map.connect('*url', controller='template', action='view')
+
+ return map
+
Added: arkaiv/trunk/arkaiv/config/routing.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/config/routing.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/controllers/__init__.py
===================================================================
Added: arkaiv/trunk/arkaiv/controllers/__init__.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/controllers/__init__.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/controllers/error.py
===================================================================
--- arkaiv/trunk/arkaiv/controllers/error.py (rev 0)
+++ arkaiv/trunk/arkaiv/controllers/error.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,39 @@
+import os.path
+
+import paste.fileapp
+from pylons.middleware import error_document_template, media_path
+
+from arkaiv.lib.base import *
+
+class ErrorController(BaseController):
+ """Generates error documents as and when they are required.
+
+ The ErrorDocuments middleware forwards to ErrorController when error
+ related status codes are returned from the application.
+
+ This behaviour can be altered by changing the parameters to the
+ ErrorDocuments middleware in your config/middleware.py file.
+ """
+
+ def document(self):
+ """Render the error document"""
+ page = error_document_template % \
+ dict(prefix=request.environ.get('SCRIPT_NAME', ''),
+ code=request.params.get('code', ''),
+ message=request.params.get('message', ''))
+ return page
+
+ def img(self, id):
+ """Serve Pylons' stock images"""
+ return self._serve_file(os.path.join(media_path, 'img', id))
+
+ def style(self, id):
+ """Serve Pylons' stock stylesheets"""
+ return self._serve_file(os.path.join(media_path, 'style', id))
+
+ def _serve_file(self, path):
+ """Call Paste's FileApp (a WSGI application) to serve the file at the
+ specified path
+ """
+ fapp = paste.fileapp.FileApp(path)
+ return fapp(request.environ, self.start_response)
Added: arkaiv/trunk/arkaiv/controllers/error.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/controllers/error.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/controllers/page.py
===================================================================
--- arkaiv/trunk/arkaiv/controllers/page.py (rev 0)
+++ arkaiv/trunk/arkaiv/controllers/page.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,494 @@
+# Copyright (C) 2007 Denis Crowdy, Macquarie University, Australia
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution.
+#
+# This software consists of voluntary contributions made by many
+# individuals. For exact contribution history, see the revision
+# history and logs.
+#
+# Author: Denis Crowdy <Denis.Crowdy at mq.edu.au>
+
+import os
+import os.path
+import shutil
+import annodex
+import logging
+from string import split
+from socket import *
+from arkaiv.controllers import *
+from arkaiv.lib.base import *
+from paste.deploy import CONFIG
+from authkit.permissions import NotAuthenticatedError
+from pylons import config
+from arkaiv.model.oggzinfo import OggzInfo
+#from arkaiv.model.anxparser import anxParser
+from arkaiv.model.cmmlparser import cmmlParser
+
+log = logging.getLogger(__name__)
+
+archive_loc = config['archive_loc']
+path_base = config['media_path_base']
+
+myhostname = gethostname()
+url_base = "http://" + myhostname + ":5000/"
+media_url_base = "http://" + myhostname + "/"
+
+class PageController(BaseController):
+
+# def index(self):
+# return 'Hello World'
+
+ def serverinfo(self):
+ import cgi
+ import pprint
+ c.pretty_environ = cgi.escape(pprint.pformat(request.environ))
+ c.name = 'Check it out...'
+ return render('/serverinfo.mak')
+
+ def mainpage(self):
+ c.items = model.getallitems()
+ return render('/mainpage.mak')
+
+ def collections(self):
+ c.collections = model.getcollections()
+ return render('/collections.mak')
+
+ def displayadd(self):
+ # Get the list of collections
+ collectionlist = model.getcollections()
+ # Wrap the names in <option> tags for the h.select webhelper
+ c.collectioninfo = ""
+ for collection in collectionlist:
+ c.collectioninfo = c.collectioninfo + "<option>" + collection.name + "</option>"
+
+ return render('/addform.mak')
+
+# def addmedia(self):
+# # Not used anymore?
+# if not request.environ.has_key('REMOTE_USER'):
+# raise NotAuthenticatedError('Not Authenticated')
+# else:
+# newitemname = request.params['itemname']
+#
+# # copy file to the media directory
+# curr_dir = os.getcwd() # FIXME - should be able to set from a config file
+# media_dir = os.path.join (curr_dir, "arkaiv/public/media")
+# #print media_dir
+# media_upload_dir = os.path.join (media_dir, newitemname)
+# #print media_upload_dir
+#
+# if (not os.path.exists (media_upload_dir)):
+# os.makedirs (media_upload_dir, mode=0755)
+#
+# myfile = request.POST['myfile']
+# permanent_file = open(os.path.join(media_upload_dir,
+# myfile.filename), 'w')
+#
+# shutil.copyfileobj(myfile.file, permanent_file)
+# myfile.file.close()
+# permanent_file.close()
+# sourcename = os.path.join(media_upload_dir, myfile.filename)
+#
+# # then add its name to the source database
+# headinfo = {}
+# headinfo['itemid']= model.addsource(newitemname, sourcename)
+# headinfo['id'] = request.params['headid']
+# headinfo['title'] = request.params['headtitle']
+# model.addhead(headinfo)
+# # And add the collection info:
+# collection = request.params['collection']
+# model.additemtocollection(headinfo['itemid'], collection)
+#
+# return render('/confirmadd.mak')
+
+ def displaycollection(self):
+ collid = request.params['id']
+ c.collname = request.params['name']
+ c.items = model.getitemsincollection(collid)
+ return render('/collectionexpanded.mak')
+
+ def addannodexform(self):
+ collectionlist = model.getcollections()
+ c.collectioninfo = ""
+ for collection in collectionlist:
+ c.collectioninfo = c.collectioninfo + "<option>" + collection.name + "</option>"
+
+ return render('/addannodexform.mak')
+
+ def addannodexindirform(self):
+ collectionlist = model.getcollections()
+ c.collectioninfo = ""
+ for collection in collectionlist:
+ print collection.name
+ c.collectioninfo = c.collectioninfo + "<option>" + collection.name + "</option>"
+
+ return render('/addannodexindirform.mak')
+
+ def addcollection(self):
+ model.addnewcollection(request.params['newcollection'])
+ c.collections = model.getcollections()
+ return render('/collections.mak')
+
+ def displayitem(self):
+
+ itemid = request.params['id']
+ toedit = request.params['edit']
+ try:
+ c.playclip = request.params['playclip']
+ except:
+ c.playclip = ""
+
+ if toedit == "yes":
+ if not request.environ.has_key('REMOTE_USER'):
+ raise NotAuthenticatedError('Not Authenticated')
+
+ c.itemid = itemid
+ c.itemname = model.getitemname(itemid)
+ cmmlfile = model.getitemcmmlfile(itemid)
+ # get clip information
+ c.cliplist = model.getclipinfoforitem(itemid)
+ # get the head information now
+ c.headdict = model.getheadinfoforitem(itemid)
+ # And now meta info - a list of dicts
+
+ # FIXME - this should be just a list of the meta objects - why return a
+ # dict?
+
+ c.metalist = model.getmetainfoforhead(c.headdict['ixh'])
+ c.source = model.getsourcesforitem(itemid)
+ sourcedict = {}
+ oggsource = model.getsourcepath(c.source)
+
+ # convert path to a useful url for the web server
+ urlpath = split(cmmlfile, path_base)
+ # Now split off the extension
+ urlpath = os.path.splitext(urlpath[1])[0]
+ url = media_url_base + urlpath + ".anx"
+ if c.playclip=="":
+ sourcedict['urlpath'] = url
+ else:
+ sourcedict['urlpath'] = url + "?id=" + c.playclip
+
+ # now get some source info:
+ o = OggzInfo(oggsource)
+ sourcedict['duration'] = o.duration()
+ sourcedict['bitrate'] = o.bitrate()
+ sourcedict['resolution'] = o.resolution()
+ sourcedict['framerate'] = o.framerate()
+ sourcedict['audio'] = o.audio()
+ if (o.has_video()):
+ sourcedict['has_video'] = "Yes"
+ else:
+ sourcedict['has_video'] = "No"
+
+ if (o.has_audio()):
+ sourcedict['has_audio'] = "Yes"
+ else:
+ sourcedict['has_audio'] = "No"
+ c.sourcedict = sourcedict
+
+ return render('/displayitem.mak')
+
+ def edititemname(self):
+ """ Called from the Ajax in place editor
+
+ returns the item name
+ """
+ text = request.params['myparam']
+ itemid = request.params['itemid']
+
+ # change this element in the database
+ model.edititemname(itemid, text)
+
+ # Item title is not in the cmml file - although I guess it could be
+ # linked? On import, the item title is the same as the head title
+
+ # parser = anxParser()
+ # cmmlfilename = model.getitemcmmlfile(itemid)
+ # parser.setcmmlfilename(cmmlfilename)
+
+ return text
+
+ def editheadinfo(self):
+ headinfo = {}
+ headinfo['itemid'] = request.params['itemid']
+ headinfo['id'] = request.params['headid']
+ headinfo['title'] = request.params['headtitle']
+ model.edithead(headinfo)
+
+ parser = cmmlParser()
+ cmmlfilename = model.getitemcmmlfile(headinfo['itemid'])
+ parser.setcmmlfilename(cmmlfilename)
+ parser.edithead(headinfo['id'], headinfo['title'])
+ # Assume that if we get here we have the OK to edit...
+ redirect_to(action='displayitem', id=headinfo['itemid'], edit="yes")
+
+ def addmetainfo(self):
+ metadict = {}
+ metadict['headindex'] = request.params['headindex']
+ metadict['itemid'] = request.params['itemid']
+ metadict['id'] = request.params['metaid']
+ metadict['name'] = request.params['metaname']
+ metadict['content'] = request.params['metacontent']
+ metadict['scheme'] = request.params['metascheme']
+ # pass a dict in to the model
+ meta = model.addmeta(metadict)
+
+ model.syncmetaid(meta.ixm)
+ cmmlfile = model.getitemcmmlfile(metadict['itemid'])
+ parser = cmmlParser()
+ parser.setcmmlfilename(cmmlfile)
+ parser.addmetaitem(metadict)
+ # add this to the cmml file
+ redirect_to(action='displayitem', id=metadict['itemid'], edit="yes")
+
+ def addclip(self):
+ clip = {}
+ clip['starttime'] = int(request.params['starttime'])
+ clip['itemid'] = request.params['itemid']
+ clip['a_text'] = request.params['a_text']
+ clip['id'] = request.params['id']
+ clip['a_href'] = request.params['a_href']
+ clip['img_src'] = request.params['img_src']
+ clip['desc'] = request.params['desc']
+ model.addclip(clip)
+ # Now the same information added to the cmml file
+ # Clips need to be in temporal order so redo the whole lot
+ # Get a list of clip dictionary objects
+ cmmlfile = model.getitemcmmlfile(clip['itemid'])
+ cliplist = model.getclipinfoforitem(clip['itemid'])
+ parser = cmmlParser()
+ parser.addclipstocmmlfile(cmmlfile, cliplist)
+ redirect_to(action='displayitem', id=clip['itemid'], edit="yes")
+
+ def deleteclip(self):
+ clipid = request.params['clipid']
+ itemid = request.params['itemid']
+ model.deleteclip(clipid)
+ # Now update the cmml file
+ cmmlfile = model.getitemcmmlfile(itemid)
+ cliplist = model.getclipinfoforitem(itemid)
+ parser = cmmlParser()
+ parser.addclipstocmmlfile(cmmlfile, cliplist)
+
+ redirect_to(action='displayitem', id=itemid, edit="yes")
+
+ def deleteitem(self):
+ itemid = request.params['itemid']
+ model.deleteitem(itemid)
+ redirect_to(action='mainpage')
+
+ def addannodexmedia(self):
+ cmmlsource = request.POST['cmmlfile']
+ oggsource = request.POST['oggfile']
+
+ self.__addmediatoarchive(cmmlsource, oggsource)
+
+ return render('/mainpage.mak')
+
+ def __addmediatoarchive(self, cmmlsource, oggsource):
+ # Deal with the cmml file
+ # if no cmml file has been entered, then create one
+ if cmmlsource=="":
+ print "creating source file"
+ basecmmlname = os.path.splitext(oggsource.filename)[0] + ".cmml"
+ newcmmlname = os.path.join(archive_loc, basecmmlname)
+ parser = cmmlParser()
+ #parser.setcmmlfilename(newcmmlname)
+ fulloggpath = os.path.join(archive_loc, oggsource.filename)
+ parser.createnewfile(newcmmlname, fulloggpath)
+
+ else:
+ newcmmlname = os.path.join(archive_loc, cmmlsource.filename)
+ permanent_file = open(newcmmlname, 'w')
+ shutil.copyfileobj(cmmlsource.file, permanent_file)
+ cmmlsource.file.close()
+ permanent_file.close()
+
+ # Now the ogg file...
+ newoggname = os.path.join(archive_loc, oggsource.filename)
+ permanent_file = open(newoggname, 'w')
+ shutil.copyfileobj(oggsource.file, permanent_file)
+ oggsource.file.close()
+ permanent_file.close()
+
+ # Get the title for the item (head title)
+ parser = cmmlParser()
+ parser.setcmmlfilename(newcmmlname)
+ title = parser.gettitle(newcmmlname)
+ # adding an item here, even though we don't actually have the source
+ # anx file in place yet...
+ basename = os.path.splitext(newoggname)[0]
+ newanxname = basename + ".anx"
+ newitemid = model.addsource(title, newoggname, newcmmlname)
+
+ # Need to update the source tag in the cmml file
+ parser.updatesourcetag(newoggname)
+ parser.addmetaid(newcmmlname, newitemid)
+
+ # Once the meta tag addition has been added to pyannodex, this stuff
+ # can be replaced.
+
+ headinfo = {}
+ headinfo['itemid']= newitemid
+ headinfo['id'] = ""
+ headinfo['title'] = title
+ headid = model.addhead(headinfo)
+
+ # Now extract any clip information and add it to the database
+ # get a list of dictionary objects
+ cliplist = parser.getclipsfromcmml(newcmmlname)
+ for clipdict in cliplist:
+ clipdict['itemid'] = newitemid
+ model.addclip(clipdict)
+
+ # Extract meta info from the head and add to database
+ metalist = parser.getheadinfofromcmml(newcmmlname)
+ for metadict in metalist:
+ metadict['headindex'] = headid
+ metadict['itemid'] = newitemid
+ model.addmeta(metadict)
+
+ # Now we read the meta tags back from the database, and write them into
+ # the cmml file, syncing the id tags - useful (essential) for editing
+ # these later.
+ metalist = model.getmetasforhead(headid)
+ # sync cmml id attribute of head metas with the database primary key
+ for meta in metalist:
+ model.syncmetaid(meta.ixm)
+
+ # and sync with the cmml file
+ # Probably best to do it in one go at this stage
+ parser.setcmmlfilename(newcmmlname)
+ parser.syncheadmetas(metalist)
+
+ collection = request.params['collection']
+ model.additemtocollection(headinfo['itemid'], collection)
+
+ return
+
+ def search(self):
+ searchterms = request.params['searchterms']
+ resultsdict = model.search(searchterms)
+ c.items = []
+ for id in resultsdict['items']:
+ c.items.append(model.getitemforid(id))
+
+ # for the metas, we need to find its item
+ # meta info is returned as result['meta'] and
+ # result['item'] - and there'll be a list of these
+ c.metas = []
+ for metaid in resultsdict['metas']:
+ result={}
+ result['meta'] = model.getheadmeta(metaid)
+ result['item'] = model.getitemforheadmeta(metaid)
+ c.metas.append(result)
+
+ c.clips = []
+ for clipid in resultsdict['clips']:
+ result={}
+ result['clip'] = model.getclip(clipid)
+ result['item'] = model.getitemforclip(clipid)
+ c.clips.append(result)
+
+ return render('/searchresults.mak')
+
+ def editheadmetaname(self):
+ text = request.params['myparam']
+ id = request.params['id']
+ itemid = request.params['itemid']
+ field = request.params['field']
+
+ # change this element in the database
+ model.editmeta(id, field, text)
+ # change this element in the cmml file
+ parser = cmmlParser()
+ cmmlfilename = model.getitemcmmlfile(itemid)
+ parser.setcmmlfilename(cmmlfilename)
+ parser.editmeta(id, field, text)
+
+ return text
+
+ def addannodexindirmedia(self):
+ directory = request.params['mediadir']
+ files = os.listdir(directory)
+ for file in files:
+ if os.path.splitext(file)[1] == ".cmml":
+ oggfilename = directory + os.path.splitext(file)[0] + ".ogg"
+ cmmlfilename = directory + file
+ print "importing: " + cmmlfilename + " " + oggfilename
+ self.__localdirimport(cmmlfilename, oggfilename)
+ else:
+ print "moving right past: " + file
+
+ return
+
+ def __localdirimport(self, cmmlfilename, oggfilename):
+ newcmmlname = os.path.join(archive_loc, os.path.split(cmmlfilename)[1])
+ permanent_file = open(newcmmlname, 'w')
+ sourcefile = open(cmmlfilename, 'r')
+ shutil.copyfileobj(sourcefile, permanent_file)
+ sourcefile.close()
+ permanent_file.close()
+
+ # Now the ogg file...
+ newoggname = os.path.join(archive_loc, os.path.split(oggfilename)[1])
+ permanent_file = open(newoggname, 'w')
+ sourcefile = open(oggfilename, 'r')
+ shutil.copyfileobj(sourcefile, permanent_file)
+ sourcefile.close()
+ permanent_file.close()
+
+ # Get the title for the item (head title)
+ parser = cmmlParser()
+ parser.setcmmlfilename(newcmmlname)
+ title = parser.gettitle(newcmmlname)
+ # adding an item here, even though we don't actually have the source
+ # anx file in place yet...
+ basename = os.path.splitext(newoggname)[0]
+ newanxname = basename + ".anx"
+
+ newitemid = model.addsource(title, newoggname, newcmmlname)
+ # Need to update the source tag in the cmml file
+ parser.updatesourcetag(newoggname)
+ parser.addmetaid(newcmmlname, newitemid)
+
+ headinfo = {}
+ headinfo['itemid']= newitemid
+ headinfo['id'] = ""
+ headinfo['title'] = title
+ headid = model.addhead(headinfo)
+ # Now extract any clip information and add it to the database
+ # get a list of dictionary objects
+ cliplist = parser.getclipsfromcmml(newcmmlname)
+ for clipdict in cliplist:
+ clipdict['itemid'] = newitemid
+ model.addclip(clipdict)
+
+ # Extract meta info from the head and add to database
+ metalist = parser.getheadinfofromcmml(newcmmlname)
+ for metadict in metalist:
+ metadict['headindex'] = headid
+ metadict['itemid'] = newitemid
+ model.addmeta(metadict)
+
+ # Now we read the meta tags back from the database, and write them into
+ # the cmml file, syncing the id tags - useful (essential) for editing
+ # these later.
+ metalist = model.getmetasforhead(headid)
+ # sync cmml id attribute of head metas with the database primary key
+ for meta in metalist:
+ model.syncmetaid(meta.ixm)
+
+ # and sync with the cmml file
+ # Probably best to do it in one go at this stage
+ parser.setcmmlfilename(newcmmlname)
+ parser.syncheadmetas(metalist)
+
+ collection = request.params['collection']
+ model.additemtocollection(headinfo['itemid'], collection)
+ return
+
+
Added: arkaiv/trunk/arkaiv/controllers/page.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/controllers/page.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/controllers/play.py
===================================================================
--- arkaiv/trunk/arkaiv/controllers/play.py (rev 0)
+++ arkaiv/trunk/arkaiv/controllers/play.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,58 @@
+import logging
+import annodex
+import sys
+
+from arkaiv.lib.base import *
+
+log = logging.getLogger(__name__)
+
+class PlayController(BaseController):
+
+ def index(self):
+ # Return a rendered template
+ # return render('/some/template.html')
+ # or, Return a response
+ print "Do we even get here?"
+ return 'Hello World'
+
+ def playit(self):
+ def content_type (ct):
+ print "Content-Type: %s" % ct
+
+ def flush_headers ():
+ print
+ sys.stdout.flush()
+
+ def blat(anx):
+ while 1:
+ x = anx.write(1024000)
+ yield x
+ if (x <= 0):
+ break
+
+ content_type ("application/x-annodex")
+
+ print "playit"
+ myfile = request.params['filetoplay']
+ itemid = request.params['itemid']
+# print myfile
+ print itemid
+ # get source file
+ sourceid = model.getsourcesforitem(itemid)
+ sourcepath = model.getsourcepath(sourceid)
+ print sourcepath
+ annodex.init_importers("*/*")
+ anx = annodex.Anx(1, "w")
+ anx.writer_import(sourcepath)
+ try:
+ duration = anx.get_duration()
+ if (duration != -1):
+ print ("X-Content-Duration: %f" % (anx.get_duration()))
+ except AttributeError:
+ pass
+#
+# flush_headers()
+# Clips to be added in here
+
+# sys.stdout.flush()
+ return blat(anx)
Added: arkaiv/trunk/arkaiv/controllers/template.py
===================================================================
--- arkaiv/trunk/arkaiv/controllers/template.py (rev 0)
+++ arkaiv/trunk/arkaiv/controllers/template.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,26 @@
+from arkaiv.lib.base import *
+
+class TemplateController(BaseController):
+
+ def view(self, url):
+ """By default, the final controller tried to fulfill the request when
+ no other routes match. It may be used to display a template when all
+ else fails, e.g.::
+
+ def view(self, url):
+ return render('/%s' % url)
+
+ Or if you're using Mako and want to explicitly send a 404 (Not Found)
+ response code when the requested template doesn't exist::
+
+ import mako.exceptions
+
+ def view(self, url):
+ try:
+ return render('/%s' % url)
+ except mako.exceptions.TopLevelLookupException:
+ abort(404)
+
+ By default this controller aborts the request with a 404 (Not Found)
+ """
+ abort(404)
Added: arkaiv/trunk/arkaiv/lib/__init__.py
===================================================================
Added: arkaiv/trunk/arkaiv/lib/__init__.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/lib/__init__.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/lib/app_globals.py
===================================================================
--- arkaiv/trunk/arkaiv/lib/app_globals.py (rev 0)
+++ arkaiv/trunk/arkaiv/lib/app_globals.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,13 @@
+"""The application's Globals object"""
+from pylons import config
+
+class Globals(object):
+ """Globals acts as a container for objects available throughout the life of
+ the application.
+ """
+
+ def __init__(self):
+ """One instance of Globals is created during application initialization
+ and is available during requests via the 'g' variable.
+ """
+ pass
Added: arkaiv/trunk/arkaiv/lib/app_globals.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/lib/app_globals.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/lib/base.py
===================================================================
--- arkaiv/trunk/arkaiv/lib/base.py (rev 0)
+++ arkaiv/trunk/arkaiv/lib/base.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,27 @@
+"""The base Controller API
+
+This module provides the BaseController for all controllers to subclass, as
+well as functions and objects for use by those controllers.
+"""
+from pylons import c, cache, config, g, request, response, session
+from pylons.controllers import WSGIController
+from pylons.decorators import jsonify, validate
+from pylons.helpers import abort, etag_cache, redirect_to
+from pylons.i18n import _, ungettext, N_
+from pylons.templating import render
+
+import arkaiv.lib.helpers as h
+import arkaiv.model as model
+
+class BaseController(WSGIController):
+
+ def __call__(self, environ, start_response):
+ """Invoke the Controller"""
+ # WSGIController.__call__ dispatches to the Controller method the
+ # request is routed to. This routing information is available in
+ # environ['pylons.routes_dict']
+ return WSGIController.__call__(self, environ, start_response)
+
+# Include the '_' function in the public names
+__all__ = [__name for __name in locals().keys() if not __name.startswith('_') \
+ or __name == '_']
Added: arkaiv/trunk/arkaiv/lib/base.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/lib/base.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/lib/helpers.py
===================================================================
--- arkaiv/trunk/arkaiv/lib/helpers.py (rev 0)
+++ arkaiv/trunk/arkaiv/lib/helpers.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,6 @@
+"""Helper functions
+
+Consists of functions to typically be used within templates, but also available
+to Controllers. This module is available to both as 'h'.
+"""
+from webhelpers import *
Added: arkaiv/trunk/arkaiv/lib/helpers.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/lib/helpers.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/model/__init__.py
===================================================================
--- arkaiv/trunk/arkaiv/model/__init__.py (rev 0)
+++ arkaiv/trunk/arkaiv/model/__init__.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,573 @@
+# Copyright (C) 2007 Denis Crowdy, Macquarie University, Australia
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution.
+#
+# This software consists of voluntary contributions made by many
+# individuals. For exact contribution history, see the revision
+# history and logs.
+#
+# Author: Denis Crowdy <Denis.Crowdy at mq.edu.au>
+
+import sqlalchemy as sqla
+from sqlalchemy.orm import mapper
+from sacontext import PylonsSAContext
+import arkaiv.lib.helpers as h
+from operator import itemgetter
+#from arkaiv.model.oggzinfo import OggzInfo
+
+sac = PylonsSAContext()
+sac.add_engine_from_config("default")
+
+system_table = sqla.Table('system', sac.metadata,
+ sqla.Column('db_version', sqla.Integer)
+)
+
+collections_table = sqla.Table('collections', sac.metadata,
+ sqla.Column('ixk', sqla.Integer, primary_key=True),
+ sqla.Column('name', sqla.String())
+)
+
+items_table = sqla.Table('items', sac.metadata,
+ sqla.Column('ixi', sqla.Integer, primary_key=True),
+ sqla.Column('name', sqla.String()),
+ sqla.Column('cmmlfile', sqla.String())
+)
+
+collection_items_table = sqla.Table('collection_items', sac.metadata,
+ sqla.Column('ixci', sqla.Integer, primary_key=True),
+ sqla.Column('ixk', sqla.Integer, sqla.ForeignKey('collections.ixk')),
+ sqla.Column('ixi', sqla.Integer, sqla.ForeignKey('items.ixi'))
+)
+
+sources_table = sqla.Table('sources', sac.metadata,
+ sqla.Column('ixs', sqla.Integer, primary_key=True),
+ sqla.Column('path', sqla.String())
+)
+
+item_sources_table = sqla.Table('item_sources', sac.metadata,
+ sqla.Column('ixis', sqla.Integer, primary_key=True),
+ sqla.Column('ixi', sqla.Integer, sqla.ForeignKey('items.ixi')),
+ sqla.Column('ixs', sqla.Integer, sqla.ForeignKey('sources.ixs')
+))
+
+item_clips_table = sqla.Table('item_clips', sac.metadata,
+ sqla.Column('ixic', sqla.Integer, primary_key=True),
+ sqla.Column('ixi', sqla.Integer, sqla.ForeignKey('items.ixi')),
+ sqla.Column('ixc', sqla.Integer, sqla.ForeignKey('clips.ixc')
+))
+
+item_heads_table = sqla.Table('item_heads', sac.metadata,
+ sqla.Column('ixih', sqla.Integer, primary_key=True),
+ sqla.Column('ixi', sqla.Integer, sqla.ForeignKey('items.ixi')),
+ sqla.Column('ixh', sqla.Integer, sqla.ForeignKey('heads.ixh')
+))
+
+metas_table = sqla.Table('metas', sac.metadata,
+ sqla.Column('ixm', sqla.Integer, primary_key=True),
+ sqla.Column('id', sqla.String()),
+ sqla.Column('name', sqla.String()),
+ sqla.Column('content', sqla.String()),
+ sqla.Column('scheme', sqla.String())
+)
+
+head_metas_table = sqla.Table('head_metas', sac.metadata,
+ sqla.Column('ixhm', sqla.Integer, primary_key=True),
+ sqla.Column('ixh', sqla.Integer, sqla.ForeignKey('heads.ixh')),
+ sqla.Column('ixm', sqla.Integer, sqla.ForeignKey('metas.ixm')
+))
+
+clip_metas_table = sqla.Table('clip_metas', sac.metadata,
+ sqla.Column('ixcm', sqla.Integer, primary_key=True),
+ sqla.Column('ixc', sqla.Integer, sqla.ForeignKey('clips.ixc')),
+ sqla.Column('ixm', sqla.Integer, sqla.ForeignKey('metas.ixm')
+))
+
+heads_table = sqla.Table('heads', sac.metadata,
+ sqla.Column('ixh', sqla.Integer, primary_key=True),
+ sqla.Column('id', sqla.String()),
+ sqla.Column('title', sqla.String())
+)
+
+clips_table = sqla.Table('clips', sac.metadata,
+ sqla.Column('ixc', sqla.Integer, primary_key=True ),
+ sqla.Column('start_time', sqla.Float ),
+ sqla.Column('id', sqla.String()),
+ sqla.Column('a_href', sqla.String()),
+ sqla.Column('a_text', sqla.String()),
+ sqla.Column('img_src', sqla.String()),
+ sqla.Column('desc', sqla.String()),
+)
+
+rename_table = sqla.Table('rename', sac.metadata,
+ sqla.Column('ixr', sqla.Integer, primary_key=True),
+ sqla.Column('oldname', sqla.String()),
+ sqla.Column('newname', sqla.String())
+)
+
+channels_table = sqla.Table('channels', sac.metadata,
+ sqla.Column('ixch', sqla.Integer, primary_key=True ),
+ sqla.Column('title', sqla.String()),
+ sqla.Column('link', sqla.String()),
+ sqla.Column('description', sqla.String()),
+ sqla.Column('language', sqla.String()),
+ sqla.Column('copyright', sqla.String()),
+ sqla.Column('managingEditor', sqla.String()),
+ sqla.Column('webMaster', sqla.String()),
+ sqla.Column('image_path', sqla.String())
+)
+
+stories_table = sqla.Table('stories', sac.metadata,
+ sqla.Column('ixst', sqla.Integer, primary_key=True ),
+ sqla.Column('id', sqla.String()),
+ sqla.Column('title', sqla.String()),
+ sqla.Column('pubdate', sqla.String()),
+ sqla.Column('link', sqla.String()),
+ sqla.Column('description', sqla.String()),
+ sqla.Column('author', sqla.String()),
+ sqla.Column('category', sqla.String())
+)
+
+source_info_table = sqla.Table('source_info', sac.metadata,
+ sqla.Column('ixs', sqla.Integer, primary_key=True ),
+ sqla.Column('duration', sqla.String()),
+ sqla.Column('bitrate', sqla.String()),
+ sqla.Column('resolution', sqla.String()),
+ sqla.Column('framerate', sqla.String()),
+ sqla.Column('has_video', sqla.Integer),
+ sqla.Column('has_audio', sqla.Integer),
+ sqla.Column('audio', sqla.String())
+)
+
+class System(object):
+ def __str__(self):
+ return self.name
+
+class Collection(object):
+ def __str__(self):
+ return self.name
+
+class Item(object):
+ def __str__(self):
+ return self.name
+
+class Collectionitems(object):
+ def __str__(self):
+ return self.name
+
+class Source(object):
+ def __str__(self):
+ return self.name
+
+class Itemsources(object):
+ def __str__(self):
+ return self.name
+
+class Itemclips(object):
+ def __str__(self):
+ return self.name
+
+class Itemheads(object):
+ def __str__(self):
+ return self.name
+
+class Meta(object):
+ def __str__(self):
+ return self.name
+
+class Headmetas(object):
+ def __str__(self):
+ return self.name
+
+class Clipmetas(object):
+ def __str__(self):
+ return self.name
+
+class Head(object):
+ def __str__(self):
+ return self.name
+
+class Clip(object):
+ def __str__(self):
+ return self.name
+
+class Rename(object):
+ def __str__(self):
+ return self.name
+
+class Channel(object):
+ def __str__(self):
+ return self.name
+
+class Story(object):
+ def __str__(self):
+ return self.name
+
+class Sourceinfo(object):
+ def __str__(self):
+ return self.name
+
+sqla.mapper(Collection, collections_table, extension=sac.ext)
+sqla.mapper(Collectionitems, collection_items_table, extension=sac.ext)
+
+sqla.mapper(Item, items_table, properties = {
+ 'my_collections' : sqla.relation(Collection,
+ secondary = collection_items_table)},
+ extension=sac.ext)
+
+sqla.mapper(Source, sources_table, properties = {
+ 'my_items' : sqla.relation(Item, secondary = item_sources_table)
+ },
+ extension=sac.ext)
+sqla.mapper(Sourceinfo, source_info_table, extension=sac.ext)
+sqla.mapper(Itemsources, item_sources_table, extension=sac.ext)
+sqla.mapper(Head, heads_table, properties = {
+ 'my_items' : sqla.relation(Item, secondary = item_heads_table)
+ },
+ extension=sac.ext)
+sqla.mapper(Itemheads, item_heads_table, extension=sac.ext)
+sqla.mapper(Meta, metas_table, properties = {
+ 'my_heads' : sqla.relation(Head, secondary = head_metas_table)
+ },
+ extension=sac.ext)
+sqla.mapper(Headmetas, head_metas_table, extension=sac.ext)
+sqla.mapper(Clip, clips_table, properties = {
+ 'my_items' : sqla.relation(Item, secondary = item_clips_table)
+ },
+ extension=sac.ext)
+sqla.mapper(Itemclips, item_clips_table, extension=sac.ext)
+
+
+def getallitems():
+ item = items_table
+ i = item.select().execute().fetchall()
+ return i
+
+def addnewcollection(name):
+ newcollection = Collection()
+ newcollection.name = name
+ sac.session.flush()
+ return
+
+def getcollections():
+ coll = collections_table
+ c = coll.select().execute().fetchall()
+ return c
+
+def getitemsincollection(id):
+ coll_items_q = sac.query(Collectionitems)
+ # get a list of ids
+ cilist = coll_items_q.filter_by(ixk=id)
+ itemlist = []
+ for ci in cilist:
+ item_q = sac.query(Item)
+ i = item_q.get_by(ixi=ci.ixi)
+ itemlist.append(i)
+
+ sac.session.flush()
+ return itemlist
+
+def addsource(itemname, source, cmmlfile):
+ new_item = Item()
+ new_source = Source()
+ new_item.name = itemname
+ new_item.cmmlfile = cmmlfile
+ new_source.path = source
+ new_source.my_items.append(new_item)
+
+ sac.session.flush()
+ return new_item.ixi
+
+def additemtocollection(itemid, collection):
+ new_coll_item = Collectionitems()
+ coll_q = sac.query(Collection)
+ c = coll_q.get_by(name=collection)
+ new_coll_item.ixk = c.ixk
+ new_coll_item.ixi = itemid
+ sac.session.flush()
+ return
+
+def edititemname(itemid, text):
+ """ Edits the name of an item
+
+
+ """
+ item_q = sac.query(Item)
+ i = item_q.get_by(ixi=itemid)
+ i.name = text
+ sac.session.flush()
+
+ return
+
+def getitemname(id):
+ item_q = sac.query(Item)
+ i = item_q.get_by(ixi=id)
+ name = i.name
+ return name
+
+def getitemforid(id):
+ item_q = sac.query(Item)
+ i = item_q.get_by(ixi=id)
+ return i
+
+def getitemforclip(clipid):
+ ic_q = sac.query(Itemclips)
+ ic = ic_q.get_by(ixc=clipid)
+ i_q = sac.query(Item)
+ i = i_q.get_by(ixi=ic.ixi)
+ return i
+
+def getclip(clipid):
+ c_q = sac.query(Clip)
+ c = c_q.get_by(ixc=clipid)
+ return c
+
+def getheadmeta(id):
+ meta_q = sac.query(Meta)
+ m = meta_q.get_by(ixm=id)
+ return m
+
+def getitemforheadmeta(metaid):
+ #first get the head
+ hm_q = sac.query(Headmetas)
+ h = hm_q.get_by(ixm=metaid)
+ ih_q = sac.query(Itemheads)
+ ih = ih_q.get_by(ixh=h.ixh)
+ i_q = sac.query(Item)
+ i = i_q.get_by(ixi=ih.ixi)
+
+ return i
+
+
+def getitemcmmlfile(id):
+ item_q = sac.query(Item)
+ i = item_q.get_by(ixi=id)
+ cmmlfile = i.cmmlfile
+ return cmmlfile
+
+def getsourcesforitem(id):
+ # get the results from item_sources for given item id
+ item_sources_q = sac.query(Itemsources)
+ s = item_sources_q.get_by(ixi=id)
+ sid = s.ixs
+ return sid
+
+def getsourcepath(id):
+ """ get the source path given an itemid
+
+ Returns the source path
+ """
+ source_q = sac.query(Source)
+ s = source_q.get_by(ixs=id)
+ path = s.path
+ return path
+
+def addhead(info):
+ # get the item this refers to:
+ item_q = sac.query(Item)
+ i = item_q.get_by(ixi=info['itemid'])
+ new_head = Head()
+ new_head.id = info['id']
+ new_head.title = info['title']
+ new_head.my_items.append(i)
+ sac.session.flush()
+ return new_head.ixh
+
+def edithead(info):
+ head_q = sac.query(Head)
+ itemhead_q = sac.query(Itemheads)
+ ih = itemhead_q.get_by(ixi=info['itemid'])
+ h = head_q.get_by(ixh=ih.ixh)
+ h.id = info['id']
+ h.title = info['title']
+ sac.session.flush()
+ return
+
+def getclipinfoforitem(id):
+ item_clip_q = sac.query(Itemclips)
+ iclist = item_clip_q.filter_by(ixi=id).all()
+ cliplist = []
+ clip_q = sac.query(Clip)
+
+ # FIXME - why not just return a list of the objects? Why the dictionary
+ # step? Madness.
+
+ for ic in iclist:
+ # get individual meta info
+ clipinfo = {}
+ c = clip_q.get_by(ixc=ic.ixc)
+ clipinfo['ixc'] = c.ixc
+ clipinfo['start_time'] = c.start_time
+ clipinfo['id'] = c.id
+ clipinfo['a_href'] = c.a_href
+ clipinfo['a_text'] = c.a_text
+ clipinfo['img_src'] = c.img_src
+ clipinfo['desc'] = c.desc
+ cliplist.append(clipinfo)
+ # great way to sort a list of dictionaries:
+ sortedcliplist = sorted(cliplist, key=itemgetter('start_time'))
+ sac.session.flush()
+ return sortedcliplist
+
+def getheadinfoforitem(id):
+ headdict = {}
+ head_q = sac.query(Head)
+ itemhead_q = sac.query(Itemheads)
+ ih = itemhead_q.get_by(ixi=id)
+ h = head_q.get_by(ixh=ih.ixh)
+ headdict['ixh'] = h.ixh
+ headdict['id'] = h.id
+ headdict['title'] = h.title
+ return headdict
+
+def getmetasforhead(headid):
+ head_meta_q = sac.query(Headmetas)
+ hmlist = head_meta_q.filter_by(ixh=headid).all()
+ metalist = []
+ meta_q = sac.query(Meta)
+ for hm in hmlist:
+ metainfo = {}
+ m = meta_q.get_by(ixm=hm.ixm)
+ metalist.append(m)
+
+ sac.session.flush()
+ return metalist
+
+def getmetainfoforhead(id):
+
+# This returns a dictionary - deprecated by getmetasforhead, but used in
+# displayitem FIXME
+
+ # now return a list of metas with that id in head_metas table
+ head_meta_q = sac.query(Headmetas)
+ hmlist = head_meta_q.filter_by(ixh=id).all()
+ metalist = []
+ meta_q = sac.query(Meta)
+ for hm in hmlist:
+ # get individual meta info
+ metainfo = {}
+ m = meta_q.get_by(ixm=hm.ixm)
+ metainfo['ixm'] = m.ixm
+ metainfo['id'] = m.id
+ metainfo['name'] = m.name
+ metainfo['content'] = m.content
+ metainfo['scheme'] = m.scheme
+ metalist.append(metainfo)
+
+ sac.session.flush()
+ return metalist
+
+def addmeta(info):
+ """ Given a dictionary of meta info, adds a meta item to database
+
+ returns the newly created meta item
+ """
+ head_q = sac.query(Head)
+ h = head_q.get_by(ixh=info['headindex'])
+ new_meta = Meta()
+ new_meta.id = info['id']
+ new_meta.name = info['name']
+ new_meta.content = info['content']
+ new_meta.scheme = info['scheme']
+ new_meta.my_heads.append(h)
+ sac.session.flush()
+ return new_meta
+
+def syncmetaid(metaid):
+ """ Given the meta primary key, it sets id to the same value
+
+ """
+
+ meta_q = sac.query(Meta)
+ m = meta_q.get_by(ixm=metaid)
+ m.id = metaid
+ sac.session.flush()
+ return
+
+def editmeta(metaid, field, text):
+ """ Edits a meta tag in the database
+
+ metaid
+ field - the field (or database column) to change
+ text - the text that replaces the existing entry
+
+ returns nothing yet...
+ """
+ meta_q = sac.query(Meta)
+ m = meta_q.get_by(ixm=metaid)
+ if field=="name":
+ m.name = text
+ elif field=="content":
+ m.content = text
+ sac.session.flush()
+ return
+
+def addclip(info):
+ item_q = sac.query(Item)
+ i = item_q.get_by(ixi=info['itemid'])
+ new_clip = Clip()
+ new_clip.start_time = info['starttime']
+ new_clip.id = info['id']
+ new_clip.a_href = info['a_href']
+ new_clip.a_text = info['a_text']
+ new_clip.img_src = info['img_src']
+ new_clip.desc = info['desc']
+ new_clip.my_items.append(i)
+ sac.session.flush()
+ return
+
+def deleteclip(id):
+ clip_q = sac.query(Clip)
+ c = clip_q.get_by(ixc=id)
+ sac.session.delete(c)
+ sac.session.flush()
+ return
+
+def deleteitem(id):
+ item_q = sac.query(Item)
+ i = item_q.get_by(ixi=id)
+ sac.session.delete(i)
+ sac.session.flush()
+ return
+
+def search(searchterms):
+ # All very rough - done in a hurry; lots of code that can be combined in a
+ # single function here; need to be able to cope with multiple search words
+ # too
+
+ resultsdict={}
+ searchstring = "%" + searchterms + "%"
+ # look for item names:
+ item_q = sac.query(Item)
+ items = item_q.select(items_table.c.name.like(searchstring))
+ itemnames = []
+ for item in items:
+ itemnames.append(item.ixi)
+
+ # look for meta names:
+ meta_q = sac.query(Meta)
+ metas = meta_q.select(metas_table.c.name.like(searchstring))
+ metanames = []
+ for meta in metas:
+ metanames.append(meta.ixm)
+
+ metas = meta_q.select(metas_table.c.content.like(searchstring))
+ # keep appending to the metanames list
+ for meta in metas:
+ metanames.append(meta.ixm)
+
+ # And search clips now:
+ clip_q = sac.query(Clip)
+ clips = clip_q.select(clips_table.c.desc.like(searchstring))
+ clipnames = []
+ for clip in clips:
+ clipnames.append(clip.ixc)
+
+ resultsdict['items'] = itemnames
+ resultsdict['metas'] = metanames
+ resultsdict['clips'] = clipnames
+ sac.session.flush()
+
+ return resultsdict
+
Added: arkaiv/trunk/arkaiv/model/__init__.py.old
===================================================================
Added: arkaiv/trunk/arkaiv/model/__init__.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/model/__init__.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/model/cmmlparser.py
===================================================================
--- arkaiv/trunk/arkaiv/model/cmmlparser.py (rev 0)
+++ arkaiv/trunk/arkaiv/model/cmmlparser.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,211 @@
+import subprocess
+import re
+from lxml import etree as ElementTree
+
+class cmmlParser(object):
+
+ def __init__(self):
+ self.cmmlfilename = ""
+ self.Etree = ""
+ return
+
+ def setcmmlfilename(self, filename):
+ self.cmmlfilename = filename
+ self.Etree = ElementTree
+ self.doc = self.Etree.parse(self.cmmlfilename)
+ self.root = self.doc.getroot()
+ return
+
+ def runcommand(self, cmd):
+ runit = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = runit.communicate()
+ print out + err
+
+
+ def edithead(self, headid, text):
+ """ Edits the head title information
+
+ """
+ head = self.root.getiterator('head')
+ for h in head:
+ t = h.find('title')
+ t.text = text
+
+ self.doc.write(self.cmmlfilename)
+ return
+
+ def addmetaid(self, cmmlfile, id):
+ head = self.root.getiterator('head')
+
+ for h in head:
+ mymeta = self.Etree.SubElement(h, 'meta')
+ mymeta.set('name', "dbid")
+ mymeta.set('content', str(id))
+
+ self.doc.write(self.cmmlfilename)
+ return
+
+ def addmetaitem(self, metadict):
+
+ head = self.root.getiterator('head')
+
+ for h in head:
+ mymeta = self.Etree.SubElement(h, 'meta')
+ mymeta.set('name', metadict['name'])
+ mymeta.set('content', metadict['content'])
+
+ self.doc.write(self.cmmlfilename)
+ return
+
+ def updatesourcetag(self, sourcename):
+ # updates the source file location in the cmml file
+# Etree = ElementTree
+# doc = Etree.parse(cmmlfilename)
+# root = doc.getroot()
+
+ stream = self.root.getiterator('stream')
+ for s in stream:
+ i = s.find('import')
+ i.set('src', sourcename)
+
+ self.doc.write(self.cmmlfilename)
+ return
+
+ def gettitle(self, cmmlfilename):
+ Etree = ElementTree
+ doc = Etree.parse(cmmlfilename)
+ root = doc.getroot()
+ head = root.getiterator('head')
+ for h in head:
+ t = h.find('title')
+ title = t.text
+
+ # Work around a bug in my marking up app - makimap.py, which added
+ # newlines and tabs to the title in the head
+ title = re.sub(r'\n', r'', str(title))
+ title = re.sub(r'\t', r'', title)
+
+ return title
+
+ def getclipsfromcmml(self, cmmlfilename):
+ Etree = ElementTree
+ doc = Etree.parse(cmmlfilename)
+ root = doc.getroot()
+ clips = root.getiterator('clip')
+ cliplist = []
+ for clip in clips:
+ clipdict = {}
+ clipdict['id'] = clip.get('id')
+ clipdict['starttime'] = clip.get('start')
+ desc = clip.find('desc')
+ clipdict['desc'] = desc.text
+ clipdict['a_href'] = None
+ clipdict['a_text'] = None
+ clipdict['img_src'] = None
+
+ cliplist.append(clipdict)
+
+ return cliplist
+
+ def getheadinfofromcmml(self, cmmlfilename):
+ Etree = ElementTree
+ doc = Etree.parse(cmmlfilename)
+ root = doc.getroot()
+ head = root.getiterator('head')
+ metalist = []
+ for h in head:
+ mlist = h.findall('meta')
+ for m in mlist:
+ metadict = {}
+ metadict['name'] = m.get('name')
+ metadict['content'] = m.get('content')
+ metadict['id'] = None
+ metadict['scheme'] = None
+ metalist.append(metadict)
+
+ return metalist
+
+ def addclipstocmmlfile(self, cmmlfile, cliplist):
+
+ Etree = ElementTree
+ doc = Etree.parse(cmmlfile)
+ root = doc.getroot()
+ # First, we get rid of the old list of clips from the cmml
+ clips = root.getiterator('clip')
+ for c in clips:
+ root.remove(c)
+
+ # Now we write the new clips back
+ for clip in cliplist:
+ newclip = Etree.SubElement(root, 'clip')
+ newclip.set('id', clip['id'])
+ newclip.set('start', str(clip['start_time']))
+ newclip.set('id', clip['id'])
+ desc = Etree.SubElement(newclip, 'desc')
+ desc.text = clip['desc']
+
+ doc.write(cmmlfile)
+ return
+
+ def syncheadmetas(self, metalist):
+ """ Takes a list of head meta tags and writes them to the cmml file
+
+ Returns nothing - that's probably a _bad thing_
+ """
+ Etree = ElementTree
+ doc = Etree.parse(self.cmmlfilename)
+ root = doc.getroot()
+ head = root.getiterator('head')
+ for h in head:
+ mlist = h.findall('meta')
+ for m in mlist:
+ h.remove(m)
+
+ # Now write the meta tags back
+ head = root.getiterator('head')
+ for h in head:
+ for meta in metalist:
+ newmeta = Etree.SubElement(h, 'meta')
+ newmeta.set('id', str(meta.id))
+ newmeta.set('name', meta.name)
+ newmeta.set('content', meta.content)
+
+ doc.write(self.cmmlfilename)
+ return
+
+ def editmeta(self, metaid, field, text):
+ Etree = ElementTree
+ doc = Etree.parse(self.cmmlfilename)
+ root = doc.getroot()
+ head = root.getiterator('head')
+ for h in head:
+ mlist = h.findall('meta')
+ for m in mlist:
+ if m.get('id') == metaid:
+ m.set(field, text)
+
+ doc.write(self.cmmlfilename)
+ return
+
+ def createnewfile(self, sourcefilename, oggsourcename):
+ Etree = ElementTree
+ root = Etree.Element('cmml')
+ stream = Etree.SubElement(root, 'stream')
+ stream.set('timebase', 'npt:0')
+ importtag = Etree.SubElement(stream, 'import')
+ importtag.set('src', oggsourcename)
+ head = Etree.SubElement(root, 'head')
+ title = Etree.SubElement(head, 'title')
+ tree = Etree.ElementTree(root)
+ tree.write(sourcefilename)
+
+ return
+
+ def __getelementiterator(self, element):
+ Etree = ElementTree
+ doc = Etree.parse(self.cmmlfilename)
+ root = doc.getroot()
+
+ elementiterator = root.getiterator(element)
+ return
+
Added: arkaiv/trunk/arkaiv/model/cmmlparser.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/model/cmmlparser.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/model/oggzinfo.py
===================================================================
--- arkaiv/trunk/arkaiv/model/oggzinfo.py (rev 0)
+++ arkaiv/trunk/arkaiv/model/oggzinfo.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,65 @@
+# -*- coding: iso8859-1 -*-
+#
+# Copyright (C) 2005 CSIRO Australia
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution.
+#
+# This software consists of voluntary contributions made by many
+# individuals. For exact contribution history, see the revision
+# history and logs.
+#
+# Author: Conrad Parker <conrad at annodex.net>
+
+import commands
+import re
+
+class OggzInfo (object):
+
+ def __init__(self, filename):
+ self.output = commands.getoutput ("oggzinfo -b \"%s\"" % (filename))
+
+ def headerval (self, field):
+ pattern = '%s: (.*)' % (field)
+ match = re.search (pattern, self.output)
+ if match:
+ return match.group(1)
+ else:
+ return "Unknown"
+
+ def duration(self):
+ return self.headerval ('^Content-Duration')
+
+ def bitrate(self):
+ return self.headerval ('Content-Bitrate-Average')
+
+ def resolution(self):
+ width = self.headerval ('Video-Width')
+ height = self.headerval ('Video-Height')
+ return '%sx%s' % (width, height)
+
+ def framerate(self):
+ return self.headerval ('Video-Framerate')
+
+ def has_video(self):
+ return (self.framerate() != "Unknown")
+
+ def has_audio(self):
+ samplerate = self.headerval ('Audio-Samplerate')
+ return (samplerate != "Unknown")
+
+ def audio(self):
+ samplerate = self.headerval ('Audio-Samplerate')
+ if (samplerate == "Unknown"):
+ return "None"
+
+ channels = self.headerval ('Audio-Channels')
+ if (channels == "1"):
+ cdesc= "Mono"
+ elif (channels == "2"):
+ cdesc= "Stereo"
+ else:
+ cdesc= "%s channel" % (channels)
+
+ return '%s %s' % (cdesc, samplerate)
Added: arkaiv/trunk/arkaiv/model/oggzinfo.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/model/oggzinfo.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/public/images/blank.png
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/public/images/blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv/public/index.html
===================================================================
--- arkaiv/trunk/arkaiv/public/index.html (rev 0)
+++ arkaiv/trunk/arkaiv/public/index.html 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,108 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title>Pylons Default Page</title>
+ <style>
+ body { background-color: #fff; color: #333; }
+
+ body, p {
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 12px;
+ line-height: 18px;
+ }
+ pre {
+ background-color: #eee;
+ padding: 10px;
+ font-size: 11px;
+ line-height: 13px;
+ }
+
+ a { color: #000; }
+ a:visited { color: #666; }
+ a:hover { color: #fff; background-color:#000; }
+ </style>
+</head>
+<body>
+
+<h1>Welcome to your Pylons Web Application</h1>
+
+<h2>Weren't expecting to see this page?</h2>
+
+<p>The <tt>arkaiv/public/</tt> directory is searched for static files
+ <i>before</i> your controllers are run. Remove this file (<tt>arkaiv/public/index.html</tt>)
+ and edit the routes in <tt>arkaiv/config/routing.py</tt> to point the
+ <a href="/">root path</a> to a 'hello' controller we'll create below:
+ <pre> map.connect('', controller='hello', action='index')</pre>
+</p>
+
+<h2>Getting Started</h2>
+<p>You're now ready to start creating your own web application. To create a 'hello' controller,
+ run the following command in your project's root directory:
+<pre>
+arkaiv$ paster controller hello
+</pre>
+
+ This generates the following the following code in <tt>arkaiv/controllers/hello.py</tt>:
+<pre>
+import logging
+
+from arkaiv.lib.base import *
+
+log = logging.getLogger(__name__)
+
+class HelloController(BaseController):
+
+ def index(self):
+ # Return a rendered template
+ # return render('/some/template.html')
+ # or, Return a response
+ return 'Hello World'
+</pre>
+</p>
+<p>This controller simply prints out 'Hello World' to the browser. Pylons' default routes
+ automatically set up this controller to respond at the <a href="/hello">/hello</a> URL.
+ With the additional route described above, this controller will also respond at the
+ <a href="/">root path</a>.
+</p>
+
+<h3>Using a template</h3>
+<p>To call a template and do something a little more complex, this following example
+ shows how to print out some request information from a
+ <a href="http://www.makotemplates.org">Mako</a> template.
+</p>
+<p>Create a <tt>serverinfo.mak</tt> file in your project's <tt>arkaiv/templates/</tt>
+ directory with the following contents:
+</p>
+<pre>
+<h2>
+Server info for ${request.host}
+</h2>
+
+<p>
+The URL you called: ${h.url_for()}
+</p>
+
+<p>
+The name you set: ${c.name}
+</p>
+
+<p>The server environment:<br />
+<pre>${c.pretty_environ}</pre>
+</p>
+</pre>
+
+Then add the following to your 'hello' controller class:
+<pre>
+ def serverinfo(self):
+ import cgi
+ import pprint
+ c.pretty_environ = cgi.escape(pprint.pformat(request.environ))
+ c.name = 'The Black Knight'
+ return render('/serverinfo.mak')
+</pre>
+
+You can now view the page at: <tt><a href="/hello/serverinfo">/hello/serverinfo</a></tt>
+</p>
+</body>
+</html>
Added: arkaiv/trunk/arkaiv/public/quick.css
===================================================================
--- arkaiv/trunk/arkaiv/public/quick.css (rev 0)
+++ arkaiv/trunk/arkaiv/public/quick.css 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,40 @@
+body {
+ background-color: #888;
+ margin: 25px;
+}
+div.content{
+ margin: 0;
+ margin-bottom: 10px;
+ background-color: #d3e0ea;
+ border: 5px solid #333;
+ padding: 5px 25px 25px 25px;
+}
+#video{
+ float: left;
+ width: 60%;
+ background-color: #d3e0ea;
+ font-family: sans-serif;
+ font-size: small
+}
+#clips{
+ float: left;
+ width: 40%;
+ height: 500px;
+ overflow: scroll;
+ font-family: sans-serif;
+ font-size: small
+}
+
+div.sourceinfo{
+ font-size: small
+}
+h1.main{
+ width: 100%;
+ border-bottom: 1px solid #000;
+}
+p.footer{
+ width: 100%;
+ padding-top: 3px;
+ border-top: 1px solid #000;
+}
+
Added: arkaiv/trunk/arkaiv/templates/addannodexform.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/addannodexform.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/addannodexform.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,23 @@
+<%inherit file="/autohandler"/>
+<h1 class="main">Add annodex media</h1>
+
+The page where data gets added.
+
+${ h.form(h.url(action='addannodexmedia'), multipart=True) }
+<table>
+<tr>
+<td>Upload OGG file:</td>
+<td>${ h.file_field('oggfile') } </td>
+</tr>
+<tr>
+<td>Upload CMML file:</td>
+<td>${ h.file_field('cmmlfile') } (if left blank, will be created) </td>
+</tr>
+<tr>
+<td>Collection:</td>
+<td>${ h.select("collection", c.collectioninfo)}</td>
+</tr>
+</table>
+${ h.submit('Submit') }
+${ h.end_form() }
+
Added: arkaiv/trunk/arkaiv/templates/addform.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/addform.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/addform.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,33 @@
+<%inherit file="/autohandler"/>
+<h1 class="main">Add media</h1>
+
+The page where data gets added.
+
+${ h.form(h.url(action='addmedia'), multipart=True) }
+<table>
+<tr>
+<td>Upload file:</td>
+<td>${ h.file_field('myfile') } </td>
+</tr>
+<tr>
+<td>File description:</td>
+<td>${ h.text_field('itemname') }</td>
+</tr>
+${ h.form(h.url(action='addheadinfo'), multipart=True) }
+<tr>
+<td>Head id:</td>
+<td>${ h.text_field('headid') }</td>
+</tr>
+<tr>
+<td>Head title:</td>
+<td>${ h.text_field('headtitle') }</td>
+</tr>
+<tr>
+<td>Collection:</td>
+<td>${ h.select("collection", c.collectioninfo)}
+</table>
+${ h.hidden_field('itemid') }
+
+${ h.submit('Submit') }
+${ h.end_form() }
+
Added: arkaiv/trunk/arkaiv/templates/autohandler
===================================================================
--- arkaiv/trunk/arkaiv/templates/autohandler (rev 0)
+++ arkaiv/trunk/arkaiv/templates/autohandler 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,35 @@
+<html>
+ <head>
+ <title>Arkaiv</title>
+ <link rel="stylesheet" href="/quick.css"></link>
+${ h.javascript_include_tag('/javascripts/effects.js', builtins=True) }
+
+ </head>
+ <body>
+ <p class="header">
+<h1>Arkaiv</h1>
+<table>
+<tr>
+<td>${ h.link_to("All Items", h.url(action="mainpage")) } </td>
+<td>${ h.link_to("Collections", h.url(action="collections")) } </td>
+<!-- ${ h.link_to("Add media", h.url(action="displayadd")) }-->
+<td>${ h.link_to("Add annodex media", h.url(action="addannodexform")) }</td>
+<!--${ h.link_to("Add all annodex media in dir", h.url(action="addannodexindirform")) }-->
+<td>
+${ h.form(h.url(action='search'), multipart=True) }
+Search terms:
+${ h.text_field('searchterms') }
+${ h.submit('Submit') }
+${ h.end_form() }
+</td>
+</tr>
+</table>
+ </p>
+ <!--div class="content"-->
+${next.body()}
+ <p class="footer">
+ </p>
+ <!--/div-->
+ </body>
+</html>
+
Added: arkaiv/trunk/arkaiv/templates/collectionexpanded.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/collectionexpanded.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/collectionexpanded.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,13 @@
+<%inherit file="/autohandler"/>
+<h2>
+Collection: ${ c.collname}
+</h2>
+
+% for item in c.items:
+<li>
+ ${item.ixi}
+ ${ h.link_to(item.name, h.url(action="displayitem", edit="no", id=item.ixi)) }
+</li>
+% endfor
+
+
Added: arkaiv/trunk/arkaiv/templates/collections.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/collections.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/collections.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,19 @@
+<%inherit file="/autohandler"/>
+<h2>
+Collections
+</h2>
+
+% for coll in c.collections:
+<li>
+ ${coll[0]}
+ ${ h.link_to(coll[1], h.url(action="displaycollection", edit="no", id=coll[0], name=coll[1])) }
+</li>
+% endfor
+
+<hr>
+Add new collection:
+${ h.form(h.url(action='addcollection'), multipart=True) }
+${ h.text_field('newcollection') }
+${ h.submit('Add') }
+${ h.end_form() }
+
Added: arkaiv/trunk/arkaiv/templates/confirmadd.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/confirmadd.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/confirmadd.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,4 @@
+<%inherit file="/autohandler"/>
+<p>
+Media added as requested...
+</p>
Added: arkaiv/trunk/arkaiv/templates/displayitem.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/displayitem.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/displayitem.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,256 @@
+<%inherit file="/autohandler"/>
+<div id="video">
+Item: <p id="edititemname">${c.itemname}</p>
+<script type="text/javascript">
+ new Ajax.InPlaceEditor('edititemname', '/page/edititemname', { callback: function(form, value) { return 'itemid=${c.itemid}&myparam=' + escape(value) }});
+</script>
+
+
+${ h.form(h.url(action='deleteitem'), multipart=True) }
+${ h.submit('Delete') }
+${ h.hidden_field('itemid', value=c.itemid) }
+${ h.end_form() }
+
+ <embed type="application/liboggplay"
+ src="${c.sourcedict['urlpath']}"
+ width="320" height="240"/>
+<form name="api">
+<table>
+<tr>
+<td><input type="button" value="Skip back" onclick='skip(-1)'/></td>
+<td><input type="button" value="Play" onclick='Play()'/></td>
+<td><input type="button" value="Pause" onclick='Pause()'/></td>
+<td><input type="button" value="Skip forward" onclick='skip(1)'/></td>
+<td><input type="button" value="Get position" onclick='GetPlayPosition()'/></td>
+<td><input type="button" value="Go to pos" onclick='GotoPosition()'/>
+<input type="text" name="gotofield" size="5"/></td>
+</tr>
+</table>
+Output:
+<textarea name="ofield" cols="40" rows="4"></textarea>
+Input:
+<input type="text" name="ifield" size="20"/><br>
+</form>
+
+<hr>
+Head:
+${ h.form(h.url(action='editheadinfo'), multipart=True) }
+id:
+${ h.text_field('headid', value=c.headdict['id']) }
+Title:
+${ h.text_field('headtitle', value=c.headdict['title']) }
+${ h.hidden_field('itemid', value=c.itemid) }
+
+${ h.submit('Edit') }
+${ h.end_form() }
+<br />
+<hr>
+Meta information:<br />
+<table style="font-size:small">
+<tr>
+ <td>Name</td>
+ <td>Content</td>
+</tr>
+% for metainfo in c.metalist:
+<tr>
+<td>
+<p id="editmetaname">${metainfo['name']}</p>
+<script type="text/javascript">
+ new Ajax.InPlaceEditor('editmetaname', '/page/editheadmetaname', { callback: function(form, value) { return 'id=${metainfo['id']}&field=name&itemid=${c.itemid}&myparam=' + escape(value) }});
+</script>
+</td>
+<td>
+<p id="editmetacontent">${metainfo['content']}</p>
+<script type="text/javascript">
+ new Ajax.InPlaceEditor('editmetacontent', '/page/editheadmetaname', { callback: function(form, value) { return 'id=${metainfo['id']}&field=content&itemid=${c.itemid}&myparam=' + escape(value) }});
+</script>
+</td>
+</tr>
+% endfor
+</table>
+<hr>
+Add new meta tag:
+${ h.form(h.url(action='addmetainfo'), multipart=True) }
+<table>
+<tr>
+ <td>Id</td>
+ <td>Name</td>
+ <td>Content</td>
+ <td>Scheme</td>
+</tr>
+
+<tr>
+ <td> ${ h.text_field('metaid', size=5) }</td>
+ <td>${ h.text_field('metaname') }</td>
+ <td>${ h.text_field('metacontent') }</td>
+ <td>${ h.hidden_field('metascheme') }</td>
+</tr>
+</table>
+${ h.hidden_field('headindex', value = c.headdict['ixh']) }
+${ h.hidden_field('itemid', value=c.itemid) }
+
+${ h.submit('Add') }
+${ h.end_form() }
+
+<hr>
+
+
+<!--div class="sourceinfo"-->
+<table style="font-size:small">
+<tr>
+<td>Duration:</td><td> ${c.sourcedict['duration']}</td>
+</tr>
+<tr>
+<td>Bitrate: </td><td>${c.sourcedict['bitrate']}</td>
+</tr>
+<tr>
+<td>Resolution: </td><td>${c.sourcedict['resolution']}</td>
+</tr>
+<tr>
+<td>Framerate: </td><td>${c.sourcedict['framerate']}</td>
+</tr>
+<tr>
+<td>Audio: </td><td>${c.sourcedict['audio']}</td>
+</tr>
+<tr>
+<td>Has video: </td><td>${c.sourcedict['has_video']}</td>
+</tr>
+<tr>
+<td>Has audio: </td><td>${c.sourcedict['has_audio']}</td>
+</tr>
+</table>
+
+<!--/div!-->
+</div>
+
+<div id="clips">
+Clips:
+<br />
+<table style="font-size:small">
+<tr>
+ <td></td>
+ <td>Start time</td>
+ <td>Id</td>
+ <td>Description</td>
+ <td>a_href</td>
+</tr>
+% for clipinfo in c.cliplist:
+<tr>
+ <td><a onclick="javascript:SetLocation('${c.sourcedict['urlpath']}?id=${clipinfo['id']}')"><img width=60 height=40 src="/images/blank.png"></a></td>
+ <td>${clipinfo['start_time']}</td>
+ <td>${clipinfo['id']}</td>
+ <td>${clipinfo['desc']}</td>
+ <td>${clipinfo['a_href']}</td>
+
+
+${ h.form(h.url(action='deleteclip'), multipart=True) }
+<td>${ h.submit('Delete') } </td>
+${ h.hidden_field('clipid', value=clipinfo['ixc']) }
+${ h.hidden_field('itemid', value=c.itemid) }
+${ h.end_form() }
+
+
+</tr>
+% endfor
+</table>
+
+Add new clip:
+${ h.form(h.url(action='addclip'), multipart=True) }
+<table>
+<tr>
+ <td>Start time</td>
+ <td>${ h.text_field('starttime', size=5) }</td>
+ <td>a_text</td>
+ <td>${ h.text_field('a_text') }</td>
+</tr>
+<tr>
+ <td>Id</td>
+ <td>${ h.text_field('id', size=5) }</td>
+ <td>a_href</td>
+ <td>${ h.text_field('a_href') }</td>
+</tr>
+<tr>
+ <td>img_src</td>
+ <td>${ h.text_field('img_src', size=5) }</td>
+ <td>desc</td>
+ <td>${ h.text_field('desc') }</td>
+</tr>
+</table>
+${ h.hidden_field('headindex', value = c.headdict['ixh']) }
+${ h.hidden_field('itemid', value=c.itemid) }
+
+${ h.submit('Add') }
+${ h.end_form() }
+</div>
+<script>
+var plugin = document.embeds[0];
+var input = document.api.ifield;
+var goto = document.api.gotofield;
+var output = document.api.ofield;
+
+function Play() {
+ plugin.play();
+ addOutput("Play!");
+}
+
+function Pause() {
+ plugin.pause();
+ addOutput("Pause!");
+}
+
+function SetLocation(location) {
+// plugin.setPlayPosition(location);
+ plugin.setCurrentMovie(location);
+ addOutput("Current movie: " + plugin.getCurrentMovie());
+ addOutput("setting a location: " + location + " ms");
+}
+
+function GetPlayPosition() {
+ addOutput("Play position: " + plugin.getPlayPosition() + " ms");
+}
+
+function skip(dir) {
+// addOutput("we get here")
+ i = getInput();
+ addOutput("i is " + i);
+ if (i <= 0) i = 1000;
+ addOutput("dir is " + dir);
+ t = plugin.getPlayPosition() + (i * dir);
+ addOutput("t is " + t);
+ addOutput("Skipping by " + i + " to " + t + " ms - " +
+ (plugin.setPlayPosition(t) ? "succeeded" : "failed"));
+}
+
+function getInput() {
+ i = parseInt(input.value);
+ return isNaN(i) ? 0 : i;
+}
+
+function getGoto() {
+ i = parseInt(goto.value);
+ return isNaN(i) ? 0 : i;
+}
+
+
+function GotoPosition() {
+ i = getGoto();
+ plugin.setPlayPosition(i);
+}
+
+var outLines = 0;
+
+function addOutput(str) {
+ if (outLines == 0) {
+ output.value = str;
+ } else {
+ output.value = str + "\n" + output.value;
+ }
+ outLines++;
+ if (outLines == 11) {
+ i = output.value.lastIndexOf("\n");
+ output.value = output.value.substr(0, i);
+ outLines--;
+ }
+}
+</script>
+
Added: arkaiv/trunk/arkaiv/templates/mainpage.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/mainpage.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/mainpage.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,13 @@
+<%inherit file="/autohandler"/>
+<h2>
+All items
+</h2>
+
+% for item in c.items:
+<li>
+ ${item.ixi}
+ ${ h.link_to(item.name, h.url(action="displayitem", edit="no", id=item[0])) }
+</li>
+% endfor
+
+
Added: arkaiv/trunk/arkaiv/templates/quick.css
===================================================================
--- arkaiv/trunk/arkaiv/templates/quick.css (rev 0)
+++ arkaiv/trunk/arkaiv/templates/quick.css 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,21 @@
+body {
+ background-color: #888;
+ margin: 25px;
+}
+div.content{
+ margin: 0;
+ margin-bottom: 10px;
+ background-color: #d3e0ea;
+ border: 5px solid #333;
+ padding: 5px 25px 25px 25px;
+}
+h1.main{
+ width: 100%;
+ border-bottom: 1px solid #000;
+}
+p.footer{
+ width: 100%;
+ padding-top: 3px;
+ border-top: 1px solid #000;
+}
+
Added: arkaiv/trunk/arkaiv/templates/search.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/search.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/search.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,13 @@
+<%inherit file="/autohandler"/>
+<h1 class="main">Search</h1>
+<p>
+${ h.form(h.url(action='search'), multipart=True) }
+<table>
+<tr>
+<td>Search terms:</td>
+<td>${ h.text_field('searchterms') } </td>
+</tr>
+</table>
+${ h.submit('Submit') }
+${ h.end_form() }
+
Added: arkaiv/trunk/arkaiv/templates/searchresults.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/searchresults.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/searchresults.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,41 @@
+<%inherit file="/autohandler"/>
+<h1>Search results</h1>
+
+% for item in c.items:
+<li>
+ ${item.ixi}
+ ${ h.link_to(item.name, h.url(action="displayitem", edit="no", id=item.ixi))}
+</li>
+% endfor
+<hr>
+Meta names:<p>
+<table>
+<tr>
+<td>Name</td>
+<td>Content</td>
+<td></td>
+</tr>
+% for metaresult in c.metas:
+<tr>
+<td>${metaresult['meta'].name}</td>
+<td>${metaresult['meta'].content}</td>
+<td>${ h.link_to(metaresult['item'].name, h.url(action="displayitem", edit="no", id=metaresult['item'].ixi))}</td>
+</tr>
+% endfor
+</table>
+<hr>
+Clips:
+<table>
+<tr>
+<td>id</td>
+<td>desc</td>
+<td></td>
+</tr>
+% for clipresult in c.clips:
+<tr>
+<td>${clipresult['clip'].id}</td>
+<td>${clipresult['clip'].desc}</td>
+<td>${ h.link_to(clipresult['item'].name, h.url(action="displayitem", edit="no", id=clipresult['item'].ixi, playclip=clipresult['clip'].id))}</td>
+</tr>
+% endfor
+</table>
Added: arkaiv/trunk/arkaiv/templates/serverinfo.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/serverinfo.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/serverinfo.mak 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,13 @@
+<h2>
+This is a main page
+</h2>
+
+<p>
+The URL you called: ${h.url_for()}
+</p>
+
+<p>
+The name you set: ${c.name}
+</p>
+
+
Added: arkaiv/trunk/arkaiv/tests/__init__.py
===================================================================
--- arkaiv/trunk/arkaiv/tests/__init__.py (rev 0)
+++ arkaiv/trunk/arkaiv/tests/__init__.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,40 @@
+"""Pylons application test package
+
+When the test runner finds and executes tests within this directory, this file
+will be loaded to setup the test environment.
+
+It registers the root directory of the project in sys.path and pkg_resources,
+in case the project hasn't been installed with setuptools. It also initializes
+the application via websetup (paster setup-app) with the project's test.ini
+configuration file.
+"""
+import os
+import sys
+from unittest import TestCase
+
+import pkg_resources
+import paste.fixture
+import paste.script.appinstall
+from paste.deploy import loadapp
+from routes import url_for
+
+__all__ = ['url_for', 'TestController']
+
+here_dir = os.path.dirname(os.path.abspath(__file__))
+conf_dir = os.path.dirname(os.path.dirname(here_dir))
+
+sys.path.insert(0, conf_dir)
+pkg_resources.working_set.add_entry(conf_dir)
+pkg_resources.require('Paste')
+pkg_resources.require('PasteScript')
+
+test_file = os.path.join(conf_dir, 'test.ini')
+cmd = paste.script.appinstall.SetupCommand('setup-app')
+cmd.run([test_file])
+
+class TestController(TestCase):
+
+ def __init__(self, *args, **kwargs):
+ wsgiapp = loadapp('config:test.ini', relative_to=conf_dir)
+ self.app = paste.fixture.TestApp(wsgiapp)
+ TestCase.__init__(self, *args, **kwargs)
Added: arkaiv/trunk/arkaiv/tests/functional/__init__.py
===================================================================
Added: arkaiv/trunk/arkaiv/tests/functional/test_play.py
===================================================================
--- arkaiv/trunk/arkaiv/tests/functional/test_play.py (rev 0)
+++ arkaiv/trunk/arkaiv/tests/functional/test_play.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,7 @@
+from arkaiv.tests import *
+
+class TestPlayController(TestController):
+
+ def test_index(self):
+ response = self.app.get(url_for(controller='play'))
+ # Test response...
Added: arkaiv/trunk/arkaiv/tests/test_models.py
===================================================================
Added: arkaiv/trunk/arkaiv/websetup.py
===================================================================
--- arkaiv/trunk/arkaiv/websetup.py (rev 0)
+++ arkaiv/trunk/arkaiv/websetup.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,15 @@
+"""Setup the arkaiv application"""
+from paste.deploy import appconfig
+from pylons import config
+
+from arkaiv.config.environment import load_environment
+
+def setup_config(command, filename, section, vars):
+ """Place any commands to setup arkaiv here"""
+ conf = appconfig('config:' + filename)
+ load_environment(conf.global_conf, conf.local_conf)
+
+ from arkaiv.lib.base import model
+ print "Creating tables"
+ model.sac.metadata.create_all()
+ print "Successfully setup"
Added: arkaiv/trunk/arkaiv/websetup.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/arkaiv/websetup.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/arkaiv.egg-info/PKG-INFO
===================================================================
--- arkaiv/trunk/arkaiv.egg-info/PKG-INFO (rev 0)
+++ arkaiv/trunk/arkaiv.egg-info/PKG-INFO 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: arkaiv
+Version: 0.1.2dev
+Summary: UNKNOWN
+Home-page: http://arkaiv.googlecode.com/files/arkaiv-0.1.2dev-py2.5.egg
+Author: Denis Crowdy
+Author-email: Denis.Crowdy at mq.edu.au
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
Added: arkaiv/trunk/arkaiv.egg-info/SOURCES.txt
===================================================================
--- arkaiv/trunk/arkaiv.egg-info/SOURCES.txt (rev 0)
+++ arkaiv/trunk/arkaiv.egg-info/SOURCES.txt 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,87 @@
+COPYING
+README.txt
+TODO
+development.ini
+development.ini.old
+setup.cfg
+setup.py
+svn-commit.tmp
+test.ini
+arkaiv/__init__.py
+arkaiv/__init__.pyc
+arkaiv/websetup.py
+arkaiv/websetup.pyc
+arkaiv.egg-info/PKG-INFO
+arkaiv.egg-info/SOURCES.txt
+arkaiv.egg-info/dependency_links.txt
+arkaiv.egg-info/entry_points.txt
+arkaiv.egg-info/paste_deploy_config.ini_tmpl
+arkaiv.egg-info/paster_plugins.txt
+arkaiv.egg-info/top_level.txt
+arkaiv/config/.middleware.py.swp
+arkaiv/config/__init__.py
+arkaiv/config/__init__.pyc
+arkaiv/config/environment.py
+arkaiv/config/environment.pyc
+arkaiv/config/middleware.py
+arkaiv/config/middleware.pyc
+arkaiv/config/routing.py
+arkaiv/config/routing.pyc
+arkaiv/controllers/__init__.py
+arkaiv/controllers/__init__.pyc
+arkaiv/controllers/error.py
+arkaiv/controllers/error.pyc
+arkaiv/controllers/page.py
+arkaiv/controllers/page.pyc
+arkaiv/controllers/play.py
+arkaiv/controllers/template.py
+arkaiv/lib/__init__.py
+arkaiv/lib/__init__.pyc
+arkaiv/lib/app_globals.py
+arkaiv/lib/app_globals.pyc
+arkaiv/lib/base.py
+arkaiv/lib/base.pyc
+arkaiv/lib/helpers.py
+arkaiv/lib/helpers.pyc
+arkaiv/model/__init__.py
+arkaiv/model/__init__.py.old
+arkaiv/model/__init__.pyc
+arkaiv/model/anxparser.py
+arkaiv/model/cmmlparser.py
+arkaiv/model/oggzinfo.py
+arkaiv/model/oggzinfo.pyc
+arkaiv/public/index.html
+arkaiv/public/quick.css
+arkaiv/public/images/blank.png
+arkaiv/templates/addannodexform.mak
+arkaiv/templates/addform.mak
+arkaiv/templates/autohandler
+arkaiv/templates/collectionexpanded.mak
+arkaiv/templates/collections.mak
+arkaiv/templates/confirmadd.mak
+arkaiv/templates/displayitem.mak
+arkaiv/templates/mainpage.mak
+arkaiv/templates/quick.css
+arkaiv/templates/search.mak
+arkaiv/templates/searchresults.mak
+arkaiv/templates/serverinfo.mak
+arkaiv/tests/__init__.py
+arkaiv/tests/test_models.py
+arkaiv/tests/functional/__init__.py
+arkaiv/tests/functional/test_play.py
+data/templates/addform.mak.py
+data/templates/addform.mak.pyc
+data/templates/autohandler.py
+data/templates/autohandler.pyc
+data/templates/collections.mak.py
+data/templates/collections.mak.pyc
+data/templates/confirmadd.mak.py
+data/templates/confirmadd.mak.pyc
+data/templates/displayitem.mak.py
+data/templates/displayitem.mak.pyc
+data/templates/mainpage.mak.py
+data/templates/mainpage.mak.pyc
+docs/index.txt
+ez_setup/README.txt
+ez_setup/__init__.py
+ez_setup/__init__.pyc
Added: arkaiv/trunk/arkaiv.egg-info/dependency_links.txt
===================================================================
--- arkaiv/trunk/arkaiv.egg-info/dependency_links.txt (rev 0)
+++ arkaiv/trunk/arkaiv.egg-info/dependency_links.txt 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1 @@
+
Added: arkaiv/trunk/arkaiv.egg-info/entry_points.txt
===================================================================
--- arkaiv/trunk/arkaiv.egg-info/entry_points.txt (rev 0)
+++ arkaiv/trunk/arkaiv.egg-info/entry_points.txt 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,6 @@
+
+ [paste.app_factory]
+ main=arkaiv:make_app
+ [paste.app_install]
+ main=pylons.util:PylonsInstaller
+
\ No newline at end of file
Added: arkaiv/trunk/arkaiv.egg-info/paste_deploy_config.ini_tmpl
===================================================================
--- arkaiv/trunk/arkaiv.egg-info/paste_deploy_config.ini_tmpl (rev 0)
+++ arkaiv/trunk/arkaiv.egg-info/paste_deploy_config.ini_tmpl 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,58 @@
+#
+# arkaiv - Pylons configuration
+#
+# The %(here)s variable will be replaced with the parent directory of this file
+#
+[DEFAULT]
+debug = true
+email_to = you at yourdomain.com
+smtp_server = localhost
+error_email_from = paste at localhost
+
+[server:main]
+use = egg:Paste#http
+host = 0.0.0.0
+port = 5000
+
+[app:main]
+use = egg:arkaiv
+full_stack = True
+cache_dir = %(here)s/data
+beaker.session.key = arkaiv
+beaker.session.secret = somesecret
+app_instance_uuid = ${app_instance_uuid}
+
+# 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:
+#beaker.cache.data_dir = %(here)s/data/cache
+#beaker.session.data_dir = %(here)s/data/sessions
+
+# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
+# Debug mode will enable the interactive debugging tool, allowing ANYONE to
+# execute malicious code after an exception is raised.
+set debug = false
+
+
+# Logging Setup
+[loggers]
+keys = root
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s
Added: arkaiv/trunk/arkaiv.egg-info/paster_plugins.txt
===================================================================
--- arkaiv/trunk/arkaiv.egg-info/paster_plugins.txt (rev 0)
+++ arkaiv/trunk/arkaiv.egg-info/paster_plugins.txt 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,3 @@
+Pylons
+WebHelpers
+PasteScript
Added: arkaiv/trunk/arkaiv.egg-info/requires.txt
===================================================================
--- arkaiv/trunk/arkaiv.egg-info/requires.txt (rev 0)
+++ arkaiv/trunk/arkaiv.egg-info/requires.txt 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1 @@
+Pylons>=0.9.5
\ No newline at end of file
Added: arkaiv/trunk/arkaiv.egg-info/top_level.txt
===================================================================
--- arkaiv/trunk/arkaiv.egg-info/top_level.txt (rev 0)
+++ arkaiv/trunk/arkaiv.egg-info/top_level.txt 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1 @@
+arkaiv
Added: arkaiv/trunk/data/templates/addannodexform.mak.py
===================================================================
--- arkaiv/trunk/data/templates/addannodexform.mak.py (rev 0)
+++ arkaiv/trunk/data/templates/addannodexform.mak.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,53 @@
+from mako import runtime, filters, cache
+UNDEFINED = runtime.UNDEFINED
+_magic_number = 2
+_modified_time = 1188348748.196075
+_template_filename='/home/dcrowdy/src/working/arkaiv/arkaiv/templates/addannodexform.mak'
+_template_uri='/addannodexform.mak'
+_template_cache=cache.Cache(__name__, _modified_time)
+_source_encoding=None
+_exports = []
+
+
+def _mako_get_namespace(context, name):
+ try:
+ return context.namespaces[(__name__, name)]
+ except KeyError:
+ _mako_generate_namespaces(context)
+ return context.namespaces[(__name__, name)]
+def _mako_generate_namespaces(context):
+ pass
+def _mako_inherit(template, context):
+ _mako_generate_namespaces(context)
+ return runtime._inherit_from(context, u'/autohandler', _template_uri)
+def render_body(context,**pageargs):
+ context.caller_stack.push_frame()
+ try:
+ __M_locals = dict(pageargs=pageargs)
+ h = context.get('h', UNDEFINED)
+ c = context.get('c', UNDEFINED)
+ # SOURCE LINE 1
+ context.write(u' \n<h1 class="main">Add annodex media</h1>\n\nThe page where data gets added.\n\n')
+ # SOURCE LINE 6
+ context.write(unicode( h.form(h.url(action='addannodexmedia'), multipart=True) ))
+ context.write(u' \n<table>\n<tr>\n<td>Upload OGG file:</td>\n<td>')
+ # SOURCE LINE 10
+ context.write(unicode( h.file_field('oggfile') ))
+ context.write(u' </td>\n</tr>\n<tr>\n<td>Upload CMML file:</td>\n<td>')
+ # SOURCE LINE 14
+ context.write(unicode( h.file_field('cmmlfile') ))
+ context.write(u' (if left blank, will be created) </td>\n</tr>\n<tr>\n<td>Collection:</td>\n<td>')
+ # SOURCE LINE 18
+ context.write(unicode( h.select("collection", c.collectioninfo)))
+ context.write(u'</td>\n</tr>\n</table>\n')
+ # SOURCE LINE 21
+ context.write(unicode( h.submit('Submit') ))
+ context.write(u' \n')
+ # SOURCE LINE 22
+ context.write(unicode( h.end_form() ))
+ context.write(u' \n\n')
+ return ''
+ finally:
+ context.caller_stack.pop_frame()
+
+
Added: arkaiv/trunk/data/templates/addannodexform.mak.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/data/templates/addannodexform.mak.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/data/templates/addform.mak.py
===================================================================
--- arkaiv/trunk/data/templates/addform.mak.py (rev 0)
+++ arkaiv/trunk/data/templates/addform.mak.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,65 @@
+from mako import runtime, filters, cache
+UNDEFINED = runtime.UNDEFINED
+_magic_number = 2
+_modified_time = 1187671717.3177841
+_template_filename='/home/dcrowdy/src/working/svn/arkaiv/templates/addform.mak'
+_template_uri='/addform.mak'
+_template_cache=cache.Cache(__name__, _modified_time)
+_source_encoding=None
+_exports = []
+
+
+def _mako_get_namespace(context, name):
+ try:
+ return context.namespaces[(__name__, name)]
+ except KeyError:
+ _mako_generate_namespaces(context)
+ return context.namespaces[(__name__, name)]
+def _mako_generate_namespaces(context):
+ pass
+def _mako_inherit(template, context):
+ _mako_generate_namespaces(context)
+ return runtime._inherit_from(context, u'/autohandler', _template_uri)
+def render_body(context,**pageargs):
+ context.caller_stack.push_frame()
+ try:
+ __M_locals = dict(pageargs=pageargs)
+ h = context.get('h', UNDEFINED)
+ c = context.get('c', UNDEFINED)
+ # SOURCE LINE 1
+ context.write(u' \n<h1 class="main">Add media</h1>\n\nThe page where data gets added.\n\n')
+ # SOURCE LINE 6
+ context.write(unicode( h.form(h.url(action='addmedia'), multipart=True) ))
+ context.write(u' \n<table>\n<tr>\n<td>Upload file:</td>\n<td>')
+ # SOURCE LINE 10
+ context.write(unicode( h.file_field('myfile') ))
+ context.write(u' </td>\n</tr>\n<tr>\n<td>File description:</td>\n<td>')
+ # SOURCE LINE 14
+ context.write(unicode( h.text_field('itemname') ))
+ context.write(u'</td>\n</tr>\n')
+ # SOURCE LINE 16
+ context.write(unicode( h.form(h.url(action='addheadinfo'), multipart=True) ))
+ context.write(u'\n<tr>\n<td>Head id:</td>\n<td>')
+ # SOURCE LINE 19
+ context.write(unicode( h.text_field('headid') ))
+ context.write(u'</td>\n</tr>\n<tr>\n<td>Head title:</td>\n<td>')
+ # SOURCE LINE 23
+ context.write(unicode( h.text_field('headtitle') ))
+ context.write(u'</td>\n</tr>\n<tr>\n<td>Collection:</td>\n<td>')
+ # SOURCE LINE 27
+ context.write(unicode( h.select("collection", c.collectioninfo)))
+ context.write(u'\n</table>\n')
+ # SOURCE LINE 29
+ context.write(unicode( h.hidden_field('itemid') ))
+ context.write(u'\n\n')
+ # SOURCE LINE 31
+ context.write(unicode( h.submit('Submit') ))
+ context.write(u' \n')
+ # SOURCE LINE 32
+ context.write(unicode( h.end_form() ))
+ context.write(u' \n\n')
+ return ''
+ finally:
+ context.caller_stack.pop_frame()
+
+
Added: arkaiv/trunk/data/templates/addform.mak.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/data/templates/addform.mak.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/data/templates/autohandler.py
===================================================================
--- arkaiv/trunk/data/templates/autohandler.py (rev 0)
+++ arkaiv/trunk/data/templates/autohandler.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,57 @@
+from mako import runtime, filters, cache
+UNDEFINED = runtime.UNDEFINED
+_magic_number = 2
+_modified_time = 1188266307.842114
+_template_filename=u'/home/dcrowdy/src/working/svn/arkaiv/templates/autohandler'
+_template_uri=u'/autohandler'
+_template_cache=cache.Cache(__name__, _modified_time)
+_source_encoding=None
+_exports = []
+
+
+def render_body(context,**pageargs):
+ context.caller_stack.push_frame()
+ try:
+ __M_locals = dict(pageargs=pageargs)
+ h = context.get('h', UNDEFINED)
+ next = context.get('next', UNDEFINED)
+ # SOURCE LINE 1
+ context.write(u'<html>\n <head>\n <title>Arkaiv</title>\n <link rel="stylesheet" href="/quick.css"></link>\n')
+ # SOURCE LINE 5
+ context.write(unicode( h.javascript_include_tag('/javascripts/effects.js', builtins=True) ))
+ context.write(u' \n\n </head>\n <body>\n <p class="header">\n<h1>Arkaiv</h1>\n<table>\n<tr>\n<td>')
+ # SOURCE LINE 13
+ context.write(unicode( h.link_to("All Items", h.url(action="mainpage")) ))
+ context.write(u' </td>\n<td>')
+ # SOURCE LINE 14
+ context.write(unicode( h.link_to("Collections", h.url(action="collections")) ))
+ context.write(u' </td>\n<!-- ')
+ # SOURCE LINE 15
+ context.write(unicode( h.link_to("Add media", h.url(action="displayadd")) ))
+ context.write(u'-->\n<td>')
+ # SOURCE LINE 16
+ context.write(unicode( h.link_to("Add annodex media", h.url(action="addannodexform")) ))
+ context.write(u'</td>\n<!--')
+ # SOURCE LINE 17
+ context.write(unicode( h.link_to("Add all annodex media in dir", h.url(action="addannodexindirform")) ))
+ context.write(u'-->\n<td>\n')
+ # SOURCE LINE 19
+ context.write(unicode( h.form(h.url(action='search'), multipart=True) ))
+ context.write(u' \nSearch terms:\n')
+ # SOURCE LINE 21
+ context.write(unicode( h.text_field('searchterms') ))
+ context.write(u' \n')
+ # SOURCE LINE 22
+ context.write(unicode( h.submit('Submit') ))
+ context.write(u' \n')
+ # SOURCE LINE 23
+ context.write(unicode( h.end_form() ))
+ context.write(u' \n</td>\n</tr>\n</table>\n </p>\n <!--div class="content"-->\n')
+ # SOURCE LINE 29
+ context.write(unicode(next.body()))
+ context.write(u'\n <p class="footer">\n </p>\n <!--/div-->\n </body>\n</html>\n\n')
+ return ''
+ finally:
+ context.caller_stack.pop_frame()
+
+
Added: arkaiv/trunk/data/templates/autohandler.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/data/templates/autohandler.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/data/templates/collectionexpanded.mak.py
===================================================================
--- arkaiv/trunk/data/templates/collectionexpanded.mak.py (rev 0)
+++ arkaiv/trunk/data/templates/collectionexpanded.mak.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,50 @@
+from mako import runtime, filters, cache
+UNDEFINED = runtime.UNDEFINED
+_magic_number = 2
+_modified_time = 1188348772.403481
+_template_filename='/home/dcrowdy/src/working/arkaiv/arkaiv/templates/collectionexpanded.mak'
+_template_uri='/collectionexpanded.mak'
+_template_cache=cache.Cache(__name__, _modified_time)
+_source_encoding=None
+_exports = []
+
+
+def _mako_get_namespace(context, name):
+ try:
+ return context.namespaces[(__name__, name)]
+ except KeyError:
+ _mako_generate_namespaces(context)
+ return context.namespaces[(__name__, name)]
+def _mako_generate_namespaces(context):
+ pass
+def _mako_inherit(template, context):
+ _mako_generate_namespaces(context)
+ return runtime._inherit_from(context, u'/autohandler', _template_uri)
+def render_body(context,**pageargs):
+ context.caller_stack.push_frame()
+ try:
+ __M_locals = dict(pageargs=pageargs)
+ h = context.get('h', UNDEFINED)
+ c = context.get('c', UNDEFINED)
+ # SOURCE LINE 1
+ context.write(u' \n<h2>\nCollection: ')
+ # SOURCE LINE 3
+ context.write(unicode( c.collname))
+ context.write(u'\n</h2>\n\n')
+ # SOURCE LINE 6
+ for item in c.items:
+ # SOURCE LINE 7
+ context.write(u'<li>\n ')
+ # SOURCE LINE 8
+ context.write(unicode(item.ixi))
+ context.write(u' \n ')
+ # SOURCE LINE 9
+ context.write(unicode( h.link_to(item.name, h.url(action="displayitem", edit="no", id=item.ixi)) ))
+ context.write(u'\n</li>\n')
+ # SOURCE LINE 12
+ context.write(u'\n\n')
+ return ''
+ finally:
+ context.caller_stack.pop_frame()
+
+
Added: arkaiv/trunk/data/templates/collectionexpanded.mak.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/data/templates/collectionexpanded.mak.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/data/templates/collections.mak.py
===================================================================
--- arkaiv/trunk/data/templates/collections.mak.py (rev 0)
+++ arkaiv/trunk/data/templates/collections.mak.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,59 @@
+from mako import runtime, filters, cache
+UNDEFINED = runtime.UNDEFINED
+_magic_number = 2
+_modified_time = 1187671713.365315
+_template_filename='/home/dcrowdy/src/working/svn/arkaiv/templates/collections.mak'
+_template_uri='/collections.mak'
+_template_cache=cache.Cache(__name__, _modified_time)
+_source_encoding=None
+_exports = []
+
+
+def _mako_get_namespace(context, name):
+ try:
+ return context.namespaces[(__name__, name)]
+ except KeyError:
+ _mako_generate_namespaces(context)
+ return context.namespaces[(__name__, name)]
+def _mako_generate_namespaces(context):
+ pass
+def _mako_inherit(template, context):
+ _mako_generate_namespaces(context)
+ return runtime._inherit_from(context, u'/autohandler', _template_uri)
+def render_body(context,**pageargs):
+ context.caller_stack.push_frame()
+ try:
+ __M_locals = dict(pageargs=pageargs)
+ h = context.get('h', UNDEFINED)
+ c = context.get('c', UNDEFINED)
+ # SOURCE LINE 1
+ context.write(u' \n<h2>\nCollections\n</h2>\n\n')
+ # SOURCE LINE 6
+ for coll in c.collections:
+ # SOURCE LINE 7
+ context.write(u'<li>\n ')
+ # SOURCE LINE 8
+ context.write(unicode(coll[0]))
+ context.write(u' \n ')
+ # SOURCE LINE 9
+ context.write(unicode( h.link_to(coll[1], h.url(action="displaycollection", edit="no", id=coll[0], name=coll[1])) ))
+ context.write(u'\n</li>\n')
+ # SOURCE LINE 12
+ context.write(u'\n<hr>\nAdd new collection:\n')
+ # SOURCE LINE 15
+ context.write(unicode( h.form(h.url(action='addcollection'), multipart=True) ))
+ context.write(u' \n')
+ # SOURCE LINE 16
+ context.write(unicode( h.text_field('newcollection') ))
+ context.write(u'\n')
+ # SOURCE LINE 17
+ context.write(unicode( h.submit('Add') ))
+ context.write(u' \n')
+ # SOURCE LINE 18
+ context.write(unicode( h.end_form() ))
+ context.write(u' \n\n')
+ return ''
+ finally:
+ context.caller_stack.pop_frame()
+
+
Added: arkaiv/trunk/data/templates/collections.mak.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/data/templates/collections.mak.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/data/templates/confirmadd.mak.py
===================================================================
--- arkaiv/trunk/data/templates/confirmadd.mak.py (rev 0)
+++ arkaiv/trunk/data/templates/confirmadd.mak.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,33 @@
+from mako import runtime, filters, cache
+UNDEFINED = runtime.UNDEFINED
+_magic_number = 2
+_modified_time = 1187149992.3820231
+_template_filename='/home/dcrowdy/src/working/tmp/arkaiv/arkaiv/templates/confirmadd.mak'
+_template_uri='/confirmadd.mak'
+_template_cache=cache.Cache(__name__, _modified_time)
+_source_encoding=None
+_exports = []
+
+
+def _mako_get_namespace(context, name):
+ try:
+ return context.namespaces[(__name__, name)]
+ except KeyError:
+ _mako_generate_namespaces(context)
+ return context.namespaces[(__name__, name)]
+def _mako_generate_namespaces(context):
+ pass
+def _mako_inherit(template, context):
+ _mako_generate_namespaces(context)
+ return runtime._inherit_from(context, u'/autohandler', _template_uri)
+def render_body(context,**pageargs):
+ context.caller_stack.push_frame()
+ try:
+ __M_locals = dict(pageargs=pageargs)
+ # SOURCE LINE 1
+ context.write(u' \n<p>\nMedia added as requested...\n</p>\n')
+ return ''
+ finally:
+ context.caller_stack.pop_frame()
+
+
Added: arkaiv/trunk/data/templates/confirmadd.mak.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/data/templates/confirmadd.mak.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/data/templates/displayitem.mak.py
===================================================================
--- arkaiv/trunk/data/templates/displayitem.mak.py (rev 0)
+++ arkaiv/trunk/data/templates/displayitem.mak.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,215 @@
+from mako import runtime, filters, cache
+UNDEFINED = runtime.UNDEFINED
+_magic_number = 2
+_modified_time = 1188280722.8129909
+_template_filename='/home/dcrowdy/src/working/svn/arkaiv/templates/displayitem.mak'
+_template_uri='/displayitem.mak'
+_template_cache=cache.Cache(__name__, _modified_time)
+_source_encoding=None
+_exports = []
+
+
+def _mako_get_namespace(context, name):
+ try:
+ return context.namespaces[(__name__, name)]
+ except KeyError:
+ _mako_generate_namespaces(context)
+ return context.namespaces[(__name__, name)]
+def _mako_generate_namespaces(context):
+ pass
+def _mako_inherit(template, context):
+ _mako_generate_namespaces(context)
+ return runtime._inherit_from(context, u'/autohandler', _template_uri)
+def render_body(context,**pageargs):
+ context.caller_stack.push_frame()
+ try:
+ __M_locals = dict(pageargs=pageargs)
+ h = context.get('h', UNDEFINED)
+ c = context.get('c', UNDEFINED)
+ # SOURCE LINE 1
+ context.write(u' \n<div id="video">\nItem: <p id="edititemname">')
+ # SOURCE LINE 3
+ context.write(unicode(c.itemname))
+ context.write(u'</p>\n<script type="text/javascript">\n new Ajax.InPlaceEditor(\'edititemname\', \'/page/edititemname\', { callback: function(form, value) { return \'itemid=')
+ # SOURCE LINE 5
+ context.write(unicode(c.itemid))
+ context.write(u"&myparam=' + escape(value) }});\n</script>\n\n\n")
+ # SOURCE LINE 9
+ context.write(unicode( h.form(h.url(action='deleteitem'), multipart=True) ))
+ context.write(u'\n')
+ # SOURCE LINE 10
+ context.write(unicode( h.submit('Delete') ))
+ context.write(u' \n')
+ # SOURCE LINE 11
+ context.write(unicode( h.hidden_field('itemid', value=c.itemid) ))
+ context.write(u'\n')
+ # SOURCE LINE 12
+ context.write(unicode( h.end_form() ))
+ context.write(u' \n \n <embed type="application/liboggplay"\n src="')
+ # SOURCE LINE 15
+ context.write(unicode(c.sourcedict['urlpath']))
+ context.write(u'"\n width="320" height="240"/>\n<form name="api">\n<table>\n<tr>\n<td><input type="button" value="Skip back" onclick=\'skip(-1)\'/></td>\n<td><input type="button" value="Play" onclick=\'Play()\'/></td>\n<td><input type="button" value="Pause" onclick=\'Pause()\'/></td>\n<td><input type="button" value="Skip forward" onclick=\'skip(1)\'/></td>\n<td><input type="button" value="Get position" onclick=\'GetPlayPosition()\'/></td>\n<td><input type="button" value="Go to pos" onclick=\'GotoPosition()\'/>\n<input type="text" name="gotofield" size="5"/></td>\n</tr>\n</table>\nOutput:\n<textarea name="ofield" cols="40" rows="4"></textarea>\nInput:\n<input type="text" name="ifield" size="20"/><br>\n</form>\n\n<hr>\nHead:\n')
+ # SOURCE LINE 37
+ context.write(unicode( h.form(h.url(action='editheadinfo'), multipart=True) ))
+ context.write(u'\nid:\n')
+ # SOURCE LINE 39
+ context.write(unicode( h.text_field('headid', value=c.headdict['id']) ))
+ context.write(u'\nTitle:\n')
+ # SOURCE LINE 41
+ context.write(unicode( h.text_field('headtitle', value=c.headdict['title']) ))
+ context.write(u'\n')
+ # SOURCE LINE 42
+ context.write(unicode( h.hidden_field('itemid', value=c.itemid) ))
+ context.write(u'\n\n')
+ # SOURCE LINE 44
+ context.write(unicode( h.submit('Edit') ))
+ context.write(u' \n')
+ # SOURCE LINE 45
+ context.write(unicode( h.end_form() ))
+ context.write(u' \n<br />\n<hr>\nMeta information:<br />\n<table style="font-size:small">\n<tr>\n <td>Name</td>\n <td>Content</td>\n</tr>\n')
+ # SOURCE LINE 54
+ for metainfo in c.metalist:
+ # SOURCE LINE 55
+ context.write(u'<tr>\n<td>\n<p id="editmetaname">')
+ # SOURCE LINE 57
+ context.write(unicode(metainfo['name']))
+ context.write(u'</p>\n<script type="text/javascript">\n new Ajax.InPlaceEditor(\'editmetaname\', \'/page/editheadmetaname\', { callback: function(form, value) { return \'id=')
+ # SOURCE LINE 59
+ context.write(unicode(metainfo['id']))
+ context.write(u'&field=name&itemid=')
+ context.write(unicode(c.itemid))
+ context.write(u'&myparam=\' + escape(value) }});\n</script>\n</td>\n<td>\n<p id="editmetacontent">')
+ # SOURCE LINE 63
+ context.write(unicode(metainfo['content']))
+ context.write(u'</p>\n<script type="text/javascript">\n new Ajax.InPlaceEditor(\'editmetacontent\', \'/page/editheadmetaname\', { callback: function(form, value) { return \'id=')
+ # SOURCE LINE 65
+ context.write(unicode(metainfo['id']))
+ context.write(u'&field=content&itemid=')
+ context.write(unicode(c.itemid))
+ context.write(u"&myparam=' + escape(value) }});\n</script>\n</td>\n</tr> \n")
+ # SOURCE LINE 70
+ context.write(u'</table>\n<hr>\nAdd new meta tag:\n')
+ # SOURCE LINE 73
+ context.write(unicode( h.form(h.url(action='addmetainfo'), multipart=True) ))
+ context.write(u'\n<table>\n<tr>\n <td>Id</td>\n <td>Name</td>\n <td>Content</td>\n <td>Scheme</td>\n</tr>\n\n<tr>\n <td> ')
+ # SOURCE LINE 83
+ context.write(unicode( h.text_field('metaid', size=5) ))
+ context.write(u'</td>\n <td>')
+ # SOURCE LINE 84
+ context.write(unicode( h.text_field('metaname') ))
+ context.write(u'</td>\n <td>')
+ # SOURCE LINE 85
+ context.write(unicode( h.text_field('metacontent') ))
+ context.write(u'</td>\n <td>')
+ # SOURCE LINE 86
+ context.write(unicode( h.hidden_field('metascheme') ))
+ context.write(u'</td>\n</tr>\n</table>\n')
+ # SOURCE LINE 89
+ context.write(unicode( h.hidden_field('headindex', value = c.headdict['ixh']) ))
+ context.write(u'\n')
+ # SOURCE LINE 90
+ context.write(unicode( h.hidden_field('itemid', value=c.itemid) ))
+ context.write(u'\n\n')
+ # SOURCE LINE 92
+ context.write(unicode( h.submit('Add') ))
+ context.write(u' \n')
+ # SOURCE LINE 93
+ context.write(unicode( h.end_form() ))
+ context.write(u' \n\n<hr>\n\n\n<!--div class="sourceinfo"-->\n<table style="font-size:small">\n<tr>\n<td>Duration:</td><td> ')
+ # SOURCE LINE 101
+ context.write(unicode(c.sourcedict['duration']))
+ context.write(u'</td>\n</tr>\n<tr>\n<td>Bitrate: </td><td>')
+ # SOURCE LINE 104
+ context.write(unicode(c.sourcedict['bitrate']))
+ context.write(u'</td>\n</tr>\n<tr>\n<td>Resolution: </td><td>')
+ # SOURCE LINE 107
+ context.write(unicode(c.sourcedict['resolution']))
+ context.write(u'</td>\n</tr>\n<tr>\n<td>Framerate: </td><td>')
+ # SOURCE LINE 110
+ context.write(unicode(c.sourcedict['framerate']))
+ context.write(u'</td>\n</tr>\n<tr>\n<td>Audio: </td><td>')
+ # SOURCE LINE 113
+ context.write(unicode(c.sourcedict['audio']))
+ context.write(u'</td>\n</tr>\n<tr>\n<td>Has video: </td><td>')
+ # SOURCE LINE 116
+ context.write(unicode(c.sourcedict['has_video']))
+ context.write(u'</td>\n</tr>\n<tr>\n<td>Has audio: </td><td>')
+ # SOURCE LINE 119
+ context.write(unicode(c.sourcedict['has_audio']))
+ context.write(u'</td>\n</tr>\n</table>\n\n<!--/div!-->\n</div>\n\n<div id="clips">\nClips:\n<br />\n<table style="font-size:small">\n<tr>\n <td></td>\n <td>Start time</td>\n <td>Id</td>\n <td>Description</td>\n <td>a_href</td> \n</tr>\n')
+ # SOURCE LINE 137
+ for clipinfo in c.cliplist:
+ # SOURCE LINE 138
+ context.write(u'<tr>\n <td><a onclick="javascript:SetLocation(\'')
+ # SOURCE LINE 139
+ context.write(unicode(c.sourcedict['urlpath']))
+ context.write(u'?id=')
+ context.write(unicode(clipinfo['id']))
+ context.write(u'\')"><img width=60 height=40 src="/images/blank.png"></a></td>\n <td>')
+ # SOURCE LINE 140
+ context.write(unicode(clipinfo['start_time']))
+ context.write(u'</td>\n <td>')
+ # SOURCE LINE 141
+ context.write(unicode(clipinfo['id']))
+ context.write(u'</td>\n <td>')
+ # SOURCE LINE 142
+ context.write(unicode(clipinfo['desc']))
+ context.write(u'</td>\n <td>')
+ # SOURCE LINE 143
+ context.write(unicode(clipinfo['a_href']))
+ context.write(u'</td>\n\n\n')
+ # SOURCE LINE 146
+ context.write(unicode( h.form(h.url(action='deleteclip'), multipart=True) ))
+ context.write(u'\n<td>')
+ # SOURCE LINE 147
+ context.write(unicode( h.submit('Delete') ))
+ context.write(u' </td>\n')
+ # SOURCE LINE 148
+ context.write(unicode( h.hidden_field('clipid', value=clipinfo['ixc']) ))
+ context.write(u'\n')
+ # SOURCE LINE 149
+ context.write(unicode( h.hidden_field('itemid', value=c.itemid) ))
+ context.write(u'\n')
+ # SOURCE LINE 150
+ context.write(unicode( h.end_form() ))
+ context.write(u' \n\n\n</tr> \n')
+ # SOURCE LINE 155
+ context.write(u'</table>\n\nAdd new clip:\n')
+ # SOURCE LINE 158
+ context.write(unicode( h.form(h.url(action='addclip'), multipart=True) ))
+ context.write(u'\n<table>\n<tr>\n <td>Start time</td>\n <td>')
+ # SOURCE LINE 162
+ context.write(unicode( h.text_field('starttime', size=5) ))
+ context.write(u'</td>\n <td>a_text</td>\n <td>')
+ # SOURCE LINE 164
+ context.write(unicode( h.text_field('a_text') ))
+ context.write(u'</td>\n</tr>\n<tr>\n <td>Id</td>\n <td>')
+ # SOURCE LINE 168
+ context.write(unicode( h.text_field('id', size=5) ))
+ context.write(u'</td>\n <td>a_href</td>\n <td>')
+ # SOURCE LINE 170
+ context.write(unicode( h.text_field('a_href') ))
+ context.write(u'</td>\n</tr>\n<tr>\n <td>img_src</td>\n <td>')
+ # SOURCE LINE 174
+ context.write(unicode( h.text_field('img_src', size=5) ))
+ context.write(u'</td>\n <td>desc</td>\n <td>')
+ # SOURCE LINE 176
+ context.write(unicode( h.text_field('desc') ))
+ context.write(u'</td>\n</tr>\n</table>\n')
+ # SOURCE LINE 179
+ context.write(unicode( h.hidden_field('headindex', value = c.headdict['ixh']) ))
+ context.write(u'\n')
+ # SOURCE LINE 180
+ context.write(unicode( h.hidden_field('itemid', value=c.itemid) ))
+ context.write(u'\n\n')
+ # SOURCE LINE 182
+ context.write(unicode( h.submit('Add') ))
+ context.write(u' \n')
+ # SOURCE LINE 183
+ context.write(unicode( h.end_form() ))
+ context.write(u' \n</div>\n<script>\nvar plugin = document.embeds[0];\nvar input = document.api.ifield;\nvar goto = document.api.gotofield;\nvar output = document.api.ofield;\n\nfunction Play() {\n plugin.play();\n addOutput("Play!");\n}\n\nfunction Pause() {\n plugin.pause();\n addOutput("Pause!");\n}\n\nfunction SetLocation(location) {\n// plugin.setPlayPosition(location);\n plugin.setCurrentMovie(location);\n addOutput("Current movie: " + plugin.getCurrentMovie());\n addOutput("setting a location: " + location + " ms");\n}\n\nfunction GetPlayPosition() {\n addOutput("Play position: " + plugin.getPlayPosition() + " ms");\n}\n\nfunction skip(dir) {\n// addOutput("we get here")\n i = getInput();\n addOutput("i is " + i);\n if (i <= 0) i = 1000;\n addOutput("dir is " + dir);\n t = plugin.getPlayPosition() + (i * dir);\n addOutput("t is " + t);\n addOutput("Skipping by " + i + " to " + t + " ms - " +\n (plugin.setPlayPosition(t) ? "succeeded" : "failed"));\n}\n\nfunction getInput() {\n i = parseInt(input.value);\n return isNaN(i) ? 0 : i;\n}\n\nfunction getGoto() {\n i = parseInt(goto.value);\n return isNaN(i) ? 0 : i;\n}\n\n\nfunction GotoPosition() {\n i = getGoto();\n plugin.setPlayPosition(i);\n}\n\nvar outLines = 0;\n\nfunction addOutput(str) {\n if (outLines == 0) {\n output.value = str;\n } else {\n output.value = str + "\\n" + output.value;\n }\n outLines++;\n if (outLines == 11) {\n i = output.value.lastIndexOf("\\n");\n output.value = output.value.substr(0, i);\n outLines--;\n }\n}\n</script>\n\n')
+ return ''
+ finally:
+ context.caller_stack.pop_frame()
+
+
Added: arkaiv/trunk/data/templates/displayitem.mak.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/data/templates/displayitem.mak.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/data/templates/mainpage.mak.py
===================================================================
--- arkaiv/trunk/data/templates/mainpage.mak.py (rev 0)
+++ arkaiv/trunk/data/templates/mainpage.mak.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,47 @@
+from mako import runtime, filters, cache
+UNDEFINED = runtime.UNDEFINED
+_magic_number = 2
+_modified_time = 1187580976.972198
+_template_filename='/home/dcrowdy/src/working/svn/arkaiv/templates/mainpage.mak'
+_template_uri='/mainpage.mak'
+_template_cache=cache.Cache(__name__, _modified_time)
+_source_encoding=None
+_exports = []
+
+
+def _mako_get_namespace(context, name):
+ try:
+ return context.namespaces[(__name__, name)]
+ except KeyError:
+ _mako_generate_namespaces(context)
+ return context.namespaces[(__name__, name)]
+def _mako_generate_namespaces(context):
+ pass
+def _mako_inherit(template, context):
+ _mako_generate_namespaces(context)
+ return runtime._inherit_from(context, u'/autohandler', _template_uri)
+def render_body(context,**pageargs):
+ context.caller_stack.push_frame()
+ try:
+ __M_locals = dict(pageargs=pageargs)
+ h = context.get('h', UNDEFINED)
+ c = context.get('c', UNDEFINED)
+ # SOURCE LINE 1
+ context.write(u' \n<h2>\nAll items\n</h2>\n\n')
+ # SOURCE LINE 6
+ for item in c.items:
+ # SOURCE LINE 7
+ context.write(u'<li>\n ')
+ # SOURCE LINE 8
+ context.write(unicode(item.ixi))
+ context.write(u' \n ')
+ # SOURCE LINE 9
+ context.write(unicode( h.link_to(item.name, h.url(action="displayitem", edit="no", id=item[0])) ))
+ context.write(u'\n</li>\n')
+ # SOURCE LINE 12
+ context.write(u'\n\n')
+ return ''
+ finally:
+ context.caller_stack.pop_frame()
+
+
Added: arkaiv/trunk/data/templates/mainpage.mak.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/data/templates/mainpage.mak.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/development.ini
===================================================================
--- arkaiv/trunk/development.ini (rev 0)
+++ arkaiv/trunk/development.ini 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,66 @@
+#
+# arkaiv - Pylons development environment configuration
+#
+# The %(here)s variable will be replaced with the parent directory of this file
+#
+[DEFAULT]
+debug = true
+email_to = Denis.Crowdy at mq.edu.au
+smtp_server = localhost
+error_email_from = paste at localhost
+media_path_base = /var/www/
+archive_loc = /var/www/arkaiv/
+
+[server:main]
+use = egg:Paste#http
+host = 0.0.0.0
+port = 5000
+
+[app:main]
+use = egg:arkaiv
+full_stack = True
+cache_dir = %(here)s/data
+beaker.session.key = arkaiv
+beaker.session.secret = somesecret
+sqlalchemy.default.uri = sqlite:///arkaiv.db
+sqlalchemy.echo = true
+authkit.enable = true
+authkit.method = digest
+authkit.users.setup = user:pylons
+
+
+# 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:
+#beaker.cache.data_dir = %(here)s/data/cache
+#beaker.session.data_dir = %(here)s/data/sessions
+
+# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
+# Debug mode will enable the interactive debugging tool, allowing ANYONE to
+# execute malicious code after an exception is raised.
+#set debug = false
+
+
+# Logging Setup
+[loggers]
+keys = root
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
+datefmt = %H:%M:%S
Added: arkaiv/trunk/docs/index.txt
===================================================================
--- arkaiv/trunk/docs/index.txt (rev 0)
+++ arkaiv/trunk/docs/index.txt 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,12 @@
+arkaiv
+++++++
+
+This is the main index page of your documentation. It should be written in
+`reStructuredText format <http://docutils.sourceforge.net/rst.html>`_.
+
+You can generate your documentation in HTML format by running this command::
+
+ setup.py pudge
+
+For this to work you will need to download and install ``buildutils`` and
+``pudge``.
Added: arkaiv/trunk/ez_setup/README.txt
===================================================================
--- arkaiv/trunk/ez_setup/README.txt (rev 0)
+++ arkaiv/trunk/ez_setup/README.txt 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,15 @@
+This directory exists so that Subversion-based projects can share a single
+copy of the ``ez_setup`` bootstrap module for ``setuptools``, and have it
+automatically updated in their projects when ``setuptools`` is updated.
+
+For your convenience, you may use the following svn:externals definition::
+
+ ez_setup svn://svn.eby-sarna.com/svnroot/ez_setup
+
+You can set this by executing this command in your project directory::
+
+ svn propedit svn:externals .
+
+And then adding the line shown above to the file that comes up for editing.
+Then, whenever you update your project, ``ez_setup`` will be updated as well.
+
Added: arkaiv/trunk/ez_setup/__init__.py
===================================================================
--- arkaiv/trunk/ez_setup/__init__.py (rev 0)
+++ arkaiv/trunk/ez_setup/__init__.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,231 @@
+#!python
+"""Bootstrap setuptools installation
+
+If you want to use setuptools in your package's setup.py, just include this
+file in the same directory with it, and add this to the top of your setup.py::
+
+ from ez_setup import use_setuptools
+ use_setuptools()
+
+If you want to require a specific version of setuptools, set a download
+mirror, or use an alternate download directory, you can do so by supplying
+the appropriate options to ``use_setuptools()``.
+
+This file can also be run as a script to install or upgrade setuptools.
+"""
+import sys
+DEFAULT_VERSION = "0.6c6"
+DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3]
+
+md5_data = {
+ 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
+ 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
+ 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
+ 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
+ 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
+ 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
+ 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
+ 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
+ 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
+ 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
+ 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
+ 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
+ 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
+ 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
+ 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
+ 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
+ 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
+ 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
+ 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
+ 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
+ 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
+ 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
+ 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
+ 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
+}
+
+import sys, os
+
+def _validate_md5(egg_name, data):
+ if egg_name in md5_data:
+ from md5 import md5
+ digest = md5(data).hexdigest()
+ if digest != md5_data[egg_name]:
+ print >>sys.stderr, (
+ "md5 validation of %s failed! (Possible download problem?)"
+ % egg_name
+ )
+ sys.exit(2)
+ return data
+
+
+def use_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ download_delay=15
+):
+ """Automatically find/download setuptools and make it available on sys.path
+
+ `version` should be a valid setuptools version number that is available
+ as an egg for download under the `download_base` URL (which should end with
+ a '/'). `to_dir` is the directory where setuptools will be downloaded, if
+ it is not already available. If `download_delay` is specified, it should
+ be the number of seconds that will be paused before initiating a download,
+ should one be required. If an older version of setuptools is installed,
+ this routine will print a message to ``sys.stderr`` and raise SystemExit in
+ an attempt to abort the calling script.
+ """
+ try:
+ import setuptools
+ if setuptools.__version__ == '0.0.1':
+ print >>sys.stderr, (
+ "You have an obsolete version of setuptools installed. Please\n"
+ "remove it from your system entirely before rerunning this script."
+ )
+ sys.exit(2)
+ except ImportError:
+ egg = download_setuptools(version, download_base, to_dir, download_delay)
+ sys.path.insert(0, egg)
+ import setuptools; setuptools.bootstrap_install_from = egg
+
+ import pkg_resources
+ try:
+ pkg_resources.require("setuptools>="+version)
+
+ except pkg_resources.VersionConflict, e:
+ # XXX could we install in a subprocess here?
+ print >>sys.stderr, (
+ "The required version of setuptools (>=%s) is not available, and\n"
+ "can't be installed while this script is running. Please install\n"
+ " a more recent version first.\n\n(Currently using %r)"
+ ) % (version, e.args[0])
+ sys.exit(2)
+
+def download_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ delay = 15
+):
+ """Download setuptools from a specified location and return its filename
+
+ `version` should be a valid setuptools version number that is available
+ as an egg for download under the `download_base` URL (which should end
+ with a '/'). `to_dir` is the directory where the egg will be downloaded.
+ `delay` is the number of seconds to pause before an actual download attempt.
+ """
+ import urllib2, shutil
+ egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
+ url = download_base + egg_name
+ saveto = os.path.join(to_dir, egg_name)
+ src = dst = None
+ if not os.path.exists(saveto): # Avoid repeated downloads
+ try:
+ from distutils import log
+ if delay:
+ log.warn("""
+---------------------------------------------------------------------------
+This script requires setuptools version %s to run (even to display
+help). I will attempt to download it for you (from
+%s), but
+you may need to enable firewall access for this script first.
+I will start the download in %d seconds.
+
+(Note: if this machine does not have network access, please obtain the file
+
+ %s
+
+and place it in this directory before rerunning this script.)
+---------------------------------------------------------------------------""",
+ version, download_base, delay, url
+ ); from time import sleep; sleep(delay)
+ log.warn("Downloading %s", url)
+ src = urllib2.urlopen(url)
+ # Read/write all in one block, so we don't create a corrupt file
+ # if the download is interrupted.
+ data = _validate_md5(egg_name, src.read())
+ dst = open(saveto,"wb"); dst.write(data)
+ finally:
+ if src: src.close()
+ if dst: dst.close()
+ return os.path.realpath(saveto)
+
+def main(argv, version=DEFAULT_VERSION):
+ """Install or upgrade setuptools and EasyInstall"""
+
+ try:
+ import setuptools
+ except ImportError:
+ egg = None
+ try:
+ egg = download_setuptools(version, delay=0)
+ sys.path.insert(0,egg)
+ from setuptools.command.easy_install import main
+ return main(list(argv)+[egg]) # we're done here
+ finally:
+ if egg and os.path.exists(egg):
+ os.unlink(egg)
+ else:
+ if setuptools.__version__ == '0.0.1':
+ # tell the user to uninstall obsolete version
+ use_setuptools(version)
+
+ req = "setuptools>="+version
+ import pkg_resources
+ try:
+ pkg_resources.require(req)
+ except pkg_resources.VersionConflict:
+ try:
+ from setuptools.command.easy_install import main
+ except ImportError:
+ from easy_install import main
+ main(list(argv)+[download_setuptools(delay=0)])
+ sys.exit(0) # try to force an exit
+ else:
+ if argv:
+ from setuptools.command.easy_install import main
+ main(argv)
+ else:
+ print "Setuptools version",version,"or greater has been installed."
+ print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
+
+
+
+def update_md5(filenames):
+ """Update our built-in md5 registry"""
+
+ import re
+ from md5 import md5
+
+ for name in filenames:
+ base = os.path.basename(name)
+ f = open(name,'rb')
+ md5_data[base] = md5(f.read()).hexdigest()
+ f.close()
+
+ data = [" %r: %r,\n" % it for it in md5_data.items()]
+ data.sort()
+ repl = "".join(data)
+
+ import inspect
+ srcfile = inspect.getsourcefile(sys.modules[__name__])
+ f = open(srcfile, 'rb'); src = f.read(); f.close()
+
+ match = re.search("\nmd5_data = {\n([^}]+)}", src)
+ if not match:
+ print >>sys.stderr, "Internal error!"
+ sys.exit(2)
+
+ src = src[:match.start(1)] + repl + src[match.end(1):]
+ f = open(srcfile,'w')
+ f.write(src)
+ f.close()
+
+
+if __name__=='__main__':
+ if len(sys.argv)>2 and sys.argv[1]=='--md5update':
+ update_md5(sys.argv[2:])
+ else:
+ main(sys.argv[1:])
+
+
+
+
+
Added: arkaiv/trunk/ez_setup/__init__.pyc
===================================================================
(Binary files differ)
Property changes on: arkaiv/trunk/ez_setup/__init__.pyc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: arkaiv/trunk/production.ini
===================================================================
--- arkaiv/trunk/production.ini (rev 0)
+++ arkaiv/trunk/production.ini 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,66 @@
+#
+# arkaiv - Pylons development environment configuration
+#
+# The %(here)s variable will be replaced with the parent directory of this file
+#
+[DEFAULT]
+debug = true
+email_to = Denis.Crowdy at mq.edu.au
+smtp_server = localhost
+error_email_from = paste at localhost
+media_path_base = /var/www/
+archive_loc = /var/www/arkaiv/
+
+[server:main]
+use = egg:Paste#http
+host = 0.0.0.0
+port = 5000
+
+[app:main]
+use = egg:arkaiv
+full_stack = True
+cache_dir = %(here)s/data
+beaker.session.key = arkaiv
+beaker.session.secret = somesecret
+sqlalchemy.default.uri = sqlite:///arkaiv.db
+sqlalchemy.echo = true
+authkit.enable = true
+authkit.method = digest
+authkit.users.setup = user:pylons
+
+
+# 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:
+#beaker.cache.data_dir = %(here)s/data/cache
+#beaker.session.data_dir = %(here)s/data/sessions
+
+# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
+# Debug mode will enable the interactive debugging tool, allowing ANYONE to
+# execute malicious code after an exception is raised.
+set debug = false
+
+
+# Logging Setup
+[loggers]
+keys = root
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
+datefmt = %H:%M:%S
Added: arkaiv/trunk/setup.cfg
===================================================================
--- arkaiv/trunk/setup.cfg (rev 0)
+++ arkaiv/trunk/setup.cfg 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,37 @@
+[egg_info]
+tag_build = dev
+tag_svn_revision = false
+
+[easy_install]
+find_links = http://www.pylonshq.com/download/
+
+[pudge]
+theme = pythonpaste.org
+
+# Add extra doc files here with spaces between them
+docs = docs/index.txt
+
+# Doc Settings
+doc_base = docs/
+dest = docs/html
+
+# Add extra modules here separated with commas
+modules = arkaiv
+title = Arkaiv
+organization = Pylons
+
+# Highlight code-block sections with Pygments
+highlighter = pygments
+
+# Optionally add extra links
+#organization_url = http://pylonshq.com/
+#trac_url = http://pylonshq.com/project
+settings = no_about=true
+
+# Optionally add extra settings
+# link1=/community/ Community
+# link2=/download/ Download
+
+[publish]
+doc-dir=docs/html
+make-dirs=1
Added: arkaiv/trunk/setup.py
===================================================================
--- arkaiv/trunk/setup.py (rev 0)
+++ arkaiv/trunk/setup.py 2007-08-29 01:05:37 UTC (rev 3206)
@@ -0,0 +1,23 @@
+from ez_setup import use_setuptools
+use_setuptools()
+from setuptools import setup, find_packages
+
+setup(
+ name='arkaiv',
+ version="0.1.2",
+ #description="Media annotation",
+ author="Denis Crowdy",
+ author_email="Denis.Crowdy at mq.edu.au",
+ url="http://arkaiv.googlecode.com/files/arkaiv-0.1.2dev-py2.5.egg",
+ install_requires=[],
+ packages=find_packages(exclude=['ez_setup']),
+ include_package_data=True,
+ test_suite = 'nose.collector',
+ package_data={'arkaiv': ['i18n/*/LC_MESSAGES/*.mo']},
+ entry_points="""
+ [paste.app_factory]
+ main=arkaiv:make_app
+ [paste.app_install]
+ main=pylons.util:PylonsInstaller
+ """,
+)
More information about the commits
mailing list