Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- set TMPFILE=tmp
- set COMSKIP=D:\opt\DTV\comskip\comskip.exe
- cd /d %~dp0
- :bat_start
- set chapter_txt_name=%~dpn1
- set chapter_txt_name=%chapter_txt_name:.chapters=%
- set chapter_txt_name=%chapter_txt_name:.d2v=%
- set TRIMFILE="%~dpn1.vdr"
- if not exist %TRIMFILE% (
- call %COMSKIP% "%~dpn1.ts"
- )
- copy %TRIMFILE% %TMPFILE%
- setlocal ENABLEDELAYEDEXPANSION
- set CHAPTER=c
- for /F "tokens=1,2,3 delims=:" %%A in ( %TMPFILE% ) do (
- set /a t_hour=%%A
- set t_minute=%%B
- set t_second=%%C
- if "!t_second:~-5!"=="start" (
- set t_second=!t_second: start=!
- set STATUS=cix
- REM set /a OFFSETS=-1
- set /a OFFSETS=0
- ) else if "!t_second:~-3!"=="end" (
- set t_second=!t_second: end=!
- set STATUS=cox
- REM set /a OFFSETS=1
- set /a OFFSETS=0
- ) else (
- goto end
- )
- if "!t_minute:~0,1!"=="0" (
- set /a t_minute=!t_minute:~-1!
- ) else (
- set /a t_minute=!t_minute!
- )
- set t_msec=!t_second:.=!0
- if "!t_msec:~0,1!"=="0" (
- set /a t_msec=!t_msec:~-4!
- ) else (
- set /a t_msec=!t_msec!
- )
- set /a t_msecond=!t_hour!*3600000+!t_minute!*60000+!t_msec!
- if !t_msecond! EQU 0 (
- set /a t_msecond=0
- ) else (
- set /a t_msecond=!t_msecond!+!OFFSETS!
- )
- set t_msecond=!t_msecond!
- set CHAPTER=!CHAPTER!-!t_msecond!!STATUS!
- )
- set CHAPTER=!CHAPTER!-0eox-c
- echo !CHAPTER!>%TMPFILE%
- endlocal
- if exist "%chapter_txt_name%.chapter" (
- copy %TMPFILE% "%chapter_txt_name%(チャプタースキップ用).chapter"
- ) else (
- copy %TMPFILE% "%chapter_txt_name%.chapter"
- )
- del %TMPFILE% %TRIMFILE%
- rem 次のファイルがあれば :bat_start に戻る
- shift
- if not "%~1"=="" goto bat_start
- exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement