[xiph-commits] r3226 - in arkaiv/trunk: . arkaiv/controllers
arkaiv/model arkaiv/templates
dcrowdy at svn.annodex.net
dcrowdy at svn.annodex.net
Fri Sep 7 04:34:37 PDT 2007
Author: dcrowdy
Date: 2007-09-07 04:34:36 -0700 (Fri, 07 Sep 2007)
New Revision: 3226
Added:
arkaiv/trunk/arkaiv/templates/fileexistsmessage.mak
Modified:
arkaiv/trunk/TODO
arkaiv/trunk/arkaiv/controllers/page.py
arkaiv/trunk/arkaiv/controllers/page.pyc
arkaiv/trunk/arkaiv/model/__init__.py
arkaiv/trunk/arkaiv/model/__init__.pyc
arkaiv/trunk/arkaiv/templates/playlists.mak
arkaiv/trunk/arkaiv/templates/playlistview.mak
Log:
check whether a file of the same name exists before adding media
Modified: arkaiv/trunk/TODO
===================================================================
--- arkaiv/trunk/TODO 2007-09-06 05:34:38 UTC (rev 3225)
+++ arkaiv/trunk/TODO 2007-09-07 11:34:36 UTC (rev 3226)
@@ -1,5 +1,6 @@
TODO
+
Add end time field to clips table in database
Check whether a collection name already exists before adding.
@@ -27,7 +28,11 @@
DONE
+Thu Sep 6 17:27:28 EST 2007
+Implement deletion of playlists
+Implement playlists
+
Tue Sep 4 09:36:51 EST 2007
Implement removal of meta tags from the head.
Modified: arkaiv/trunk/arkaiv/controllers/page.py
===================================================================
--- arkaiv/trunk/arkaiv/controllers/page.py 2007-09-06 05:34:38 UTC (rev 3225)
+++ arkaiv/trunk/arkaiv/controllers/page.py 2007-09-07 11:34:36 UTC (rev 3226)
@@ -125,10 +125,16 @@
redirect_to(action='playlistpage')
+ def deleteplaylist(self):
+ name = request.params['playlistname']
+ model.deleteplaylist(name)
+
+ redirect_to(action='playlistpage')
+
def displayplaylist(self):
# Need to extract appropriate info for the playlist selected
playlistid = int(request.params['id'])
-
+ c.name = request.params['name']
clips = model.getclipsfromplaylist(playlistid)
items = model.getitemsfromplaylist(playlistid)
# send a list of dictionaries to the template
@@ -167,7 +173,11 @@
itemdict['url'] = media_url_base + urlpath + ".anx" + "?id=0"
c.cliplist.append(itemdict)
- return render('/playlistview.mak')
+ if (not c.cliplist):
+ print "Nothing in clips"
+ return render ('/emptyplaylistmessage.mak')
+ else:
+ return render('/playlistview.mak')
def addannodexindirform(self):
collectionlist = model.getcollections()
@@ -363,10 +373,11 @@
cmmlsource = request.POST['cmmlfile']
oggsource = request.POST['oggfile']
- self.__addmediatoarchive(cmmlsource, oggsource)
+ if (self.__addmediatoarchive(cmmlsource, oggsource) == "file exists"):
+ return render ('/fileexistsmessage.mak')
+ else:
+ redirect_to(action='mainpage')
- redirect_to(action='mainpage')
-
def __addmediatoarchive(self, cmmlsource, oggsource):
# Deal with the cmml file
# if no cmml file has been entered, then create one
@@ -377,6 +388,9 @@
parser = cmmlParser()
#parser.setcmmlfilename(newcmmlname)
fulloggpath = os.path.join(archive_loc, oggsource.filename)
+ if os.path.isfile(newcmmlname):
+ print "File exists - bail time"
+ return "file exists"
parser.createnewfile(newcmmlname, fulloggpath)
else:
@@ -473,7 +487,7 @@
collection = request.params['collection']
model.additemtocollection(headinfo['itemid'], collection)
- return
+ return
def search(self):
searchterms = request.params['searchterms']
Modified: arkaiv/trunk/arkaiv/controllers/page.pyc
===================================================================
(Binary files differ)
Modified: arkaiv/trunk/arkaiv/model/__init__.py
===================================================================
--- arkaiv/trunk/arkaiv/model/__init__.py 2007-09-06 05:34:38 UTC (rev 3225)
+++ arkaiv/trunk/arkaiv/model/__init__.py 2007-09-07 11:34:36 UTC (rev 3226)
@@ -106,6 +106,7 @@
clips_table = sqla.Table('clips', sac.metadata,
sqla.Column('ixc', sqla.Integer, primary_key=True ),
sqla.Column('start_time', sqla.Float ),
+# sqla.Column('end_time', sqla.Float ),
sqla.Column('id', sqla.String()),
sqla.Column('a_href', sqla.String()),
sqla.Column('a_text', sqla.String()),
@@ -368,7 +369,21 @@
return itemlist
+def deleteplaylist(listname):
+ """ deletes a playlist and items in the playlist_items table
+ given the playlist name
+ """
+ p_q = sac.query(Playlist)
+ p = p_q.get_by(name=listname)
+ # then get all items in the playlist_items table
+ pi_q = sac.query(Playlistitems)
+ pi = pi_q.filter_by(ixp=p.ixp)
+ for item in pi:
+ sac.session.delete(item)
+ sac.session.delete(p)
+ sac.session.flush()
+
def addsource(itemname, source, cmmlfile):
new_item = Item()
new_source = Source()
Modified: arkaiv/trunk/arkaiv/model/__init__.pyc
===================================================================
(Binary files differ)
Added: arkaiv/trunk/arkaiv/templates/fileexistsmessage.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/fileexistsmessage.mak (rev 0)
+++ arkaiv/trunk/arkaiv/templates/fileexistsmessage.mak 2007-09-07 11:34:36 UTC (rev 3226)
@@ -0,0 +1,5 @@
+<%inherit file="/autohandler"/>
+
+A file with the same name already exists in the archive - please rename the source file.
+
+
Modified: arkaiv/trunk/arkaiv/templates/playlists.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/playlists.mak 2007-09-06 05:34:38 UTC (rev 3225)
+++ arkaiv/trunk/arkaiv/templates/playlists.mak 2007-09-07 11:34:36 UTC (rev 3226)
@@ -5,7 +5,7 @@
% for p in c.playlists:
<li>
-${ h.link_to(p.name, h.url(action="displayplaylist", id=p.ixp))}
+${ h.link_to(p.name, h.url(action="displayplaylist", id=p.ixp, name=p.name))}
</li>
% endfor
Modified: arkaiv/trunk/arkaiv/templates/playlistview.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/playlistview.mak 2007-09-06 05:34:38 UTC (rev 3225)
+++ arkaiv/trunk/arkaiv/templates/playlistview.mak 2007-09-07 11:34:36 UTC (rev 3226)
@@ -1,7 +1,11 @@
<%inherit file="/autohandler"/>
<h2>
-Playlist view
+${c.name}
</h2>
+${ h.form(h.url(action='deleteplaylist'), multipart=True) }
+${ h.submit('Delete') }
+${ h.hidden_field('playlistname', value=c.name) }
+${ h.end_form() }
<form name="clips">
% for clip in c.cliplist:
@@ -36,7 +40,6 @@
for (i=1; i < clips.length; i++) {
addOutput(clips[i].value)
- addOutput("in the loop" + i)
plugin.appendMovie(clips[i].value)
}
More information about the commits
mailing list