5 # vobshift.py in.idx out.idx -8.45
7 # this will read in in.idx,shift it by 8.45 seconds back,
8 # and save it as out.idx
10 # license: i don't care ;)
20 return (begin
,middle
,end
)
26 milli
= int( t
[9:12] )
27 return datetime
.timedelta(hours
=h
,minutes
=m
,seconds
=s
,milliseconds
=milli
)
32 if len(milli
) == 0: #fix for .000 seconds
34 return '0'+t
[:7]+':'+milli
36 def shift(line
,seconds
):
37 triplet
= tripletize(line
)
39 base
= text2delta(triplet
[1])
40 base
= base
+ datetime
.timedelta(seconds
=seconds
)
41 base
= delta2text(base
)
43 return triplet
[0]+base
+triplet
[2]
47 DIFF
=float(sys
.argv
[3])
49 o
= open(OUTFILE
,'wt')
52 for line
in open(INFILE
):
53 if line
.startswith('timestamp'):
54 line
= shift(line
,DIFF
)