captions 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/captions/base.rb +17 -0
- data/lib/captions/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aaf29e28d6890736d40500f885c946f12b94573
|
4
|
+
data.tar.gz: ae528f8b011b5033b13741b3f1fdff94323f09d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e30036d4749fdae72ce8361be1476b43549047d3e264da85181ea28fcc0a09a0ac5aac092846ba7baeaca5da56a8285ec75bd0997e8cd00a4a57f2615011b831
|
7
|
+
data.tar.gz: e3d3fda2a92a78b906f7f6f910bfa66b9ebdd73c73e9934482b5ef6601e7a30b5e24924920eeb03968182545ec00f6443a7b307ad5d3e69b513ac2b6d877a084
|
data/README.md
CHANGED
@@ -106,6 +106,15 @@ new_cues = s.cues { |c| c.start_time > 2000 }
|
|
106
106
|
s.export_to_vtt('test.vtt', new_cues)
|
107
107
|
```
|
108
108
|
|
109
|
+
**Filter subtiltes and Export:**
|
110
|
+
|
111
|
+
Subtitles can be filtered with filter option. This returns a new `Captions` object. Once filters new object is created and cues for that becomes the result of the filter. This can be exported to other formats easily.
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
new_obj = s.filter { |c| c.start_time > 2000 }
|
115
|
+
new_obj.export_to_vtt('test.vtt')
|
116
|
+
```
|
117
|
+
|
109
118
|
## Installation
|
110
119
|
|
111
120
|
Add this line to your application's Gemfile:
|
data/lib/captions/base.rb
CHANGED
@@ -75,6 +75,23 @@ module Captions
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
# This filters the subtitle based on the condition and returns
|
79
|
+
# a new object. A condition is mandatory to filter subtitles
|
80
|
+
# Usage:
|
81
|
+
# p.filter
|
82
|
+
# p.filter { |c| c.start_time > 1000 }
|
83
|
+
# p.filter { |c| c.end_time > 1000 }
|
84
|
+
# p.filter { |c| c.duration > 1000 }
|
85
|
+
#
|
86
|
+
# Filters and returns a Captions class rather than a cue list
|
87
|
+
def filter(&block)
|
88
|
+
if block_given?
|
89
|
+
base = self.class.new()
|
90
|
+
base.cues = fetch_result(&block)
|
91
|
+
return base
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
78
95
|
# Moves subtitles by `n` milliseconds
|
79
96
|
# Usage:
|
80
97
|
# p.move_by(1000)
|
data/lib/captions/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: captions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- navin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|