ttml 0.0.3 → 0.0.4
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.
- data/lib/ttml.rb +3 -2
- data/lib/ttml/version.rb +1 -1
- metadata +2 -2
data/lib/ttml.rb
CHANGED
@@ -22,7 +22,7 @@ module Ttml
|
|
22
22
|
@doc = Nokogiri::XML(stream)
|
23
23
|
@namespaces = @doc.collect_namespaces
|
24
24
|
# puts "Ho namespaces? #{ @namespaces.inspect }"
|
25
|
-
@subs_ns = @namespaces.invert["http://www.w3.org/2006/10/ttaf1"]
|
25
|
+
@subs_ns = @namespaces.invert["http://www.w3.org/2006/10/ttaf1"].sub(/^xmlns:/,'')
|
26
26
|
@meta_ns = @namespaces.invert["http://www.w3.org/2006/10/ttaf1#metadata"].sub(/^xmlns:/,'')
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,8 @@ module Ttml
|
|
30
30
|
# (or all subtitles if both are missing).
|
31
31
|
# I tried using xpath functions, without success,
|
32
32
|
# as in xmlns:div/xmlns:p[number(@begin)=>746.63] - any ideas?
|
33
|
-
def subtitle_stream from = 0.0, to =
|
33
|
+
def subtitle_stream from = 0.0, to = nil
|
34
|
+
to = 99999999999.99 unless to
|
34
35
|
doc.xpath("/#{ @subs_ns }:tt/#{ @subs_ns }:body/#{ @subs_ns }:div/#{ @subs_ns }:p").select {|n|
|
35
36
|
# puts "Vedo se #{ n['begin'].to_f } >= #{ from } e se #{ n['end'].to_f } <= #{ to }"
|
36
37
|
(n['begin'].to_f >= from) && (n['end'].to_f <= to)
|
data/lib/ttml/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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: 2012-09-
|
12
|
+
date: 2012-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|