[Debconf-video-commits] r351 - in package/branches/pycon09/src: . debconfvideo debconfvideo/web/pyconvideo

benh at alioth.debian.org benh at alioth.debian.org
Sat Mar 21 04:38:00 UTC 2009


Author: benh
Date: 2009-03-21 04:37:59 +0000 (Sat, 21 Mar 2009)
New Revision: 351

Modified:
   package/branches/pycon09/src/dc-do-transcoding
   package/branches/pycon09/src/debconfvideo/__init__.py
   package/branches/pycon09/src/debconfvideo/web/pyconvideo/models.py
Log:
Moved target filename generation to the debconfvideo module and use it as the default representation on the web.


Modified: package/branches/pycon09/src/dc-do-transcoding
===================================================================
--- package/branches/pycon09/src/dc-do-transcoding	2009-03-21 04:06:55 UTC (rev 350)
+++ package/branches/pycon09/src/dc-do-transcoding	2009-03-21 04:37:59 UTC (rev 351)
@@ -8,6 +8,7 @@
 
 if __name__ == '__main__':
     sys.path.insert(0, '/usr/share/debconf-video-store')
+import debconfvideo
 from debconfvideo import config, database
 
 class Job(object):
@@ -76,11 +77,7 @@
 
 def try_prepare_job(job):
     # Generate target_filename.
-    # XXX This should really be defined in a view.
-    job.target_filename = '%s/%s/%s%s' % (config['FILE_BASE'],
-                                          job.target_format_abbr,
-                                          job.event_recording_base_name,
-                                          job.filename_extension)
+    job.target_filename = debconfvideo.target_filename(job, job)
 
     if os.path.exists(job.recording_filename):
         source_container_name = 'dv'

Modified: package/branches/pycon09/src/debconfvideo/__init__.py
===================================================================
--- package/branches/pycon09/src/debconfvideo/__init__.py	2009-03-21 04:06:55 UTC (rev 350)
+++ package/branches/pycon09/src/debconfvideo/__init__.py	2009-03-21 04:37:59 UTC (rev 351)
@@ -3,3 +3,10 @@
 __all__ = ['config', 'database']
 
 config = shellconfig.read_file('/etc/default/debconf-video')
+
+def target_filename(video_event_recording, video_target_format):
+    return ('%s/%s/%s%s' %
+            (config['FILE_BASE'],
+             video_target_format.target_format_abbr,
+             video_event_recording.event_recording_base_name,
+             video_target_format.filename_extension))

Modified: package/branches/pycon09/src/debconfvideo/web/pyconvideo/models.py
===================================================================
--- package/branches/pycon09/src/debconfvideo/web/pyconvideo/models.py	2009-03-21 04:06:55 UTC (rev 350)
+++ package/branches/pycon09/src/debconfvideo/web/pyconvideo/models.py	2009-03-21 04:37:59 UTC (rev 351)
@@ -2,6 +2,7 @@
 
 from django.db import models
 import mx.DateTime
+import debconfvideo
 
 def hms_to_seconds(hms):
     parts = hms.split(':')
@@ -120,5 +121,8 @@
     locked_by = models.IntegerField()
     generated_time = models.DateTimeField()
     published_time = models.DateTimeField()
+    def __unicode__(self):
+        return debconfvideo.target_filename(self.event_recording,
+                                            self.target_format)
     class Meta:
         db_table = u'video_target_file'




More information about the Debconf-video-commits mailing list