[xiph-commits] r3941 - in arkaiv/trunk/arkaiv: controllers model

dcrowdy at svn.annodex.net dcrowdy at svn.annodex.net
Sun May 31 22:00:42 PDT 2009


Author: dcrowdy
Date: 2009-05-31 22:00:42 -0700 (Sun, 31 May 2009)
New Revision: 3941

Added:
   arkaiv/trunk/arkaiv/model/imager.py
Modified:
   arkaiv/trunk/arkaiv/controllers/addmedia.py
   arkaiv/trunk/arkaiv/controllers/item.py
   arkaiv/trunk/arkaiv/model/cmmlparser.py
   arkaiv/trunk/arkaiv/model/cmmlparser.pyc
Log:
Moved clip image creation to separate class


Modified: arkaiv/trunk/arkaiv/controllers/addmedia.py
===================================================================
--- arkaiv/trunk/arkaiv/controllers/addmedia.py	2009-06-01 04:08:28 UTC (rev 3940)
+++ arkaiv/trunk/arkaiv/controllers/addmedia.py	2009-06-01 05:00:42 UTC (rev 3941)
@@ -15,6 +15,7 @@
 from arkaiv.model.cmmlparser import cmmlParser
 from arkaiv.model.oggzinfo import OggzInfo
 from arkaiv.model.framer import Frame
+from arkaiv.model.imager import Imager
 
 log = logging.getLogger(__name__)
 
@@ -119,7 +120,8 @@
                     # this fails very badly - stopping the web server even, so 
                     # has been disabled for the moment.
                     print "multiple clip image import disabled for now"
-#                    clipdict['img_src'] = self.__createimageforclip(newcmmlname, clipdict)
+                    clipimage = Imager()
+                    clipdict['img_src'] = clipimage.createimageforclip(newcmmlname, clipdict)
                 except:
                     print "problem with clip image for id " + str(clipdict['itemid'])
                     clipdict['img_src'] = ""

Modified: arkaiv/trunk/arkaiv/controllers/item.py
===================================================================
--- arkaiv/trunk/arkaiv/controllers/item.py	2009-06-01 04:08:28 UTC (rev 3940)
+++ arkaiv/trunk/arkaiv/controllers/item.py	2009-06-01 05:00:42 UTC (rev 3941)
@@ -13,6 +13,7 @@
 from arkaiv.model.oggzinfo import OggzInfo
 from arkaiv.model.cmmlparser import cmmlParser
 from arkaiv.model.framer import Frame
+from arkaiv.model.imager import Imager
 
 log = logging.getLogger(__name__)
 
@@ -155,7 +156,8 @@
 
         # create an image to display for the clip
         if has_video == "Yes":
-            clip['img_src'] = self.__createimageforclip(cmmlfile, clip)
+            clipimage = Imager()
+            clip['img_src'] = clipimage.createimageforclip(cmmlfile, clip)
 
         else:
             clip['img_src'] = ""
@@ -225,31 +227,6 @@
         redirect_to(action='displayitem', id=headinfo['itemid'], edit="yes")
 
 
-
-    def __createimageforclip(self, cmmlfile, clipinfo):
-#        print "cmmlfile: " + cmmlfile
-#        print clipinfo
-        basename = os.path.splitext(cmmlfile)[0]
-#        print basename
-        imagedirname = basename + "_clipimages"
-        clipimagename = str(clipinfo['starttime']) + ".png"
-#        print "clip name: " + clipimagename
-        oggsource = model.getsourcepath(clipinfo['itemid'])
-#        print oggsource
-        cwd = os.getcwd()
-#        print cwd
-        os.chdir(imagedirname)  # ugly...
-        frameimage = Frame(oggsource, float(clipinfo['starttime']), clipimagename)    
-        print "after frameimage"
-        os.chdir(cwd)   # very ugly... #
-
-        # add that info to the dictionary - only needs to be a relative
-        # location
-        relpath = os.path.split(imagedirname)[1]
-        imagefile = relpath + "/" + clipimagename
-#        print imagefile
-        return imagefile
-
     def editheadmetaname(self):
         text = request.params['myparam']
         id = request.params['id']

Modified: arkaiv/trunk/arkaiv/model/cmmlparser.py
===================================================================
--- arkaiv/trunk/arkaiv/model/cmmlparser.py	2009-06-01 04:08:28 UTC (rev 3940)
+++ arkaiv/trunk/arkaiv/model/cmmlparser.py	2009-06-01 05:00:42 UTC (rev 3941)
@@ -104,6 +104,7 @@
             clipdict = {}
             clipdict['id'] = clip.get('id')    
             clipdict['starttime'] = clip.get('start')    
+            clipdict['endtime'] = clip.get('end')    
             desc = clip.find('desc')
             clipdict['desc'] = desc.text
             clipdict['a_href'] = None  # FIXME

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

Added: arkaiv/trunk/arkaiv/model/imager.py
===================================================================
--- arkaiv/trunk/arkaiv/model/imager.py	                        (rev 0)
+++ arkaiv/trunk/arkaiv/model/imager.py	2009-06-01 05:00:42 UTC (rev 3941)
@@ -0,0 +1,25 @@
+import os
+import os.path
+
+from arkaiv.lib.base import model
+from arkaiv.model.framer import Frame
+
+class Imager:
+
+    def createimageforclip(self, cmmlfile, clipinfo):
+            basename = os.path.splitext(cmmlfile)[0]
+            imagedirname = basename + "_clipimages"
+            clipimagename = str(clipinfo['starttime']) + ".png"
+            oggsource = model.getsourcepath(clipinfo['itemid'])
+            cwd = os.getcwd()
+            os.chdir(imagedirname)  # ugly...
+            frameimage = Frame(oggsource, float(clipinfo['starttime']), clipimagename)    
+            print "after frameimage"
+            os.chdir(cwd)   # very ugly... #
+    
+            # add that info to the dictionary - only needs to be a relative
+            # location
+            relpath = os.path.split(imagedirname)[1]
+            imagefile = relpath + "/" + clipimagename
+            return imagefile
+



More information about the commits mailing list