srtshifter 1.1.2 → 1.1.3

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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # SRT Shifter
2
2
 
3
3
  [![Build Status](https://travis-ci.org/thiagokimo/srt-shifter.png)](https://travis-ci.org/thiagokimo/srt-shifter)
4
+ [![Gem Version](https://fury-badge.herokuapp.com/rb/srtshifter.png)](http://badge.fury.io/rb/srtshifter)
5
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/thiagokimo/srt-shifter)
4
6
 
5
7
  How many times you downloaded a movie that you couldn't find a perfect synchronized subtitle to watch it?
6
8
 
@@ -22,7 +22,7 @@ module SrtShifter
22
22
  opts.separator "Common Options:"
23
23
 
24
24
  opts.on("-o","--operation (ADD|SUB)", String, "Type ADD to increase time or SUB to decrease time.") do |o|
25
- @options[:operation] = o
25
+ @options[:operation] = o.upcase
26
26
  end
27
27
 
28
28
  opts.on("-t","--time (VALUE)", Float, "Time in milliseconds.") do |n|
@@ -38,7 +38,7 @@ module SrtShifter
38
38
 
39
39
  def convert_time time
40
40
 
41
- if @opts[:operation] == "SUB"
41
+ if @opts[:operation] == "SUB" and @opts[:time] > 0
42
42
  @opts[:time] = -@opts[:time]
43
43
  end
44
44
 
@@ -1,3 +1,3 @@
1
1
  module SrtShifter
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
@@ -7,7 +7,7 @@ describe SrtShifter do
7
7
  describe "validate_args" do
8
8
 
9
9
  before(:each) do
10
- @args = {:operation => "add", :time => 10.0, :input => "test/samples/test_srt.srt", :output => "test_output.srt"}
10
+ @args = {:operation => "ADD", :time => 10.0, :input => "test/samples/test_srt.srt", :output => "test_output.srt"}
11
11
  end
12
12
 
13
13
  after(:each) do
@@ -34,8 +34,9 @@ describe SrtShifter do
34
34
  it "must accept lowercase existing operations" do
35
35
 
36
36
  opts = SrtShifter::Options.new "test/samples/test_srt.srt test_output.srt"
37
- @args[:operation] = "add"
38
37
  opts.options = @args
38
+ opts.options[:operation] = "sub"
39
+
39
40
 
40
41
  lambda { opts.validate_args }.must_be_silent
41
42
  end
@@ -0,0 +1,99 @@
1
+ 1
2
+ 00:00:01,491 --> 00:00:03,827
3
+ у“у‚ŒуОуЇуЎ "у‚Йуƒžуƒƒу‚ЗуƒЅ" уЇуЏт€І
4
+
5
+ 2
6
+ 00:00:03,828 --> 00:00:04,995
7
+ у‚уŸу— уƒžуƒЊуƒЊуƒГ
8
+
9
+ 3
10
+ 00:00:04,996 --> 00:00:06,663
11
+ ш‰Џу„уƒŸуƒЅуƒМу‚Иу‚ЋуƒЋуŒх‡КцЅу‚‹
12
+
13
+ 4
14
+ 00:00:06,664 --> 00:00:08,048
15
+ "уƒЂуƒГуƒ­уƒМ у‚ЄуƒГ уƒŸуƒЅуƒМу‚Иу‚ЋуƒЋ" у‹?
16
+
17
+ 5
18
+ 00:00:08,049 --> 00:00:09,205
19
+ уЁу‚‡уЃуЈхО…уІ
20
+
21
+ 6
22
+ 00:00:09,208 --> 00:00:11,418
23
+ щЄŠх­чИчЕ„уЎц‰‹чЖšуу‚’у—уІу‚‹цœ€фИ­у
24
+
25
+ 7
26
+ 00:00:11,919 --> 00:00:14,379
27
+ у‚ЊуƒМуƒ‡у‚Ѓу‚ЗуƒЇуƒГх‰уЎчЈНхЄу‚’у—уІуІ
28
+
29
+ 8
30
+ 00:00:14,380 --> 00:00:16,440
31
+ х›уЎх…ЈуІу‚’шІ‹уЊу‘у‚ŒуА
32
+
33
+ 9
34
+ 00:00:16,841 --> 00:00:19,573
35
+ шГ‡ч”ЃуЏч›ДуЁуЋчЎЁшВЁфККуЋ
36
+
37
+ 10
38
+ 00:00:19,574 --> 00:00:21,386
39
+ цГ•хЛЗуЇфМšу„уОу—у‚‡у†у­
40
+
41
+ 11
42
+ 00:00:21,787 --> 00:00:23,930
43
+ цЌЁуЏу‚Ђу‚Єуƒ“уƒМ уƒЊуƒГу•у‚“
44
+
45
+ 12
46
+ 00:00:23,931 --> 00:00:25,265
47
+ уƒ‡уƒЌу‚Џ у‚Іу‚ЃуƒЊу‚Йу‚‚фНПуˆу‚‹
48
+
49
+ 13
50
+ 00:00:25,266 --> 00:00:27,408
51
+ хНМуЏфККуЈу—уІуЏцœ€фНŽу
52
+
53
+ 14
54
+ 00:00:27,625 --> 00:00:28,894
55
+ уƒžуƒЊуƒЊуƒГуЎхНЙу‚ˆ
56
+
57
+ 15
58
+ 00:00:28,895 --> 00:00:31,787
59
+ "цЅуІцЌВу—у„" уЃуІ
60
+
61
+ 16
62
+ 00:00:32,188 --> 00:00:34,388
63
+ "у‚ГуƒМуƒЋуƒуƒƒу‚Џ"
64
+
65
+ 17
66
+ 00:00:35,441 --> 00:00:38,907
67
+ "чЇу‚’шВДц–Йш‰ВуЋцŸ“у‚уІ"
68
+
69
+ 18
70
+ 00:00:38,908 --> 00:00:42,310
71
+ "шВДц–ЙуЎу‚ЏуƒЋуƒžуЎш‰ВуЋ"
72
+
73
+ 19
74
+ 00:00:42,311 --> 00:00:45,647
75
+ "чЇу‚’шВДц–Йш‰ВуЋцŸ“у‚уІ"
76
+
77
+ 20
78
+ 00:00:45,648 --> 00:00:49,117
79
+ "шВДц–Йу‚’уšуЃуЈшІ‹уІуŸ"
80
+
81
+ 21
82
+ 00:00:49,118 --> 00:00:52,654
83
+ "хЅНууЊш‰ВуЋчЇу‚’цŸ“у‚уІ"
84
+
85
+ 22
86
+ 00:00:52,655 --> 00:00:55,723
87
+ "шВДц–Йу‚’уšуЃуЈшІ‹уІуŸу‹у‚‰"
88
+
89
+ 23
90
+ 00:00:55,724 --> 00:00:58,593
91
+ "у у‹у‚‰щ›ЛшЉБу‚’щ ‚цˆД"
92
+
93
+ 24
94
+ 00:00:58,594 --> 00:01:02,329
95
+ "фН•ц™‚уЇу‚‚ш‰Џу„у‹у‚‰"
96
+
97
+ 25
98
+ 00:01:02,330 --> 00:01:03,782
99
+ "у у‹у‚‰чЇу‚’шЊ˜уЃуІ"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: srtshifter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -50,6 +50,7 @@ files:
50
50
  - test/lib/srtshifter/options_test.rb
51
51
  - test/lib/srtshifter/subtitle_test.rb
52
52
  - test/lib/srtshifter/version_test.rb
53
+ - test/samples/non-utf8.srt
53
54
  - test/samples/test_srt.srt
54
55
  - test/test_helper.rb
55
56
  homepage: http://thiagokimo.github.com/srt-shifter
@@ -81,5 +82,6 @@ test_files:
81
82
  - test/lib/srtshifter/options_test.rb
82
83
  - test/lib/srtshifter/subtitle_test.rb
83
84
  - test/lib/srtshifter/version_test.rb
85
+ - test/samples/non-utf8.srt
84
86
  - test/samples/test_srt.srt
85
87
  - test/test_helper.rb