[Cvs-annodex] commit (annodex): cmmlwiki/trunk/cmmlwiki/database.py
cmmlwiki/trunk/cmmlwiki/framer.py
cmmlwiki/trunk/cmmlwiki/infocache.py
cmmlwiki/trunk/cmmlwiki/itemsummary.py
cmmlwiki/trunk/cmmlwiki/oggzinfo.py
conrad
nobody at lists.annodex.net
Tue Jun 13 08:21:34 UTC 2006
Update of /var/local/lib/svn/annodex (new revision 2330)
Modified files:
cmmlwiki/trunk/cmmlwiki/database.py
cmmlwiki/trunk/cmmlwiki/framer.py
cmmlwiki/trunk/cmmlwiki/infocache.py
cmmlwiki/trunk/cmmlwiki/itemsummary.py
cmmlwiki/trunk/cmmlwiki/oggzinfo.py
Log Message:
generalize detection of audio and video in sources. Provide has_audio, has_video
methods and use these to select which info is shown in item summaries. Adds
support for video-only files (eg. sign language videos)
Modified: cmmlwiki/trunk/cmmlwiki/database.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/database.py 2006-06-13 07:52:07 UTC (rev 2329)
+++ cmmlwiki/trunk/cmmlwiki/database.py 2006-06-13 08:21:33 UTC (rev 2330)
@@ -66,6 +66,27 @@
con.commit()
+# Upgrade from version 8 to 9
+def upgrade_9 (env, con, cur):
+
+ # Drop the old copy of source_info: it is a cache, and if not all its
+ # values are updated, it is invalid
+ cur.execute('DROP TABLE source_info')
+
+ sql = """CREATE TABLE source_info (
+ ixs INTEGER PRIMARY KEY,
+ duration CHAR,
+ bitrate CHAR,
+ resolution CHAR,
+ framerate CHAR,
+ has_video INT,
+ has_audio INT,
+ audio CHAR
+ )"""
+ cur.execute(sql)
+
+ set_db_version (con, cur, 9)
+
# Upgrade from version 7 to 8
def upgrade_8 (env, con, cur):
@@ -313,6 +334,8 @@
upgrade_7 (env, con, cur)
if (db_version < 8):
upgrade_8 (env, con, cur)
+ if (db_version < 9):
+ upgrade_9 (env, con, cur)
con.commit()
con.close()
Modified: cmmlwiki/trunk/cmmlwiki/framer.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/framer.py 2006-06-13 07:52:07 UTC (rev 2329)
+++ cmmlwiki/trunk/cmmlwiki/framer.py 2006-06-13 08:21:33 UTC (rev 2330)
@@ -22,7 +22,7 @@
#as it depends on gst0.10 disabled for now
#FIXME: does not return an image if seeking beond eof
-use_gst=False
+use_gst=True
class snapshot_gst:
Modified: cmmlwiki/trunk/cmmlwiki/infocache.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/infocache.py 2006-06-13 07:52:07 UTC (rev 2329)
+++ cmmlwiki/trunk/cmmlwiki/infocache.py 2006-06-13 08:21:33 UTC (rev 2330)
@@ -63,13 +63,15 @@
self.vals['bitrate'] = row['bitrate']
self.vals['resolution'] = row['resolution']
self.vals['framerate'] = row['framerate']
+ self.vals['has_video'] = row['has_video']
+ self.vals['has_audio'] = row['has_audio']
self.vals['audio'] = row['audio']
return True
def cache_write(self):
- sql = """INSERT INTO source_info (ixs, duration, bitrate, resolution, framerate, audio)
- VALUES (%(ixs)d, %(duration)s, %(bitrate)s, %(resolution)s, %(framerate)s, %(audio)s)"""
+ sql = """INSERT INTO source_info (ixs, duration, bitrate, resolution, framerate, has_video, has_audio, audio)
+ VALUES (%(ixs)d, %(duration)s, %(bitrate)s, %(resolution)s, %(framerate)s, %(has_video)s, %(has_audio)s, %(audio)s)"""
self.cur.execute (sql, self.vals)
self.con.commit()
@@ -84,6 +86,16 @@
self.vals['framerate'] = o.framerate()
self.vals['audio'] = o.audio()
+ if (o.has_video()):
+ self.vals['has_video'] = 1
+ else:
+ self.vals['has_video'] = 0
+
+ if (o.has_audio()):
+ self.vals['has_audio'] = 1
+ else:
+ self.vals['has_audio'] = 0
+
def duration(self):
return self.vals['duration']
@@ -96,5 +108,11 @@
def framerate(self):
return self.vals['framerate']
+ def has_video(self):
+ return (self.vals['has_video'] == 1)
+
+ def has_audio(self):
+ return (self.vals['has_audio'] == 1)
+
def audio(self):
return self.vals['audio']
Modified: cmmlwiki/trunk/cmmlwiki/itemsummary.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/itemsummary.py 2006-06-13 07:52:07 UTC (rev 2329)
+++ cmmlwiki/trunk/cmmlwiki/itemsummary.py 2006-06-13 08:21:33 UTC (rev 2330)
@@ -46,10 +46,11 @@
i = InfoCache (self.inspector, self.ixi)
s += "<b>Duration:</b> %s<br/>" % (i.duration())
s += "<b>Bitrate:</b> %s<br/>" % (i.bitrate())
- if (i.framerate() != 'Unknown'):
+ if (i.has_video()):
s += "<b>Resolution:</b> %s<br/>" % (i.resolution())
s += "<b>Framerate:</b> %s<br/>" % (i.framerate())
- s += "<b>Audio:</b> %s<br/>" % (i.audio())
+ if (i.has_audio()):
+ s += "<b>Audio:</b> %s<br/>" % (i.audio())
# Get count of clips
vals = {}
Modified: cmmlwiki/trunk/cmmlwiki/oggzinfo.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/oggzinfo.py 2006-06-13 07:52:07 UTC (rev 2329)
+++ cmmlwiki/trunk/cmmlwiki/oggzinfo.py 2006-06-13 08:21:33 UTC (rev 2330)
@@ -42,8 +42,18 @@
def framerate(self):
return self.headerval ('Video-Framerate')
+ def has_video(self):
+ return (self.framerate() != "Unknown")
+
+ def has_audio(self):
+ samplerate = self.headerval ('Audio-Samplerate')
+ return (samplerate != "Unknown")
+
def audio(self):
samplerate = self.headerval ('Audio-Samplerate')
+ if (samplerate == "Unknown"):
+ return "None"
+
channels = self.headerval ('Audio-Channels')
if (channels == "1"):
cdesc= "Mono"
--
conrad
More information about the cvs-annodex
mailing list