문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 | 다음 판 양쪽 다음 판 | ||
subtitle_helper [2013/06/02 14:39] kwon37xi [동영상/자막 파일 이름 맞추기] |
subtitle_helper [2014/10/28 00:44] kwon37xi |
||
---|---|---|---|
줄 45: | 줄 45: | ||
* Groovy로 만들었음. | * Groovy로 만들었음. | ||
%gist(5692721)% | %gist(5692721)% | ||
+ | |||
+ | ====== smi time sync ====== | ||
+ | smi 파일의 시간을 싱크한다. | ||
+ | <code groovy> | ||
+ | if (args.length < 2) { | ||
+ | println "Usage groovy smi_timing filename milliseconds-to-adjust [encoding: | ||
+ | System.exit(-1) | ||
+ | } | ||
+ | |||
+ | def smi = new File(args[0]) | ||
+ | def millis = Long.parseLong(args[1]) | ||
+ | def encoding = args.length == 3 ? args[2] : " | ||
+ | |||
+ | println "$smi, $millis, $encoding" | ||
+ | |||
+ | def text = smi.getText(encoding) | ||
+ | def converted = text.replaceAll(/ | ||
+ | " | ||
+ | } | ||
+ | |||
+ | smi.setText(converted, | ||
+ | </ | ||
+ |