addic7ed 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -3
- data/bin/addic7ed +2 -2
- data/lib/addic7ed.rb +6 -6
- data/lib/addic7ed/episode.rb +1 -1
- data/lib/addic7ed/filename.rb +11 -0
- data/lib/addic7ed/subtitle.rb +1 -1
- data/lib/addic7ed/version.rb +1 -1
- data/spec/addic7ed-filename_spec.rb +32 -0
- data/spec/addic7ed-subtitle_spec.rb +18 -0
- metadata +4 -8
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
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)
|
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)
|
2
2
|
|
3
3
|
Ruby command-line script to fetch subtitles on Addic7ed
|
4
4
|
|
5
|
-
Current version: **0.1.
|
5
|
+
Current version: **0.1.3**
|
6
6
|
|
7
7
|
### Is it working ?
|
8
8
|
|
@@ -45,7 +45,8 @@ Usage: addic7ed [options] <file1> [<file2>, <file3>, ...]
|
|
45
45
|
|
46
46
|
Feel free to submit a Pull Request, I'd be glad to review/merge it.
|
47
47
|
|
48
|
-
Also, if you like the awesome work done by the Addic7ed team, please consider
|
48
|
+
Also, if you like the awesome work done by the Addic7ed team, please consider donating to them (no link here as they are just in the middle of changing their donation system, but feel free to go their website) !
|
49
|
+
|
49
50
|
|
50
51
|
### Notes
|
51
52
|
|
@@ -66,6 +67,7 @@ There's some work remaining:
|
|
66
67
|
|
67
68
|
### Changelog
|
68
69
|
|
70
|
+
* 0.1.3: Fixed bugs with show names containing country code or production year
|
69
71
|
* 0.1.2: Fixed how the daily download limit reach is detected
|
70
72
|
* 0.1.1: This is now a _working_ gem
|
71
73
|
* 0.1.0: This is now a gem
|
data/bin/addic7ed
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
def require_dependencies
|
4
4
|
require 'optparse'
|
5
5
|
require 'nokogiri'
|
6
|
-
require 'addic7ed'
|
6
|
+
require './lib/addic7ed'
|
7
7
|
end
|
8
8
|
|
9
9
|
begin
|
@@ -123,7 +123,7 @@ options[:filenames].each do |filename|
|
|
123
123
|
puts "The subtitle could not be downloaded. Skipping.".gsub(/^/, options[:verbose] ? ' ' : '') unless options[:quiet]
|
124
124
|
next
|
125
125
|
rescue Addic7ed::DownloadLimitReached
|
126
|
-
puts "
|
126
|
+
puts "You exceeded your daily download count. Exiting.".gsub(/^/, options[:verbose] ? ' ' : '') unless options[:quiet]
|
127
127
|
break
|
128
128
|
rescue Addic7ed::SubtitleCannotBeSaved
|
129
129
|
puts "The downloaded subtitle could not be saved as #{filename.gsub(/\.\w{3}$/, '.srt')}. Skipping.".gsub(/^/, options[:verbose] ? ' ' : '') unless options[:quiet]
|
data/lib/addic7ed.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'addic7ed/version'
|
2
|
-
require 'addic7ed/common'
|
3
|
-
require 'addic7ed/errors'
|
4
|
-
require 'addic7ed/filename'
|
5
|
-
require 'addic7ed/episode'
|
6
|
-
require 'addic7ed/subtitle'
|
1
|
+
require './lib/addic7ed/version'
|
2
|
+
require './lib/addic7ed/common'
|
3
|
+
require './lib/addic7ed/errors'
|
4
|
+
require './lib/addic7ed/filename'
|
5
|
+
require './lib/addic7ed/episode'
|
6
|
+
require './lib/addic7ed/subtitle'
|
data/lib/addic7ed/episode.rb
CHANGED
@@ -14,7 +14,7 @@ module Addic7ed
|
|
14
14
|
def url(lang = 'fr')
|
15
15
|
raise LanguageNotSupported unless LANGUAGES[lang]
|
16
16
|
@localized_urls ||= {}
|
17
|
-
@localized_urls[lang] ||= "http://www.addic7ed.com/serie/#{@filename.
|
17
|
+
@localized_urls[lang] ||= "http://www.addic7ed.com/serie/#{@filename.encoded_showname}/#{@filename.season}/#{@filename.episode}/#{LANGUAGES[lang][:id]}"
|
18
18
|
end
|
19
19
|
|
20
20
|
def subtitles(lang = 'fr')
|
data/lib/addic7ed/filename.rb
CHANGED
@@ -19,6 +19,17 @@ module Addic7ed
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def encoded_showname
|
23
|
+
@showname.
|
24
|
+
gsub(/ /, '_').
|
25
|
+
gsub(/_US$/, '_(US)').
|
26
|
+
gsub(/_US_/, '_(US)_').
|
27
|
+
gsub(/_UK$/, '').
|
28
|
+
gsub(/_UK_/, '_').
|
29
|
+
gsub(/_\d{4}$/, '').
|
30
|
+
gsub(/_\d{4}_/, '_')
|
31
|
+
end
|
32
|
+
|
22
33
|
# Lazy getters
|
23
34
|
|
24
35
|
def basename
|
data/lib/addic7ed/subtitle.rb
CHANGED
data/lib/addic7ed/version.rb
CHANGED
@@ -29,6 +29,13 @@ describe Addic7ed::Filename do
|
|
29
29
|
@filename_no_episode = 'Californication.S06.720p.HDTV.x264-2HD.mkv'
|
30
30
|
@filename_no_tags = 'Californication.S06E07.2HD.mkv'
|
31
31
|
@filename_no_group = 'Californication.S06E07.720p.HDTV.x264.mkv'
|
32
|
+
# Filename with special tags
|
33
|
+
@filename_showname_US = 'Shameless.US.S03E06.720p.HDTV.x264-IMMERSE.mkv'
|
34
|
+
@filename_showname_UK = 'Shameless.UK.S09E11.720p.HDTV.x264-TLA.mkv'
|
35
|
+
@filename_showname_UK_year = 'The.Hour.UK.2011.S01E03.REPACK.HDTV.XviD-FoV.avi'
|
36
|
+
@filename_showname_year_UK = 'The.Hour.2011.UK.S01E03.REPACK.HDTV.XviD-FoV.avi'
|
37
|
+
@filename_showname_US_year = 'The.Hour.US.2011.S01E03.REPACK.HDTV.XviD-FoV.avi'
|
38
|
+
@filename_showname_year_US = 'The.Hour.2011.US.S01E03.REPACK.HDTV.XviD-FoV.avi'
|
32
39
|
end
|
33
40
|
|
34
41
|
it 'should succeed given valid argument' do
|
@@ -259,6 +266,31 @@ describe Addic7ed::Filename do
|
|
259
266
|
}.to raise_error(Addic7ed::InvalidFilename)
|
260
267
|
end
|
261
268
|
|
269
|
+
describe '#encoded_filename' do
|
270
|
+
it 'should change all spaces to underscores' do
|
271
|
+
Addic7ed::Filename.new(@filename_multiple_words).encoded_showname.should == 'The_Walking_Dead'
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'should wrap country code with parenthesis' do
|
275
|
+
Addic7ed::Filename.new(@filename_showname_US).encoded_showname.should == 'Shameless_(US)'
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'should remove country code for the original show (usually UK)' do
|
279
|
+
Addic7ed::Filename.new(@filename_showname_UK).encoded_showname.should == 'Shameless'
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'should remove production year' do
|
283
|
+
Addic7ed::Filename.new(@filename_showname_year).encoded_showname.should == 'The_Americans'
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'should handle when both country code and production year are present' do
|
287
|
+
Addic7ed::Filename.new(@filename_showname_UK_year).encoded_showname.should == 'The_Hour'
|
288
|
+
Addic7ed::Filename.new(@filename_showname_year_UK).encoded_showname.should == 'The_Hour'
|
289
|
+
Addic7ed::Filename.new(@filename_showname_US_year).encoded_showname.should == 'The_Hour_(US)'
|
290
|
+
Addic7ed::Filename.new(@filename_showname_year_US).encoded_showname.should == 'The_Hour_(US)'
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
262
294
|
describe '#basename' do
|
263
295
|
it 'should return only file name given a full path' do
|
264
296
|
Addic7ed::Filename.new(@filename_full_path).basename.should == 'Californication.S06E07.720p.HDTV.x264-2HD.mkv'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/addic7ed'
|
3
|
+
|
4
|
+
describe Addic7ed::Subtitle do
|
5
|
+
before :all do
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should upcase the version string' do
|
9
|
+
Addic7ed::Subtitle.new('DiMENSiON', '', '', '', '0').version.should == 'DIMENSION'
|
10
|
+
end
|
11
|
+
|
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'
|
17
|
+
end
|
18
|
+
end
|
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
|
+
version: 0.1.3
|
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-
|
12
|
+
date: 2013-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- Gemfile.lock
|
79
79
|
- README.md
|
80
80
|
- Rakefile
|
81
|
+
- spec/addic7ed-subtitle_spec.rb
|
81
82
|
- spec/addic7ed-episode_spec.rb
|
82
83
|
- spec/addic7ed-filename_spec.rb
|
83
84
|
- spec/spec_helper.rb
|
@@ -95,18 +96,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
96
|
- - ! '>='
|
96
97
|
- !ruby/object:Gem::Version
|
97
98
|
version: '0'
|
98
|
-
segments:
|
99
|
-
- 0
|
100
|
-
hash: -1188396796560563585
|
101
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
100
|
none: false
|
103
101
|
requirements:
|
104
102
|
- - ! '>='
|
105
103
|
- !ruby/object:Gem::Version
|
106
104
|
version: '0'
|
107
|
-
segments:
|
108
|
-
- 0
|
109
|
-
hash: -1188396796560563585
|
110
105
|
requirements: []
|
111
106
|
rubyforge_project:
|
112
107
|
rubygems_version: 1.8.25
|
@@ -114,6 +109,7 @@ signing_key:
|
|
114
109
|
specification_version: 3
|
115
110
|
summary: Addic7ed auto-downloader
|
116
111
|
test_files:
|
112
|
+
- spec/addic7ed-subtitle_spec.rb
|
117
113
|
- spec/addic7ed-episode_spec.rb
|
118
114
|
- spec/addic7ed-filename_spec.rb
|
119
115
|
- spec/addic7ed-common_spec.rb
|