[Debconf-video-commits] r215 - in package/trunk: conf/dc8 debian doc src
benh at alioth.debian.org
benh at alioth.debian.org
Thu Aug 7 21:33:31 UTC 2008
Author: benh
Date: 2008-08-07 21:33:31 +0000 (Thu, 07 Aug 2008)
New Revision: 215
Added:
package/trunk/src/dc-publish
Removed:
package/trunk/src/dc-make-rss
Modified:
package/trunk/conf/dc8/default-barney
package/trunk/debian/changelog
package/trunk/doc/README
Log:
Turned dc-make-rss into dc-publish which does the uploading too.
The new code is untested; beware!
Modified: package/trunk/conf/dc8/default-barney
===================================================================
--- package/trunk/conf/dc8/default-barney 2008-08-07 21:29:37 UTC (rev 214)
+++ package/trunk/conf/dc8/default-barney 2008-08-07 21:33:31 UTC (rev 215)
@@ -5,3 +5,4 @@
# File store base directory
FILE_BASE="/video"
ENCODING_HOSTS="daffy"
+PUBLICATION_PATH="apu.debconf.org:/dvd/2008/debconf8"
Modified: package/trunk/debian/changelog
===================================================================
--- package/trunk/debian/changelog 2008-08-07 21:29:37 UTC (rev 214)
+++ package/trunk/debian/changelog 2008-08-07 21:33:31 UTC (rev 215)
@@ -1,3 +1,10 @@
+debconf-video (8.0~dc8+7) unstable; urgency=low
+
+ [ Ben Hutchings ]
+ * Turned dc-make-rss into dc-publish which does the uploading too
+
+ --
+
debconf-video (8.0~dc8+6) etch; urgency=low
[ Eric Dantan Rzewnicki ]
Modified: package/trunk/doc/README
===================================================================
--- package/trunk/doc/README 2008-08-07 21:29:37 UTC (rev 214)
+++ package/trunk/doc/README 2008-08-07 21:33:31 UTC (rev 215)
@@ -43,6 +43,7 @@
The format is ( <hostname> [ "*" <nproc> ] )+
<nproc> is the number of processes to start on that host; the
default is 2.
+PUBLICATION_PATH - rsync path to publish files under
No debconf-video configuration is required on the sink, source or
encoding hosts since they are controlled via ssh.
@@ -87,10 +88,10 @@
has no way to kill processes on the encoding hosts when interrupted,
so you will need to do that yourself.
-dc-make-rss
------------
+dc-publish
+----------
-Print an RSS 2.0 / Media RSS document listing the published files in
-'low' target format.
+Upload newly generated files to the video archive. Add an RSS 2.0 /
+Media RSS document listing the published files in 'low' target format.
-Use this on the storage host (?).
+Use this on the storage host.
Deleted: package/trunk/src/dc-make-rss
===================================================================
--- package/trunk/src/dc-make-rss 2008-08-07 21:29:37 UTC (rev 214)
+++ package/trunk/src/dc-make-rss 2008-08-07 21:33:31 UTC (rev 215)
@@ -1,124 +0,0 @@
-#!/usr/bin/python
-
-import mx.DateTime
-import os
-import os.path
-import pgdb
-import re
-import sys
-
-# metadata
-author = 'DebConf video team'
-licence = 'DebConf video licence; http://meetings-archive.debian.net/pub/debian-meetings/LICENCE'
-
-format_abbr = 'low' # format to link to
-#video_base_url = 'http://meetings-archive.debian.net/pub/debian-meetings/2007/debconf7/'
-#info_url_format = 'https://penta.debconf.org/~joerg/events/%(event_id)d.en.html'
-video_base_url = 'http://meetings-archive.debian.net/pub/debian-meetings/2008/debconf8/'
-info_url_format = 'https://penta.debconf.org/dc8_schedule/events/%(event_id)d.en.html'
-
-time_format = '%a, %d %b %Y %H:%M:%S GMT'
-
-def esc_content(s):
- return s.replace('&', '&').replace('<', '<')
-
-def esc_attr(s):
- return s.replace('&', '&').replace('>', '>').replace("'", '"')
-
-def timestamp(s):
- return mx.DateTime.strptime(s, '%Y-%m-%d %H:%M:%S')
-
-def interval(s):
- return mx.DateTime.TimeDelta(*[float(part) for part in s.split(':')])
-
-def main():
- conn = pgdb.connect(dsn=config['DATABASE_DSN'],
- user=config.get('DATABASE_USER'),
- password=config.get('DATABASE_PASSWORD'))
- cur = conn.cursor()
-
- conference_title = config['CONFERENCE_NAME']
- cur.execute('SELECT conference_id, homepage, timezone FROM conference'
- ' WHERE title = %(title)s',
- {'title': conference_title})
- 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()
-
- print "<?xml version='1.0'?>"
- print "<rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/'>"
- print "<channel>"
-
- print "<title>%s</title>" % esc_content(conference_title)
- print "<link>%s</link>" % esc_content(homepage)
- print "<description>%s</description>" % esc_content(conference_title)
- print "<language>en</language>"
- print "<copyright>Copyright %s. Licence: %s</copyright>" % (esc_content(author), esc_content(licence))
- print "<generator>dc-make-rss</generator>"
-
- cur.execute("""
-SELECT published_time, video_event_recording.start_time,
- video_event_recording.end_time, event_recording_base_name,
- event.event_id, title, description
-FROM
-((((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_file_status
- ON video_target_file.file_status_id = video_file_status.id)
-WHERE event.conference_id = %(conference_id)s
- AND video_target_file.target_format_id = %(format_id)d
- AND published_time IS NOT NULL
-ORDER BY published_time DESC
-""",
- {'conference_id': conference_id,
- 'format_id': format_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
- published_time = timestamp(published_time)
- start_time = interval(start_time)
- end_time = interval(end_time)
-
- 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))
-
- print """\
-<item>
- <title>%s</title>
- <link>%s</link>
- <description>%s</description>
- <pubDate>%s</pubDate>
- <media:content url='%s' medium='video' isDefault='true' duration='%d'/>
- <guid>%s</guid>
-</item>""" % (esc_content(title),
- esc_content(video_url),
- esc_content(description),
- published_time.strftime(time_format),
- esc_attr(video_url), (end_time - start_time).seconds,
- esc_content(video_url))
-
- print "</channel>"
- print "</rss>"
-
-if __name__ == '__main__':
- sys.path.insert(0, '/usr/share/debconf-video-store')
- import shellconfig
- config = shellconfig.read_file('/etc/default/debconf-video')
- main()
Copied: package/trunk/src/dc-publish (from rev 142, package/trunk/src/dc-make-rss)
===================================================================
--- package/trunk/src/dc-publish (rev 0)
+++ package/trunk/src/dc-publish 2008-08-07 21:33:31 UTC (rev 215)
@@ -0,0 +1,175 @@
+#!/usr/bin/python2.4
+
+import mx.DateTime
+import os
+import os.path
+import pgdb
+import re
+import sys
+
+# metadata
+author = 'DebConf video team'
+licence = 'DebConf video licence; http://meetings-archive.debian.net/pub/debian-meetings/LICENCE'
+
+format_abbr = 'low' # format to link to
+#video_base_url = 'http://meetings-archive.debian.net/pub/debian-meetings/2007/debconf7/'
+#info_url_format = 'https://penta.debconf.org/~joerg/events/%(event_id)d.en.html'
+video_base_url = 'http://meetings-archive.debian.net/pub/debian-meetings/2008/debconf8/'
+info_url_format = 'https://penta.debconf.org/dc8_schedule/events/%(event_id)d.en.html'
+
+time_format = '%a, %d %b %Y %H:%M:%S GMT'
+
+def esc_content(s):
+ return s.replace('&', '&').replace('<', '<')
+
+def esc_attr(s):
+ return s.replace('&', '&').replace('>', '>').replace("'", '"')
+
+def timestamp(s):
+ return mx.DateTime.strptime(s, '%Y-%m-%d %H:%M:%S')
+
+def interval(s):
+ return mx.DateTime.TimeDelta(*[float(part) for part in s.split(':')])
+
+def make_rss(config, cur):
+ conference_title = config['CONFERENCE_NAME']
+ cur.execute('SELECT conference_id, homepage, timezone FROM conference'
+ ' WHERE title = %(title)s',
+ {'title': conference_title})
+ 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()
+
+ rss = open(config['FILE_BASE'] + '/index.rss', 'w')
+
+ print >>rss, "<?xml version='1.0'?>"
+ print >>rss, "<rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/'>"
+ print >>rss, "<channel>"
+
+ print >>rss, "<title>%s</title>" % esc_content(conference_title)
+ print >>rss, "<link>%s</link>" % esc_content(homepage)
+ print >>rss, "<description>%s</description>" % esc_content(conference_title)
+ print >>rss, "<language>en</language>"
+ print >>rss, "<copyright>Copyright %s. Licence: %s</copyright>" % (esc_content(author), esc_content(licence))
+ print >>rss, "<generator>dc-make-rss</generator>"
+
+ cur.execute("""
+SELECT published_time, video_event_recording.start_time,
+ video_event_recording.end_time, event_recording_base_name,
+ event.event_id, title, description
+FROM
+(((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)
+WHERE event.conference_id = %(conference_id)s
+ AND video_target_file.target_format_id = %(format_id)d
+ AND published_time IS NOT NULL
+ORDER BY published_time DESC
+""",
+ {'conference_id': conference_id,
+ 'format_id': format_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
+ published_time = timestamp(published_time)
+ start_time = interval(start_time)
+ end_time = interval(end_time)
+
+ 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))
+
+ 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'/>
+ <guid>%s</guid>
+</item>""" % (esc_content(title),
+ esc_content(video_url),
+ esc_content(description),
+ published_time.strftime(time_format),
+ esc_attr(video_url), (end_time - start_time).seconds,
+ esc_content(video_url))
+
+ print >>rss, "</channel>"
+ print >>rss, "</rss>"
+
+def publish(config, file_names):
+ os.chdir(config['FILE_BASE'])
+ os.spawnvp(os.P_WAIT, 'rsync',
+ ['rsync', '--relative', '--partial', '--times']
+ + file_names
+ + [config['PUBLICATION_PATH']])
+
+def main(config):
+ conn = pgdb.connect(dsn=config['DATABASE_DSN'],
+ user=config.get('DATABASE_USER'),
+ password=config.get('DATABASE_PASSWORD'))
+ cur = conn.cursor()
+
+ conference_title = config['CONFERENCE_NAME']
+ cur.execute('SELECT conference_id FROM conference'
+ ' WHERE title = %(title)s',
+ {'title': conference_title})
+ conference_id = cur.fetchone()
+
+ 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()
+
+ file_ids = []
+ file_names = []
+
+ cur.execute("""
+SELECT video_target_file.id, event_recording_base_name
+FROM
+((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)
+WHERE event.conference_id = %(conference_id)s
+ AND video_target_file.target_format_id = %(format_id)d
+ AND published_time IS NULL
+""",
+ {'conference_id': conference_id,
+ 'format_id': format_id})
+ for file_id, base_name in cur.fetchall():
+ file_ids.append(file_id)
+ file_names.append('%s/%s%s' % (format_abbr, base_name, format_ext))
+
+ publish(config, file_names)
+
+ cur.execute("""
+UPDATE video_target_file
+SET published_time = (CURRENT_TIMESTAMP AT TIME ZONE 'GMT')
+WHERE id IN (%s)
+"""
+ % (','.join(str(file_id) for file_id in file_ids)))
+
+ make_rss(config, cur)
+
+ publish(config, ['index.rss'])
+
+if __name__ == '__main__':
+ sys.path.insert(0, '/usr/share/debconf-video-store')
+ import shellconfig
+ main(shellconfig.read_file('/etc/default/debconf-video'))
Property changes on: package/trunk/src/dc-publish
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mergeinfo
+
More information about the Debconf-video-commits
mailing list