[Debconf-video-commits] r261 - package/trunk/src

des at alioth.debian.org des at alioth.debian.org
Sat Aug 16 21:38:20 UTC 2008


Author: des
Date: 2008-08-16 21:38:20 +0000 (Sat, 16 Aug 2008)
New Revision: 261

Modified:
   package/trunk/src/dc-publish
Log:
Remove long description
Add links to all published formats
Add h4 with the title of the talk
Add a commit to the db, I think we need one there


Modified: package/trunk/src/dc-publish
===================================================================
--- package/trunk/src/dc-publish	2008-08-16 16:07:37 UTC (rev 260)
+++ package/trunk/src/dc-publish	2008-08-16 21:38:20 UTC (rev 261)
@@ -39,10 +39,9 @@
     conference_id, homepage, timezone = cur.fetchone()
     os.environ['TZ'] = timezone
 
-    cur.execute("SELECT id, filename_extension FROM video_target_format"
-                " WHERE target_format_abbr = %(format_abbr)s",
-                {'format_abbr': format_abbr})
-    format_id, format_ext = cur.fetchone()
+    cur.execute("SELECT target_format_abbr, filename_extension FROM video_target_format"
+                " WHERE published = true")
+    published_formats = cur.fetchall()
 
     rss = open(config['FILE_BASE'] + '/index.rss', 'w')
 
@@ -62,19 +61,20 @@
        video_event_recording.end_time, event_recording_base_name,
        event.event_id, title, description
 FROM
-(((video_target_file JOIN video_event_recording
+((((video_target_file JOIN video_event_recording
    ON video_target_file.event_recording_id = video_event_recording.id)
   JOIN event
   ON video_event_recording.event_id = event.event_id)
  JOIN video_recording
  ON video_event_recording.recording_id = video_recording.id)
+ JOIN video_target_format
+ ON video_target_file.target_format_id = video_target_format.id)
 WHERE event.conference_id = %(conference_id)s
-      AND video_target_file.target_format_id = %(format_id)d
+      AND video_target_format.published
       AND published_time IS NOT NULL
-ORDER BY published_time DESC
+ORDER BY conference_day ASC, published_time DESC
 """,
-                {'conference_id': conference_id,
-                 'format_id': format_id})
+                {'conference_id': conference_id})
     for (published_time, start_time, end_time, base_name,
          event_id, title, event_desc) in cur.fetchall():
         # Convert string date-times back to proper types
@@ -84,23 +84,26 @@
 
         info_url = info_url_format % {'conference_id': conference_id,
                                       'event_id': event_id}
-        video_url = (video_base_url + format_abbr + '/'
-                     + base_name + format_ext)
-        if event_desc:
-            description = ("<p>%s</p>"
-                           % esc_content(event_desc).replace('\n', '<br/>'))
-        else:
-            description = ''
-        description += ("<p><a href='%s'>Full event details</a></p>"
-                        % esc_attr(info_url))
+        description = ("""<h4>%s</h4>
+          <p><a href='%s'>Full event details</a>"""
+          % (esc_content(title),
+          esc_attr(info_url)))
 
+        for (format_abbr, format_ext) in published_formats:
+            video_url = (video_base_url + format_abbr + '/'
+                       + base_name + format_ext)
+            description += ("""<br/><a href='%s'>Video %s format</a>"""
+                          % (esc_attr(video_url),
+													esc_content(format_abbr)))
+        description += "</p>"
+
         print >>rss, """\
 <item>
         <title>%s</title>
         <link>%s</link>
         <description>%s</description>
         <pubDate>%s</pubDate>
-	<media:content url='%s' medium='video' isDefault='true' duration='%d'/>
+        <media:content url='%s' medium='video' isDefault='true' duration='%d'/>
         <guid>%s</guid>
 </item>""" % (esc_content(title),
               esc_content(video_url),
@@ -115,7 +118,7 @@
 def publish(config, file_names):
     os.chdir(config['FILE_BASE'])
     os.spawnvp(os.P_WAIT, 'rsync',
-               ['rsync', '--relative', '--partial', '--times', '-e ssh', '-vvv', '--bwlimit=20000']
+               ['rsync', '--relative', '--partial', '--times', '-e ssh', '-vvv', '--bwlimit=307']
                + file_names
                + [config['PUBLICATION_PATH']])
 
@@ -158,6 +161,7 @@
                 {'file_id': file_id})
         make_rss(config, cur)
         publish(config, ['index.rss'])
+        cur.execute("COMMIT")
 
 if __name__ == '__main__':
     sys.path.insert(0, '/usr/share/debconf-video-store')




More information about the Debconf-video-commits mailing list