subrip 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/shift.rb +10 -4
- data/lib/subrip/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
data/lib/shift.rb
CHANGED
@@ -11,10 +11,16 @@ module Subrip
|
|
11
11
|
|
12
12
|
def shift_subtitle
|
13
13
|
op_lines = File.readlines(@ip_file).map do |line|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
begin
|
15
|
+
if line.match /(.*) --> (.*)/
|
16
|
+
"#{transform_time($1)} --> #{transform_time($2)}\n"
|
17
|
+
else
|
18
|
+
# in some files newline is interpretted as carriage return
|
19
|
+
line.chomp! + '\n'
|
20
|
+
end
|
21
|
+
rescue ArgumentError
|
22
|
+
# skipping non utf-8 chars
|
23
|
+
next
|
18
24
|
end
|
19
25
|
end
|
20
26
|
File.open(@op_file, 'w') do |f|
|
data/lib/subrip/version.rb
CHANGED