[xiph-commits] r2939 - cmmlwiki/trunk/cmmlwiki

shans at svn.annodex.net shans at svn.annodex.net
Fri Jun 15 15:41:10 PDT 2007


Author: shans
Date: 2007-06-15 15:41:09 -0700 (Fri, 15 Jun 2007)
New Revision: 2939

Modified:
   cmmlwiki/trunk/cmmlwiki/handler.py
   cmmlwiki/trunk/cmmlwiki/toc.py
Log:
Added a tap-to-insert-clip script to the TOC.  This passes the current playback
time to Edit:Clip.



Modified: cmmlwiki/trunk/cmmlwiki/handler.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/handler.py	2007-06-15 00:45:02 UTC (rev 2938)
+++ cmmlwiki/trunk/cmmlwiki/handler.py	2007-06-15 22:41:09 UTC (rev 2939)
@@ -325,8 +325,13 @@
     except KeyError:
       ixc = -1
 
+    try:
+      time = self.form['t'].value
+    except KeyError:
+      time = 0
+
     if (ixc == -1):
-        c = cmmlwiki.clip.Clip (self.ixi)
+        c = cmmlwiki.clip.Clip (self.ixi, start_time=time)
         ixc = c.ixc
 
         title = "%s: Insert clip" % self.iname

Modified: cmmlwiki/trunk/cmmlwiki/toc.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/toc.py	2007-06-15 00:45:02 UTC (rev 2938)
+++ cmmlwiki/trunk/cmmlwiki/toc.py	2007-06-15 22:41:09 UTC (rev 2939)
@@ -21,6 +21,7 @@
 from cmmlwiki.pagenumbers import PageNumbers
 #from cmmlwiki.cortado import Cortado
 from cmmlwiki.embed import Embed
+from cmmlwiki.location import WikiURL
 
 class TOC:
 
@@ -35,7 +36,22 @@
 
     #s = Cortado(self.iname, self.offset).template(vars)
     s = Embed(self.iname, self.offset).template(vars)
+    edit_url = WikiURL('Edit:Clip/%s?t=' % self.iname).template(vars)
+    s += """
+<script>
+function KeyPressed(e) {
 
+  var plugin = document.embeds[0];
+  if (String.fromCharCode(e.which) == "~") {
+    window.location = "%s" + (plugin.getPlayPosition() / 1000)
+  }
+  return true;
+}
+document.getElementsByTagName("body")[0].setAttribute("onkeypress",
+                "KeyPressed(event)")
+</script>
+    """ % edit_url
+
     actions = ''
     s += '<div class="metadata-box">\n'
     s += ItemFormat (self.inspector, self.ixi, actions).template(vars)



More information about the commits mailing list