addic7ed 2.0.2 → 2.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32e131ca12d3e3478d6b1c74165907737e3ee5c9
4
- data.tar.gz: 433d4e43d15508a69a1ecd373dc59f2940763278
3
+ metadata.gz: 8fe69b951c7e9ae27f2be95b6a6b494f763bcec8
4
+ data.tar.gz: 5af885c6b39f8f4e8fd06b6db72ce723f04fc623
5
5
  SHA512:
6
- metadata.gz: d48aff4625c23cac1618b4b053bf8f9a0e5a68cb1c9d5f1105d35c2e3e916aa044e69276074c1abda129ea292b797d9f67522bc162697fff57ebb8f31574a11b
7
- data.tar.gz: 26e1a7d7e651016edfc33050bfcca18945e724ab6b256edb1867d4696a4aea217da25e90eab9f1d021b4c0c4d1bffa55795b869e9da647d583014d608a03e358
6
+ metadata.gz: 315a8a6c14e6a59cd992f8f5950a651d0643d363041ff43b722cbe4cd4b4a7db371b141f8895954dc40415f8a5554f54704ac35e2fb18914bad5b698bb32f47c
7
+ data.tar.gz: 9770c847b57e6fdda9d7fcc7e164ab80ff172e6bec8afc6eafd2b31237183ba7f1fcf012d7e173c9f0eb14d9f4ead3db40e3af44d2140a7b9392a363186dc377
@@ -113,10 +113,10 @@ options[:filenames].each do |filename|
113
113
  puts "#{filename} does not seem to be a valid TV show filename. Skipping.".gsub(/^/, options[:verbose] ? ' ' : '') unless options[:quiet]
114
114
  next
115
115
  rescue Addic7ed::ShowNotFound
116
- puts "Show not found on Addic7ed : #{ep.video_file.showname}. Skipping.".gsub(/^/, options[:verbose] ? ' ' : '') unless options[:quiet]
116
+ puts "Show not found on Addic7ed : #{ep.video_file.filename}. Skipping.".gsub(/^/, options[:verbose] ? ' ' : '') unless options[:quiet]
117
117
  next
118
118
  rescue Addic7ed::EpisodeNotFound
119
- puts "Episode not found on Addic7ed : #{Addic7ed::ShowList.url_segment_for(ep.video_file.showname)} S#{ep.video_file.season}E#{ep.video_file.episode}. Skipping.".gsub(/^/, options[:verbose] ? ' ' : '') unless options[:quiet]
119
+ puts "Episode not found on Addic7ed : #{ep.video_file.filename}. Skipping.".gsub(/^/, options[:verbose] ? ' ' : '') unless options[:quiet]
120
120
  next
121
121
  rescue Addic7ed::LanguageNotSupported
122
122
  puts "Addic7ed does not support language '#{options[:language]}'. Exiting.".gsub(/^/, options[:verbose] ? ' ' : '') unless options[:quiet]
@@ -20,7 +20,12 @@ module Addic7ed
20
20
  protected
21
21
 
22
22
  def subtitles_page_dom
23
- response = Net::HTTP.get_response(URI(@episode.url(@lang)))
23
+ uri = URI(@episode.url(@lang))
24
+ response = Net::HTTP.start(uri.hostname, uri.port) do |http|
25
+ request = Net::HTTP::Get.new(uri.request_uri)
26
+ request["User-Agent"] = USER_AGENTS.sample
27
+ http.request(request)
28
+ end
24
29
  raise EpisodeNotFound unless response.body
25
30
  Nokogiri::HTML(response.body)
26
31
  end
@@ -28,7 +28,7 @@ module Addic7ed
28
28
  end
29
29
 
30
30
  def default_comparer(showname)
31
- showname.downcase.gsub("'", "")
31
+ showname.downcase.gsub("'", "").gsub(".", " ").strip
32
32
  end
33
33
 
34
34
  def comparer_without_year(showname)
@@ -44,7 +44,7 @@ module Addic7ed
44
44
 
45
45
  def normalize_version(version)
46
46
  (version || "").
47
- gsub(/(^Version *|720p|1080p|hdtv|proper|rerip|x\.?264)/i, '').
47
+ gsub(/(^Version *|720p|1080p|hdtv|proper|rerip|internal|x\.?264)/i, '').
48
48
  gsub(/^[- \.]*/, '').gsub(/[- \.]*$/, '').
49
49
  upcase
50
50
  end
@@ -1,3 +1,3 @@
1
1
  module Addic7ed
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
@@ -32,6 +32,10 @@ describe Addic7ed::ShowList, ".url_segment_for" do
32
32
  expect(Addic7ed::ShowList.url_segment_for("Greys.Anatomy")).to eq "Grey's_Anatomy"
33
33
  end
34
34
 
35
+ it "handles when a show name contains dots" do
36
+ expect(Addic7ed::ShowList.url_segment_for("The.O.C.")).to eq "The_O.C."
37
+ end
38
+
35
39
  it "raises a ShowNotFound error when no matching show is found" do
36
40
  expect{Addic7ed::ShowList.url_segment_for("Not.an.existing.show")}.to raise_error Addic7ed::ShowNotFound
37
41
  end
@@ -47,6 +47,10 @@ describe Addic7ed::Subtitle, "#normalize_version!" do
47
47
  expect(normalized_version("RERIP DIMENSION")).to eq 'DIMENSION'
48
48
  end
49
49
 
50
+ it "removes 'INTERNAL' tag" do
51
+ expect(normalized_version("INTERNAL DIMENSION")).to eq 'DIMENSION'
52
+ end
53
+
50
54
  it "removes the 'Version' prefix" do
51
55
  expect(normalized_version("Version DIMENSION")).to eq 'DIMENSION'
52
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addic7ed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Baudino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-09 00:00:00.000000000 Z
11
+ date: 2016-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec