srt 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/lib/srt/file.rb +8 -8
- data/lib/srt/version.rb +1 -1
- metadata +11 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1d78709bafbe0108d1b453ea5ccad50e65ac8d77
|
4
|
+
data.tar.gz: c25aceb9b79d1beb1c0be65bf6383593238d8aad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eca5bb6785cedd43ee20d2cc0d700713df14dc5e5d8d02d520f04730405b65c11a6cb8f2e72e802d971b87040ff356d8d919f4a74b40d1e3cf4a38fccd6af14a
|
7
|
+
data.tar.gz: e4a936cb2d04bb08b2e3dd64b9d8043a957ad403c57df1949cfc45d80c411f13b4efdd38d8c3636ccf8ced401261f2fbd817b9be989f4d47c8cd320b56314a36
|
data/.gitignore
CHANGED
data/lib/srt/file.rb
CHANGED
@@ -17,7 +17,7 @@ module SRT
|
|
17
17
|
def self.parse_string(srt_data)
|
18
18
|
result = SRT::File.new
|
19
19
|
line = SRT::Line.new
|
20
|
-
|
20
|
+
|
21
21
|
split_srt_data(srt_data).each_with_index do |str, index|
|
22
22
|
begin
|
23
23
|
if str.strip.empty?
|
@@ -31,12 +31,12 @@ module SRT
|
|
31
31
|
|
32
32
|
if (line.start_time = SRT::File.parse_timecode(mres["start_timecode"])) == nil
|
33
33
|
line.error = "#{line}, Invalid formatting of start timecode, [#{mres["start_timecode"]}]"
|
34
|
-
puts line.error
|
34
|
+
$stderr.puts line.error
|
35
35
|
end
|
36
36
|
|
37
37
|
if (line.end_time = SRT::File.parse_timecode(mres["end_timecode"])) == nil
|
38
38
|
line.error = "#{line}, Invalid formatting of end timecode, [#{mres["end_timecode"]}]"
|
39
|
-
puts line.error
|
39
|
+
$stderr.puts line.error
|
40
40
|
end
|
41
41
|
|
42
42
|
if mres["display_coordinates"]
|
@@ -44,7 +44,7 @@ module SRT
|
|
44
44
|
end
|
45
45
|
else
|
46
46
|
line.error = "#{line}, Invalid Time Line formatting, [#{str}]"
|
47
|
-
puts line.error
|
47
|
+
$stderr.puts line.error
|
48
48
|
end
|
49
49
|
else
|
50
50
|
line.text << str.strip
|
@@ -53,14 +53,14 @@ module SRT
|
|
53
53
|
end
|
54
54
|
rescue
|
55
55
|
line.error = "#{index}, General Error, [#{str}]"
|
56
|
-
puts line.error
|
56
|
+
$stderr.puts line.error
|
57
57
|
end
|
58
58
|
end
|
59
59
|
result
|
60
60
|
end
|
61
61
|
|
62
|
-
# Ruby often gets the wrong encoding for a file and will throw
|
63
|
-
# errors on `split` for invalid byte sequences. This chain of
|
62
|
+
# Ruby often gets the wrong encoding for a file and will throw
|
63
|
+
# errors on `split` for invalid byte sequences. This chain of
|
64
64
|
# fallback encodings lets us get something that works.
|
65
65
|
def self.split_srt_data(srt_data)
|
66
66
|
begin
|
@@ -230,7 +230,7 @@ module SRT
|
|
230
230
|
end
|
231
231
|
|
232
232
|
def self.parse_timespan(timespan_string)
|
233
|
-
factors = {
|
233
|
+
factors = {
|
234
234
|
"mil" => 0.001,
|
235
235
|
"s" => 1,
|
236
236
|
"m" => 60,
|
data/lib/srt/version.rb
CHANGED
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: srt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Christopher Petersen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-14 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description: Ruby gem for parsing srt (subtitle) files. SRT stands for SubRip text
|
@@ -70,27 +65,26 @@ files:
|
|
70
65
|
- srt.gemspec
|
71
66
|
homepage: https://github.com/cpetersen/srt
|
72
67
|
licenses: []
|
68
|
+
metadata: {}
|
73
69
|
post_install_message:
|
74
70
|
rdoc_options: []
|
75
71
|
require_paths:
|
76
72
|
- lib
|
77
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
74
|
requirements:
|
80
|
-
- -
|
75
|
+
- - '>='
|
81
76
|
- !ruby/object:Gem::Version
|
82
77
|
version: '0'
|
83
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
79
|
requirements:
|
86
|
-
- -
|
80
|
+
- - '>='
|
87
81
|
- !ruby/object:Gem::Version
|
88
82
|
version: '0'
|
89
83
|
requirements: []
|
90
84
|
rubyforge_project:
|
91
|
-
rubygems_version:
|
85
|
+
rubygems_version: 2.0.3
|
92
86
|
signing_key:
|
93
|
-
specification_version:
|
87
|
+
specification_version: 4
|
94
88
|
summary: Ruby gem for parsing subtitle files.
|
95
89
|
test_files:
|
96
90
|
- spec/blackswan-part1.srt
|