summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <jonheier@start.no>2007-09-30 00:18:01 +0200
committerJon Bergli Heier <jonheier@start.no>2007-09-30 00:18:01 +0200
commit52bbda1d41708a955abe3a691abac2c8b457714a (patch)
treea71e0413d087716f58b7117cd88bc6de3c512aa5
parentd5616e3970b5fe3a32f565e26ff776f93a62ac54 (diff)
Copied over lead-in and lead-out functions from old code.
-rw-r--r--pykfx.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pykfx.py b/pykfx.py
index ded5269..ea4e0d3 100644
--- a/pykfx.py
+++ b/pykfx.py
@@ -141,6 +141,20 @@ class Event:
self.karaoke.append(Syllable(tot - ms, tot, part))
+ def add_lead_in(self, s):
+ t = self.start.split(':')
+ ts = float(t[-1]) + 60 * int(t[-2]) + 3600 * int(t[-3]) - s
+ th, ts = int(ts / 3600), ts % 3600
+ tm, ts = int(ts / 60), ts % 60
+ self.start = '%01d:%02d:%05.2f' % (th, tm, ts)
+
+ def add_lead_out(self, s):
+ t = self.snd.split(':')
+ ts = float(t[-1]) + 60 * int(t[-2]) + 3600 * int(t[-3]) + s
+ th, ts = int(ts / 3600), ts % 3600
+ tm, ts = int(ts / 60), ts % 60
+ self.end = '%01d:%02d:%05.2f' % (th, tm, ts)
+
class Events:
def __init__(self, f = None):
self.format, self.events = [], []