[xiph-commits] r3214 - in arkaiv/trunk: . arkaiv/controllers arkaiv/model arkaiv/templates

dcrowdy at svn.annodex.net dcrowdy at svn.annodex.net
Fri Aug 31 21:06:58 PDT 2007


Author: dcrowdy
Date: 2007-08-31 21:06:58 -0700 (Fri, 31 Aug 2007)
New Revision: 3214

Added:
   arkaiv/trunk/arkaiv/templates/addannodexindirform.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
Log:
Fixed deletion of an item - removal of clip, meta, head and source info from database.


Modified: arkaiv/trunk/TODO
===================================================================
--- arkaiv/trunk/TODO	2007-08-30 11:53:07 UTC (rev 3213)
+++ arkaiv/trunk/TODO	2007-09-01 04:06:58 UTC (rev 3214)
@@ -1,12 +1,10 @@
 TODO
 
-Handle whitespace in a source file name - doesn't do this at all at the moment
+Implement removal of meta tags from the head.
 
 When going to an item from a clip link on the search results page, any
 subsequent attempts to jump to clips fail.  Fix.
 
-Better screen layout in the main display page needed
-
 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
@@ -14,7 +12,7 @@
 
 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.
+the moment. Note - partly done; some functions still need updating.
 
 In the model, sometimes a dictionary is being returned, sometimes actual
 database objects...  Should probably decide on one approach and be consistent.
@@ -25,6 +23,10 @@
 
 Thu Aug 30 09:43:10 EST 2007
 
+Better screen layout in the main display page needed
+
+Handle whitespace in a source file name - doesn't do this at all at the moment
+
 Clips should have an image generated for the link display
 
 Mon Aug 27 11:09:20 EST 2007

Modified: arkaiv/trunk/arkaiv/controllers/page.py
===================================================================
--- arkaiv/trunk/arkaiv/controllers/page.py	2007-08-30 11:53:07 UTC (rev 3213)
+++ arkaiv/trunk/arkaiv/controllers/page.py	2007-09-01 04:06:58 UTC (rev 3214)
@@ -271,6 +271,11 @@
     def deleteitem(self):
         itemid = request.params['itemid']
         model.deleteitem(itemid)
+
+        # FIXME - the source files aren't actually removed from the
+        # application's media directory by doing this - at this stage I regard
+        # this as a feature...
+
         redirect_to(action='mainpage')
 
     def addannodexmedia(self):
@@ -349,7 +354,11 @@
                 # get a still image for the correct frame
                 print "getting a clip image"
                 #clipdict['img_src'] = ""
-                clipdict['img_src'] = self.__createimageforclip(newcmmlname, clipdict)
+                try:
+                    clipdict['img_src'] = self.__createimageforclip(newcmmlname, clipdict)
+                except:
+                    print "problem with clip image for id " + str(clipdict['itemid'])
+                    clipdict['img_src'] = ""
             else:
                 clipdict['img_src'] = ""
             model.addclip(clipdict)
@@ -395,6 +404,9 @@
             result['meta'] = model.getheadmeta(metaid)
             result['item'] = model.getitemforheadmeta(metaid)
             c.metas.append(result)
+#            print result
+#        print resultsdict['metas']
+#        print c.metas
 
         c.clips = []
         for clipid in resultsdict['clips']:

Modified: arkaiv/trunk/arkaiv/controllers/page.pyc
===================================================================
(Binary files differ)

Modified: arkaiv/trunk/arkaiv/model/__init__.py
===================================================================
--- arkaiv/trunk/arkaiv/model/__init__.py	2007-08-30 11:53:07 UTC (rev 3213)
+++ arkaiv/trunk/arkaiv/model/__init__.py	2007-09-01 04:06:58 UTC (rev 3214)
@@ -326,6 +326,7 @@
 def getheadmeta(id):
     meta_q = sac.query(Meta)
     m = meta_q.get_by(ixm=id)
+    print m.ixm
     return m
 
 def getitemforheadmeta(metaid):
@@ -336,7 +337,9 @@
     ih = ih_q.get_by(ixh=h.ixh)
     i_q = sac.query(Item)
     i = i_q.get_by(ixi=ih.ixi)
-
+    print "i is: " 
+    print i
+    print "i.ixi is" + str(i.ixi)
     return i
 
 
@@ -528,6 +531,41 @@
     item_q = sac.query(Item)
     i = item_q.get_by(ixi=id)
     sac.session.delete(i)
+
+    # remove head info
+    ih_q = sac.query(Itemheads)
+    ih = ih_q.get_by(ixi=id)
+
+    # remove meta tags from this head
+    hm_q = sac.query(Headmetas)
+    hm = hm_q.filter_by(ixh=ih.ixh)
+    m_q = sac.query(Meta)
+    for headmeta in hm:
+        m = m_q.get_by(ixm=headmeta.ixm)
+#        sac.session.delete(headmeta)
+        sac.session.delete(m)
+
+    # Remove all clips
+    ic_q = sac.query(Itemclips)
+    c_q = sac.query(Clip)
+    ic = ic_q.filter_by(ixi=id)
+    for itemclip in ic:
+        c = c_q.get_by(ixc=itemclip.ixc)
+        sac.session.delete(c)
+    
+    # remove the head entry
+    h_q = sac.query(Head)
+    h = h_q.get_by(ixh=ih.ixh)
+    sac.session.delete(h)
+
+    # remove the source information as well
+    is_q = sac.query(Itemsources)
+    i_s = is_q.get_by(ixi=id)
+    s_q = sac.query(Source)
+    s = s_q.get_by(ixs=i_s.ixs)
+    #sac.session.delete(i_s)
+    sac.session.delete(s)
+
     sac.session.flush()
     return
 

Modified: arkaiv/trunk/arkaiv/model/__init__.pyc
===================================================================
(Binary files differ)

Added: arkaiv/trunk/arkaiv/templates/addannodexindirform.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/addannodexindirform.mak	                        (rev 0)
+++ arkaiv/trunk/arkaiv/templates/addannodexindirform.mak	2007-09-01 04:06:58 UTC (rev 3214)
@@ -0,0 +1,20 @@
+<%inherit file="/autohandler"/> 
+<h1 class="main">Add annodex media from a directory</h1>
+Note: This is for local use only - same machine as the server
+<p>
+This allows importation of cmml and ogg files, for encoding to annodex format (anx), given a directory.  Basically it expects a directory full of cmml and ogg files, in pairs (ie same basename - something.cmml, something.ogg; anotherthing.cmml, anotherthing.ogg).
+
+${ h.form(h.url(action='addannodexindirmedia'), multipart=True) } 
+<table>
+<tr>
+<td>Directory:</td>
+<td>${ h.text_field('mediadir') } </td>
+</tr>
+<tr>
+<td>Collection:</td>
+<td>${ h.select("collection", c.collectioninfo)}</td>
+</tr>
+</table>
+${ h.submit('Submit') } 
+${ h.end_form() } 
+



More information about the commits mailing list