srt 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d968cae2699fc1dd691a20c0714412659feed184
4
- data.tar.gz: 209e318fd211fb54b2a9792f3cf61b691327612a
2
+ SHA256:
3
+ metadata.gz: 28e7323497b349d7a2089aa395ad2c1ba1c3985729111dc56706c3280521bb5f
4
+ data.tar.gz: 82fe89057aee1e6a6aea48a16d33740686a18d0444f5559820603ff1b9a2a062
5
5
  SHA512:
6
- metadata.gz: '095c33709a65f85f6e5eb1d05a2577f941b1f31d75399563dad423779fa66256caad3f9fc091db4e86ae57bc9cf51d161da7d2e896cd916222ba2717073e9518'
7
- data.tar.gz: 9e5551a03c3380f0bbb322985ceea14670196c7815756f34c34a38a7971e027b859ccfbc1931e201513a97d06f21c2c88e97d192251a759cd6094c731ac47a2e
6
+ metadata.gz: 699aaea2dda022acb10cb2e5d1db24d36ad8adec53528b1e186c6b75a549a049cbfd33f806d2cd4e276ae7ecabde412c9e9181c50335dc2f613ac79cefda5f31
7
+ data.tar.gz: c8abffc1bf997c624ee0cb0e06b0a49b9dd88b584a6fdb3c9edbd3170acb3a5e8a449b4d35eb3edfd2bc825c79389170da2d44589be602b02dced7a39223e4ef
@@ -33,7 +33,7 @@ module SRT
33
33
  end
34
34
 
35
35
  def time_str(subframe_separator=",")
36
- [@start_time, @end_time].map { |t| sprintf("%02d:%02d:%02d#{subframe_separator}%s", t / 3600, (t % 3600) / 60, t % 60, sprintf("%.3f", t)[-3, 3]) }.join(" --> ")
36
+ [@start_time, @end_time].map { |t| f=sprintf("%.3f", t); ip=f[0,f.size-4].to_i;fp=f[-3,3]; "%02d:%02d:%02d#{subframe_separator}%s" % [ip / 3600, (ip % 3600) / 60, ip % 60,fp] }.join(" --> ")
37
37
  end
38
38
 
39
39
  def webvtt_time_str
@@ -1,3 +1,3 @@
1
1
  module SRT
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -23,6 +23,19 @@ describe SRT::Line do
23
23
  end
24
24
  end
25
25
 
26
+ describe "#time_str (second time)" do
27
+ let(:line) { SRT::Line.new }
28
+
29
+ before do
30
+ line.start_time = 36915.85455630479
31
+ line.end_time = 36915.999869858395
32
+ end
33
+
34
+ it "should produce timecodes that match the internal float values" do
35
+ expect(line.time_str).to eq("10:15:15,855 --> 10:15:16,000")
36
+ end
37
+ end
38
+
26
39
  describe "#to_s" do
27
40
  let(:line) { SRT::Line.new }
28
41
 
@@ -31,7 +44,7 @@ describe SRT::Line do
31
44
  line.start_time = 224.2
32
45
  line.end_time = 244.578
33
46
  end
34
-
47
+
35
48
  context "with empty content" do
36
49
  it "creates a valid empty node" do
37
50
  expect(line.to_s).to eq("1\n00:03:44,200 --> 00:04:04,578\n\n")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: srt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Petersen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-11 00:00:00.000000000 Z
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  requirements: []
104
104
  rubyforge_project:
105
- rubygems_version: 2.5.2
105
+ rubygems_version: 2.7.6.2
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Ruby gem for parsing subtitle files.