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

Ben Hutchings benh at alioth.debian.org
Mon Sep 20 02:06:20 UTC 2010


Author: benh
Date: 2010-09-20 02:06:09 +0000 (Mon, 20 Sep 2010)
New Revision: 635

Added:
   package/trunk/src/dc-export-csv
Modified:
   package/trunk/src/dc-do-transcoding
Log:
Add CSV export script

Modified: package/trunk/src/dc-do-transcoding
===================================================================
--- package/trunk/src/dc-do-transcoding	2010-08-25 16:58:35 UTC (rev 634)
+++ package/trunk/src/dc-do-transcoding	2010-09-20 02:06:09 UTC (rev 635)
@@ -184,9 +184,8 @@
                      # An explicit 'k' on the end seems to work for all.
                      '-ab', '%dk' % (job.audio_bit_rate // 1000)])
         # metadata
-        argv.extend(['-author', author,
-                     '-timestamp', str(job.recording_time),
-                     '-copyright', author + '; ' + licence])
+        argv.extend(['-metadata', 'author=' + author,
+                     '-metadata', 'copyright=' + author + '; ' + licence])
         # output filename must come after all the output options
         argv.extend(['-y', job.target_filename])
 

Added: package/trunk/src/dc-export-csv
===================================================================
--- package/trunk/src/dc-export-csv	                        (rev 0)
+++ package/trunk/src/dc-export-csv	2010-09-20 02:06:09 UTC (rev 635)
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+# Export information about recorded events as CSV
+
+import csv
+import pgdb
+import sys
+
+# TODO: Move this to configuration
+video_base_url = 'http://meetings-archive.debian.net/pub/debian-meetings'
+# TODO: List multiple target formats
+target_format_abbr = 'low'
+
+if __name__ == '__main__':
+    sys.path.insert(0, '/usr/share/debconf-video-store')
+from debconfvideo import config, database
+
+def main(conf_name, out_file):
+    cur = database.get_cursor()
+
+    # Find conference id.
+    cur.execute('SELECT conference_id FROM conference WHERE title=%(title)s',
+                {'title': conf_name})
+    conf_id = cur.fetchone()[0]
+
+    # Find format extension.
+    cur.execute('SELECT filename_extension FROM video_target_format'
+                ' WHERE target_format_abbr=%(abbr)s',
+                {'abbr': target_format_abbr})
+    name_ext = cur.fetchone()[0]
+
+    out_csv = csv.writer(out_file)
+    out_csv.writerow(['title', 'url', 'subtitle', 'language',
+                      'abstract', 'date', 'type', 'event'])
+
+    cur.execute('SELECT event_recording_base_name, title, subtitle, language,'
+                ' abstract, recording_time, event_type'
+                ' FROM video_event_recording, event, video_recording'
+                ' WHERE video_event_recording.event_id=event.event_id'
+                ' AND video_event_recording.recording_id=video_recording.id'
+                ' AND event.conference_id=%(conf_id)d',
+                {'conf_id': conf_id})
+    for (base_name, title, subtitle, language,
+         abstract, recording_time, event_type) in cur.fetchall():
+        url = '%s/%s/%s/%s/%s%s' % (video_base_url, recording_time[:4],
+                                    conf_name.lower().replace(' ', ''),
+                                    target_format_abbr, base_name, name_ext)
+        out_csv.writerow([title, url, subtitle, language,
+                          abstract, recording_time[:10], event_type, conf_name])
+
+if __name__ == '__main__':
+    main(len(sys.argv) <= 1 and config['CONFERENCE_NAME'] or sys.argv[1],
+         len(sys.argv) <= 2 and sys.stdout or open(sys.argv[2], 'w'))


Property changes on: package/trunk/src/dc-export-csv
___________________________________________________________________
Added: svn:executable
   + *




More information about the Debconf-video-commits mailing list