[Debconf-video-commits] r489 - in package/trunk/src: . debconfvideo
Ben Hutchings
benh at alioth.debian.org
Wed Jul 22 15:32:46 UTC 2009
Author: benh
Date: 2009-07-22 15:32:45 +0000 (Wed, 22 Jul 2009)
New Revision: 489
Modified:
package/trunk/src/dc-do-transcoding
package/trunk/src/debconfvideo/__init__.py
package/trunk/src/debconfvideo/database.py
Log:
Add docstrings
Modified: package/trunk/src/dc-do-transcoding
===================================================================
--- package/trunk/src/dc-do-transcoding 2009-07-22 15:30:51 UTC (rev 488)
+++ package/trunk/src/dc-do-transcoding 2009-07-22 15:32:45 UTC (rev 489)
@@ -1,5 +1,9 @@
#!/usr/bin/python
+'''dc-do-transcoding: for each event-recording association and each
+target format, transcode the appropriate part of the recording into
+the target format'''
+
import os.path
import re
import select
@@ -12,6 +16,9 @@
from debconfvideo import config, database
def get_host_procs():
+ '''Get a list of (host, proc) tuples available to run jobs on.
+ proc values are integer identifiers distinguishing multiple
+ scheduling slots on a single host.'''
host_procs = []
cur = database.get_cursor()
cur.execute('SELECT hostname, nproc FROM video_encoding_host')
@@ -21,9 +28,14 @@
return host_procs
class Job(object):
+ '''Dumb class for job details'''
pass
def get_job_queue():
+ '''Get a list of transcoding jobs to be run, in descending order
+ of priority. Each job is represented by an instance of Job with
+ attributes from the corresponding video_event_recording and
+ video_target_format rows.'''
attrs = [
'video_event_recording.id', 'video_target_format.id',
'recording_filename', 'start_time', 'end_time',
@@ -66,6 +78,8 @@
return jobs
def mark_job_done(job, file_status_code):
+ '''Add a video_target_file row for the given job with the
+ given status.'''
cur = database.get_cursor()
cur.execute("""
INSERT INTO video_target_file(event_recording_id, target_format_id,
Modified: package/trunk/src/debconfvideo/__init__.py
===================================================================
--- package/trunk/src/debconfvideo/__init__.py 2009-07-22 15:30:51 UTC (rev 488)
+++ package/trunk/src/debconfvideo/__init__.py 2009-07-22 15:32:45 UTC (rev 489)
@@ -1,3 +1,5 @@
+'''debconfvideo module: various utilities for debconf-video scripts'''
+
import shellconfig
__all__ = ['config', 'database']
@@ -5,6 +7,9 @@
config = shellconfig.read_file('/etc/default/debconf-video')
def target_filename(video_event_recording, video_target_format):
+ '''Return target filename for an event-recording and target format.
+ video_event_recording and video_target_format must have attributes
+ corresponding to those in the corresponding table of the database.'''
return ('%s/%s/%s%s' %
(config['FILE_BASE'],
video_target_format.target_format_abbr,
Modified: package/trunk/src/debconfvideo/database.py
===================================================================
--- package/trunk/src/debconfvideo/database.py 2009-07-22 15:30:51 UTC (rev 488)
+++ package/trunk/src/debconfvideo/database.py 2009-07-22 15:32:45 UTC (rev 489)
@@ -1,3 +1,5 @@
+'''debconfvideo.database package: database access for debconf-video scripts'''
+
import pgdb
from debconfvideo import config
@@ -5,6 +7,7 @@
_connection = None
def get_cursor():
+ '''Return a new cursor for the configured database.'''
global _connection
if _connection:
try:
More information about the Debconf-video-commits
mailing list