webvtt 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 +2 -4
- data/lib/webvtt/file.rb +12 -2
- data/lib/webvtt/version.rb +1 -1
- data/test/examples/tolson.vtt +6 -0
- metadata +8 -3
data/README.md
CHANGED
@@ -14,9 +14,7 @@ page to increase SEO and allow for jumping to sections of the video.
|
|
14
14
|
# Install
|
15
15
|
|
16
16
|
```
|
17
|
-
|
18
|
-
rake build
|
19
|
-
gem install pkg/webvtt.x.x.x.gem
|
17
|
+
gem install webvtt
|
20
18
|
```
|
21
19
|
|
22
20
|
# Usage
|
@@ -55,4 +53,4 @@ Jason Ronallo
|
|
55
53
|
|
56
54
|
# License
|
57
55
|
|
58
|
-
See LICENSE
|
56
|
+
See LICENSE
|
data/lib/webvtt/file.rb
CHANGED
@@ -33,8 +33,10 @@ module Webvtt
|
|
33
33
|
line.chomp!
|
34
34
|
|
35
35
|
next if webvtt_line?(line)
|
36
|
-
if line.empty?
|
37
|
-
|
36
|
+
if line.empty?
|
37
|
+
if !collected_lines.empty? and !notes?(collected_lines)
|
38
|
+
add_a_cue(collected_lines)
|
39
|
+
end
|
38
40
|
collected_lines = []
|
39
41
|
elsif !line.empty? and file_lines.length == (index + 1)
|
40
42
|
collected_lines << line
|
@@ -68,5 +70,13 @@ private
|
|
68
70
|
cues << Cue.new(cue_opts)
|
69
71
|
end
|
70
72
|
|
73
|
+
def notes?(collected_lines)
|
74
|
+
if collected_lines.first.match(/^NOTES/)
|
75
|
+
true
|
76
|
+
else
|
77
|
+
false
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
71
81
|
end
|
72
82
|
end
|
data/lib/webvtt/version.rb
CHANGED
data/test/examples/tolson.vtt
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
WEBVTT
|
2
2
|
|
3
|
+
NOTES This is a note.
|
4
|
+
|
3
5
|
1
|
4
6
|
00:00:00 --> 00:00:03.000 D:vertical A:start
|
5
7
|
I grew up in Eastern North Carolina, <b>Edgecombe</b> County
|
6
8
|
|
9
|
+
NOTES
|
10
|
+
This is also
|
11
|
+
a note.
|
12
|
+
|
7
13
|
2
|
8
14
|
00:00:03.300 --> 00:00:07.800 A:start
|
9
15
|
on a tobacco and dairy farm outside of
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webvtt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|
@@ -77,12 +77,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
77
|
- - ! '>='
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
hash: 3014810322973854166
|
80
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
84
|
none: false
|
82
85
|
requirements:
|
83
86
|
- - ! '>='
|
84
87
|
- !ruby/object:Gem::Version
|
85
88
|
version: '0'
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
hash: 3014810322973854166
|
86
92
|
requirements: []
|
87
93
|
rubyforge_project: webvtt
|
88
94
|
rubygems_version: 1.8.24
|
@@ -90,4 +96,3 @@ signing_key:
|
|
90
96
|
specification_version: 3
|
91
97
|
summary: WEBVTT file parser in Ruby
|
92
98
|
test_files: []
|
93
|
-
has_rdoc:
|