addic7ed 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
  # The gem's dependencies will be specified in addic7ed.gemspec
3
3
  gemspec
4
+
5
+ gem 'coveralls', require: false
data/Gemfile.lock CHANGED
@@ -1,28 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- addic7ed (0.1.2)
4
+ addic7ed (0.1.5)
5
5
  nokogiri
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- diff-lcs (1.2.1)
11
- nokogiri (1.5.6)
12
- rake (10.0.3)
10
+ colorize (0.5.8)
11
+ coveralls (0.6.4)
12
+ colorize
13
+ multi_json (~> 1.3)
14
+ rest-client
15
+ simplecov (>= 0.7)
16
+ thor
17
+ diff-lcs (1.2.2)
18
+ mime-types (1.22)
19
+ multi_json (1.7.2)
20
+ nokogiri (1.5.9)
21
+ rake (10.0.4)
22
+ rest-client (1.6.7)
23
+ mime-types (>= 1.16)
13
24
  rspec (2.13.0)
14
25
  rspec-core (~> 2.13.0)
15
26
  rspec-expectations (~> 2.13.0)
16
27
  rspec-mocks (~> 2.13.0)
17
- rspec-core (2.13.0)
28
+ rspec-core (2.13.1)
18
29
  rspec-expectations (2.13.0)
19
30
  diff-lcs (>= 1.1.3, < 2.0)
20
- rspec-mocks (2.13.0)
31
+ rspec-mocks (2.13.1)
32
+ simplecov (0.7.1)
33
+ multi_json (~> 1.0)
34
+ simplecov-html (~> 0.7.1)
35
+ simplecov-html (0.7.1)
36
+ thor (0.18.1)
21
37
 
22
38
  PLATFORMS
23
39
  ruby
24
40
 
25
41
  DEPENDENCIES
26
42
  addic7ed!
43
+ coveralls
27
44
  rake
28
45
  rspec
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
- # addic7ed-ruby [![Build Status](https://travis-ci.org/michaelbaudino/addic7ed-ruby.png)](https://travis-ci.org/michaelbaudino/addic7ed-ruby) [![Dependency Status](https://gemnasium.com/michaelbaudino/addic7ed-ruby.png)](https://gemnasium.com/michaelbaudino/addic7ed-ruby) [![Code Climate](https://codeclimate.com/github/michaelbaudino/addic7ed-ruby.png)](https://codeclimate.com/github/michaelbaudino/addic7ed-ruby)
1
+ # addic7ed-ruby [![Build Status](https://travis-ci.org/michaelbaudino/addic7ed-ruby.png)](https://travis-ci.org/michaelbaudino/addic7ed-ruby) [![Dependency Status](https://gemnasium.com/michaelbaudino/addic7ed-ruby.png)](https://gemnasium.com/michaelbaudino/addic7ed-ruby) [![Code Climate](https://codeclimate.com/github/michaelbaudino/addic7ed-ruby.png)](https://codeclimate.com/github/michaelbaudino/addic7ed-ruby) [![Coverage Status](https://coveralls.io/repos/michaelbaudino/addic7ed-ruby/badge.png?branch=master)](https://coveralls.io/r/michaelbaudino/addic7ed-ruby)
2
+
2
3
 
3
4
  Ruby command-line script to fetch subtitles on Addic7ed
4
5
 
5
- Current version: **0.1.4**
6
+ Current version: **0.1.5**
6
7
 
7
8
  ### Is it working ?
8
9
 
@@ -67,6 +68,7 @@ There's some work remaining:
67
68
 
68
69
  ### Changelog
69
70
 
71
+ * 0.1.5: Enhanced subtitles version string filters
70
72
  * 0.1.4: Fixed a bug in require paths which made 0.1.3 unusable
71
73
  * 0.1.3: Fixed bugs with show names containing country code or production year
72
74
  * 0.1.2: Fixed how the daily download limit reach is detected
@@ -5,7 +5,7 @@ module Addic7ed
5
5
  attr_accessor :url
6
6
 
7
7
  def initialize(version, language, status, url, downloads)
8
- @version = version.gsub(/ *720p */i, '').upcase
8
+ @version = normalized_version(version)
9
9
  @language = language
10
10
  @status = status
11
11
  @url = url
@@ -16,5 +16,17 @@ module Addic7ed
16
16
  "#{url}\t->\t#{@version} (#{language}, #{status}) [#{@downloads} downloads]"
17
17
  end
18
18
 
19
+ private
20
+
21
+ def normalized_version(version)
22
+ version.
23
+ gsub(/720p/i, '').
24
+ gsub(/hdtv/i, '').
25
+ gsub(/x\.?264/i, '').
26
+ gsub(/^[ \.]*/, '').
27
+ gsub(/[ \.]*$/, '').
28
+ upcase
29
+ end
30
+
19
31
  end
20
32
  end
@@ -1,3 +1,3 @@
1
1
  module Addic7ed
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -5,14 +5,46 @@ describe Addic7ed::Subtitle do
5
5
  before :all do
6
6
  end
7
7
 
8
- it 'should upcase the version string' do
9
- Addic7ed::Subtitle.new('DiMENSiON', '', '', '', '0').version.should == 'DIMENSION'
10
- end
8
+ describe '#normalized_version' do
9
+ it 'should upcase the version string' do
10
+ Addic7ed::Subtitle.new('DiMENSiON', '', '', '', '0').version.should == 'DIMENSION'
11
+ end
12
+
13
+ it 'should remove heading and trailing dots' do
14
+ Addic7ed::Subtitle.new('.DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
15
+ Addic7ed::Subtitle.new('DIMENSION.', '', '', '', '0').version.should == 'DIMENSION'
16
+ Addic7ed::Subtitle.new('.DIMENSION.', '', '', '', '0').version.should == 'DIMENSION'
17
+ end
18
+
19
+ it 'should remove heading and trailing whitespaces' do
20
+ Addic7ed::Subtitle.new(' DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
21
+ Addic7ed::Subtitle.new('DIMENSION ', '', '', '', '0').version.should == 'DIMENSION'
22
+ Addic7ed::Subtitle.new(' DIMENSION ', '', '', '', '0').version.should == 'DIMENSION'
23
+ end
24
+
25
+ it 'should automatically remove "720p" in version string' do
26
+ Addic7ed::Subtitle.new('720p DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
27
+ Addic7ed::Subtitle.new('720P DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
28
+ Addic7ed::Subtitle.new('DIMENSION 720p', '', '', '', '0').version.should == 'DIMENSION'
29
+ Addic7ed::Subtitle.new('DIMENSION 720P', '', '', '', '0').version.should == 'DIMENSION'
30
+ end
31
+
32
+ it 'should automatically remove "HDTV" in version string' do
33
+ Addic7ed::Subtitle.new('hdtv DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
34
+ Addic7ed::Subtitle.new('HDTV DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
35
+ Addic7ed::Subtitle.new('DIMENSION hdtv', '', '', '', '0').version.should == 'DIMENSION'
36
+ Addic7ed::Subtitle.new('DIMENSION HDTV', '', '', '', '0').version.should == 'DIMENSION'
37
+ end
11
38
 
12
- it 'should automatically remove "720p" in version string' do
13
- Addic7ed::Subtitle.new('720p DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
14
- Addic7ed::Subtitle.new('720P DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
15
- Addic7ed::Subtitle.new('DIMENSION 720p', '', '', '', '0').version.should == 'DIMENSION'
16
- Addic7ed::Subtitle.new('DIMENSION 720P', '', '', '', '0').version.should == 'DIMENSION'
39
+ it 'should automatically remove "x264" in version string' do
40
+ Addic7ed::Subtitle.new('x264 DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
41
+ Addic7ed::Subtitle.new('X264 DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
42
+ Addic7ed::Subtitle.new('x.264 DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
43
+ Addic7ed::Subtitle.new('X.264 DIMENSION', '', '', '', '0').version.should == 'DIMENSION'
44
+ Addic7ed::Subtitle.new('DIMENSION x264', '', '', '', '0').version.should == 'DIMENSION'
45
+ Addic7ed::Subtitle.new('DIMENSION X264', '', '', '', '0').version.should == 'DIMENSION'
46
+ Addic7ed::Subtitle.new('DIMENSION x.264', '', '', '', '0').version.should == 'DIMENSION'
47
+ Addic7ed::Subtitle.new('DIMENSION X.264', '', '', '', '0').version.should == 'DIMENSION'
48
+ end
17
49
  end
18
- end
50
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  RSpec.configure do |config|
2
5
  # Use color in STDOUT
3
6
  config.color_enabled = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addic7ed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
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: 2013-03-09 00:00:00.000000000 Z
12
+ date: 2013-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec