-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThorfile
25 lines (21 loc) · 812 Bytes
/
Thorfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'lib/subtitle_shift'
module SubtitleShift
class Cli < Thor
include Thor::Actions
namespace :subtitle
desc "shift OFFSET FILEPATH", "move the subtitles forward in time"
def shift(offset, file_path)
say_status(:backup, "creating .bak copy")
File.rename(file_path, "#{file_path}.bak")
say_status(:shifting, "#{offset}ms")
::SubtitleShift::Shifter.shift("#{file_path}.bak", file_path, offset.to_i)
end
desc "unshift OFFSET FILEPATH", "move the subtitles backward in time"
def unshift(offset, file_path)
say_status(:backup, "creating .bak copy")
File.rename(file_path, "#{file_path}.bak")
say_status(:unshifting, "-#{offset}ms")
::SubtitleShift::Shifter.shift("#{file_path}.bak", file_path, offset.to_i * -1)
end
end
end