사용자 도구

사이트 도구


subtitle_helper

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판 양쪽 다음 판
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:default cp949]"
 + System.exit(-1)
 +}
 +
 +def smi = new File(args[0])
 +def millis = Long.parseLong(args[1])
 +def encoding = args.length == 3 ? args[2] : "cp949"
 +
 +println "$smi, $millis, $encoding"
 +
 +def text = smi.getText(encoding)
 +def converted = text.replaceAll(/Start=([0-9]+)/) {
 + "Start=" + (Long.parseLong(it[1]) + millis)
 +}
 +
 +smi.setText(converted, encoding)
 +</code>
 +
subtitle_helper.txt · 마지막으로 수정됨: 2015/10/04 23:29 저자 kwon37xi