Mercurial > mplayer.hg
view TOOLS/vobshift.py @ 36689:e8567b5f7da9
Change help message texts corresponding with r36766.
In r36766 some messages of the English master file have been merged.
Make these changes wherever these messages still differ in a translation.
Changes are:
MSGTR_MENU_AudioLanguages now same as MSGTR_MENU_AudioTrack
MSGTR_MENU_LoadSubtitle now same as MSGTR_PREFERENCES_FRAME_Subtitle
MSGTR_MENU_PlayCD now same as MSGTR_MENU_CD
MSGTR_MENU_PlayDVD now same as MSGTR_MENU_DVD
MSGTR_MENU_PlayDisc now same as MSGTR_MENU_Play
MSGTR_MENU_PlayVCD now same as MSGTR_MENU_VCD
MSGTR_MENU_SubtitleLanguages now same as MSGTR_MENU_Subtitles
MSGTR_PREFERENCES_FPS now same as MSGTR_PREFERENCES_SUB_FPS
MSGTR_PREFERENCES_Font now same as MSGTR_PREFERENCES_FRAME_Font
MSGTR_PREFERENCES_None now same as MSGTR_MENU_None
MSGTR_PREFERENCES_Subtitle now same as MSGTR_PREFERENCES_FRAME_Subtitle
MSGTR_SkinBrowser now same as MSGTR_MENU_SkinBrowser
author | ib |
---|---|
date | Tue, 04 Feb 2014 18:29:10 +0000 |
parents | 0f1b5b68af32 |
children |
line wrap: on
line source
#!/usr/bin/env python #usage: # # vobshift.py in.idx out.idx -8.45 # # this will read in in.idx,shift it by 8.45 seconds back, # and save it as out.idx # # license: i don't care ;) # import datetime import sys def tripletize(line): begin = line[:11] middle = line[11:23] end = line[23:] return (begin,middle,end) def text2delta(t): h = int( t[0:2] ) m = int( t[3:5] ) s = int( t[6:8] ) milli = int( t[9:12] ) return datetime.timedelta(hours=h,minutes=m,seconds=s,milliseconds=milli) def delta2text(d): t = str(d) milli = t[8:11] if len(milli) == 0: #fix for .000 seconds milli = '000' return '0'+t[:7]+':'+milli def shift(line,seconds): triplet = tripletize(line) base = text2delta(triplet[1]) base = base + datetime.timedelta(seconds=seconds) base = delta2text(base) return triplet[0]+base+triplet[2] INFILE =sys.argv[1] OUTFILE =sys.argv[2] DIFF =float(sys.argv[3]) o = open(OUTFILE,'wt') for line in open(INFILE): if line.startswith('timestamp'): line = shift(line,DIFF) o.write(line) o.close()