metal-archives 0.1.7 → 0.1.8
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/VERSION +1 -1
- data/lib/metal-archives.rb +10 -5
- data/metal-archives.gemspec +2 -2
- data/spec/metal-archives_spec.rb +15 -3
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/lib/metal-archives.rb
CHANGED
@@ -70,18 +70,23 @@ module MetalArchives
|
|
70
70
|
if page
|
71
71
|
page.encoding = 'iso-8859-1' if !page.nil? && page.encoding != 'iso-8859-1' # needed for foreign characters
|
72
72
|
band_and_album = page.search('body table tr:first-child .tt').text
|
73
|
-
|
74
|
-
# these fields can be in one of the following forms, so we need to find the specific fields appropriately:
|
75
|
-
# "\n\t\t", "Demo", ", Nazgûl Distro & Prod.", "", "2011", "\t\t\t"
|
76
|
-
# "\n\t\t", "Demo", ", Deific Mourning", "", "\n\n\t\tJanuary ", "2011", "\t\t\t"
|
77
|
-
# "Full-length", ", ARX Productions", "", "\n\n\t\tFebruary 25th, ", "2011", "\t\t\t"
|
78
73
|
album_fields = page.search('body table:nth-child(2n) tr:first-child > td:first-child').first.children
|
79
74
|
end
|
75
|
+
rescue NoMethodError => e
|
76
|
+
# this is an unusual error that occurs when a page only has the content "page not found"
|
77
|
+
# this should return an empty hash so the calling method doens't stop searching on this page
|
78
|
+
# or else it will never get past it
|
79
|
+
puts "\nError accessing metal-archives.com's album information: page not found"
|
80
|
+
return {}
|
80
81
|
rescue Exception => e
|
81
82
|
puts "\nError accessing metal-archives.com's album information: #{e}"
|
82
83
|
return nil
|
83
84
|
end
|
84
85
|
|
86
|
+
# these fields can be in one of the following forms, so we need to find the specific fields appropriately:
|
87
|
+
# "\n\t\t", "Demo", ", Nazgûl Distro & Prod.", "", "2011", "\t\t\t"
|
88
|
+
# "\n\t\t", "Demo", ", Deific Mourning", "", "\n\n\t\tJanuary ", "2011", "\t\t\t"
|
89
|
+
# "Full-length", ", ARX Productions", "", "\n\n\t\tFebruary 25th, ", "2011", "\t\t\t"
|
85
90
|
{
|
86
91
|
:album => album_from_content(band_and_album),
|
87
92
|
:band => band_from_content(band_and_album),
|
data/metal-archives.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{metal-archives}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Danny Olson"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-30}
|
13
13
|
s.description = %q{metal-archives provides an interface to search for album releases for a specific year, defaulting to the current one if none is provided.}
|
14
14
|
s.email = %q{dbolson@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/metal-archives_spec.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
3
3
|
|
4
4
|
describe "MetalArchives" do
|
5
|
-
|
6
|
-
|
5
|
+
describe "with an agent" do
|
6
|
+
describe "that searches by year" do
|
7
7
|
before do
|
8
8
|
search_results_html = File.open(File.dirname(__FILE__) + '/html/search_results.html')
|
9
9
|
@search_results = Nokogiri::HTML(search_results_html)
|
@@ -58,7 +58,19 @@ describe "MetalArchives" do
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
|
61
|
+
describe "with an album page" do
|
62
|
+
context "when a page has no content" do
|
63
|
+
it "should find the band information" do
|
64
|
+
@mechanize = stub('Mechanize')
|
65
|
+
Mechanize.stub!(:new).and_return(@mechanize)
|
66
|
+
@mechanize.stub!(:get).and_return('page not found')
|
67
|
+
agent = MetalArchives::Agent.new(2011)
|
68
|
+
album_url = "release.php?id=000001"
|
69
|
+
|
70
|
+
agent.album_from_url(album_url).should == {}
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
62
74
|
context "with only a release year" do
|
63
75
|
it "should find the band information" do
|
64
76
|
search_results_html = File.open(File.dirname(__FILE__) + '/html/album_result.html')
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 8
|
9
|
+
version: 0.1.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Danny Olson
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-03-
|
17
|
+
date: 2011-03-30 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
143
|
requirements:
|
144
144
|
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
hash: -
|
146
|
+
hash: -2267341529679193989
|
147
147
|
segments:
|
148
148
|
- 0
|
149
149
|
version: "0"
|