|
咁都睇得明, 都利害..
我想你幫我寫一個program. 在 c:\Python\prog\extract\timeline 這個folder入面, 有後多 .srt 檔案. 每個檔案都是以下的形式:
22 00:00:13,140 --> 00:00:16,440 然后看了一整晚俄羅斯的行車記錄儀錄像 and then watched Russian dashcam videos all night.
23 00:00:16,440 --> 00:00:18,770 開車就是殺人 Vodit' znachit ubivat'!
24 00:00:18,870 --> 00:00:19,850 聽著 馬姬 Listen, Marge.
它入面分開一組一組. 每一組相隔一個空行. 每一組的第一行是一個數字, 例如 1 每一組的第2行是關於時間, 例如 00:00:00,008 --> 00:00:01,477 每一組的第剩餘的是對話內容
我想在Python程式 pass一個Parameter, 例如 00:00:16
那麼, 凡是時間小於這個Parameter, 便不用理會
例如以下這個便不用理會:
22 00:00:13,140 --> 00:00:16,440 然后看了一整晚俄羅斯的行車記錄儀錄像 and then watched Russian dashcam videos all night.
那麼, 凡是時間大於這個Parameter, 便調整時間
例如以下這個:
23 00:00:16,440 --> 00:00:18,770 開車就是殺人 Vodit' znachit ubivat'!
就減去了時間, 變成
00:00:00,440 --> 00:00:02,770 開車就是殺人 Vodit' znachit ubivat'!
然後, 把所有資料, 抄去一個新的檔案, 加上prefix "out-"
可以做到嗎?
雖然後bug, 但係我比個Error 佢, 就攪掂了.
|