|
干脆直接用 EXCEL 或者 WORD 写了一个程序,直接COPY 到模块里面运行算了。 效果还不错,呵呵。 Function SplitTheTransformerMovice() '记得引用 Microsoft Scripting Runtime
Dim fso As New FileSystemObject Dim txt As TextStream Dim txt2 As TextStream Dim strT1 As String Dim strT2 As String Dim secondsAdd As Long Dim msecondsAdd As Long Dim sourceTitleFile As String Dim targetTitleFile As String secondsAdd = (1 * 3600 + 14 * 60 + 38) * -1 msecondsAdd = -350 sourceTitleFile = "E:\dvd\11.02.07.Transformers.2007.DiVX6.DTS.2ADUDiO.HD.DVDRiP-CHD\chd-transformers-dts-2audio-hd-dvdrip-disc2.chs.srtold" targetTitleFile = "E:\dvd\11.02.07.Transformers.2007.DiVX6.DTS.2ADUDiO.HD.DVDRiP-CHD\chd-transformers-dts-2audio-hd-dvdrip-disc2.chs.srt" Set txt = fso.OpenTextFile(sourceTitleFile, ForReading, False) Set txt2 = fso.OpenTextFile(targetTitleFile, ForWriting, True) Dim strLine Do Until txt.AtEndOfStream = True strLine = txt.ReadLine If IsDate(Mid(strLine, 1, 8)) = True And IsDate(Mid(strLine, 18, 8)) = True Then strT1 = Mid(strLine, 1, 12) strT2 = Mid(strLine, 18, 12) strLine = dateAdd_Srt(strT1, secondsAdd, msecondsAdd) & " --> " & dateAdd_Srt(strT2, secondsAdd, msecondsAdd) End If txt2.WriteLine strLine Loop txt.Close txt2.Close Set fso = Nothing End Function
'只用于调整 *.srt 字幕文件中的时间 Function dateAdd_Srt(ByVal timeString As String, ByVal seconds As Long, ByVal milliseconds As Long) As String Dim dteTime As Date Dim lngMS As Long dteTime = CDate(Mid(timeString, 1, 8)) lngMS = CLng(Mid(timeString, 10, 3)) dteTime = DateAdd("s", seconds, dteTime) If milliseconds > 0 Then If (lngMS + milliseconds) > 999 Then lngMS = (lngMS + milliseconds) Mod 1000 dteTime = DateAdd("s", 1, dteTime) Else lngMS = lngMS + milliseconds End If Else If (lngMS + milliseconds) < 0 Then lngMS = (lngMS + milliseconds) Mod 1000 dteTime = DateAdd("s", -1, dteTime) Else lngMS = lngMS + milliseconds End If lngMS = Abs(lngMS) End If dateAdd_Srt = Format(dteTime, "hh:nn:ss") & "," & Format(lngMS, "000") End Function
字幕文件下载 |