Last active
May 2, 2018 17:40
-
-
Save karasugawasu/c46a213308f8326055c90082dc0a3197 to your computer and use it in GitHub Desktop.
やる気がないやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim ChapterTime | |
Dim second | |
Dim logfiles | |
Dim ChapterText | |
Dim deltime | |
Dim addtime | |
Dim skipflag | |
Const ForReading = 1 | |
Dim ChapCnt | |
Dim FiletmpName | |
FiletmpName = WScript.Arguments(0) | |
Set objFso = CreateObject("Scripting.FileSystemObject") | |
Set objFile = objFso.OpenTextFile(FiletmpName & ".mp4chapter.txt", 2, True) | |
deltime = 0 | |
addtime = 0 | |
ChapCnt = 2 | |
skipflag = False | |
ChapterText = "CHAPTER1=0:0:0.000" & vbCrLf & "CHAPTER1NAME=チャプター1" & vbCrLf | |
tmp = CreateObject("Scripting.FileSystemObject").OpenTextFile(FiletmpName & ".joinlogoscp.output.log").ReadAll | |
logfiles = Split(tmp,vbCrLf) | |
For i = 0 to Ubound(logfiles)-1 | |
Len(logfiles(i)) | |
For x = Len(logfiles(i)) to 2 Step -1 | |
strSpace = Space(x) | |
logfiles(i) = Replace(logfiles(i),strSpace," ") | |
Next | |
Select Case Split(logfiles(i)," ")(6) | |
Case ":Nologo(cut)",":CM",":Nologo" | |
'deltime = deltime + Split(logfiles(i)," ")(3) | |
Case Else | |
IF Split(logfiles(i)," ")(3) <= 9 Then | |
If i < Ubound(logfiles)-1 Then | |
If Split(logfiles(x)," ")(3) >= 60 Then | |
skipflag = True | |
End If | |
End IF | |
End If | |
second = Split(logfiles(i)," ")(3) + addtime | |
addtime = addtime + Split(logfiles(i)," ")(3) | |
IF skipflag = False Then | |
ChapterTime = second\3600 Mod 24 & ":" & second\60 Mod 60 & ":" & second Mod 60 & ":000" | |
'ChapterText = ChapterText & "AddChapterBySeconds(" & second & ",'チャプター" & ChapCnt & "')" & vbCrLf | |
ChapterText = ChapterText & "CHAPTER" & ChapCnt & "=" & ChapterTime & vbCrLf _ | |
& "CHAPTER" & ChapCnt & "NAME=" & "チャプター" & ChapCnt & vbCrLf | |
ChapCnt = ChapCnt + 1 | |
Else | |
skipflag = False | |
End If | |
End Select | |
Next | |
objFile.WriteLine ChapterText | |
objFile.Close | |
set objFso = Nothing | |
Set objFile = Nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim logfiles | |
Dim ChapterText | |
Dim ChapCnt | |
Dim logTrim | |
Dim ChapBuf | |
Dim ChapBufAf | |
Dim ChapSa | |
Dim ChapTime | |
Dim FiletmpName | |
FiletmpName = WScript.Arguments(0) | |
Set objFso = CreateObject("Scripting.FileSystemObject") | |
Set objFile = objFso.OpenTextFile(FiletmpName & ".mp4chapter.txt", 2, True) | |
ChapterText = "#Chapter 1:" & vbCrLf & "AddChapter(0,Chapter 1)" & vbCrLf | |
On Error Resume Next | |
If objFso.FileExists(FiletmpName & ".avspmod.avs") = True Then | |
tmp = CreateObject("Scripting.FileSystemObject").OpenTextFile(FiletmpName & ".avspmod.avs").ReadAll | |
Else | |
tmp = CreateObject("Scripting.FileSystemObject").OpenTextFile(FiletmpName & ".avs").ReadAll | |
End If | |
If Err.Number = 0 Or tmp <> "" Then | |
logfiles = Split(tmp,vbCrLf) | |
logfiles = Filter(logfiles, "Trim(") | |
logTrim = Replace(logfiles(0), " " , "") | |
logTrim = Replace(logTrim,"++" ,"") | |
logTrim = Replace(logTrim,"(" ,"") | |
logTrim = Replace(logTrim,")" ,"") | |
logTrim = Split(logTrim, "Trim") | |
ChapCnt = 1 | |
ChapBuf = Split(logTrim(ChapCnt), ",") | |
ChapBufAf = Split(logTrim(ChapCnt + 1 ),",") | |
ChapSa = ((ChapBufAf(0) - ChapBuf(1)) + ChapBuf(0)) - 1 | |
ChapTime = ChapBufAf(0) - ChapSa | |
ChapterText = ChapterText & "#Chapter " & ChapCnt + 1 & ":" & vbCrLf & "AddChapter(" & ChapTime & ",Chapter " & ChapCnt + 1 &")" & vbCrLf | |
ChapCnt = ChapCnt + 1 | |
Do While Ubound(logTrim) > ChapCnt | |
ChapBuf = Split(logTrim(ChapCnt), ",") | |
ChapBufAf = Split(logTrim(ChapCnt + 1 ),",") | |
ChapSa = (ChapBufAf(0) - ChapBuf(1)) + ChapSa | |
ChapTime = ChapBufAf(0) - ChapSa | |
ChapterText = ChapterText & "#Chapter " & ChapCnt + 1 & ":" & vbCrLf & "AddChapter(" & ChapTime & ",Chapter " & ChapCnt + 1 &")" & vbCrLf | |
ChapCnt = ChapCnt + 1 | |
Loop | |
End If | |
objFile.WriteLine ChapterText | |
objFile.Close | |
set objFso = Nothing | |
Set objFile = Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
両方正しく動作しないときがある。
時間があるときにちゃんとしたものを作るべき。