metal-archives 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -45,9 +45,11 @@ module MetalArchives
45
45
  urls = []
46
46
  begin
47
47
  page = @agent.get(SITE_URL + url)
48
- page.encoding = 'iso-8859-1' if !page.nil? && page.encoding != 'iso-8859-1' # needed for foreign characters
49
- page.search('body table:nth-child(2n) tr td:nth-child(3n) a').each do |link|
50
- urls << link['href']
48
+ if page
49
+ page.encoding = 'iso-8859-1' if !page.nil? && page.encoding != 'iso-8859-1' # needed for foreign characters
50
+ page.search('body table:nth-child(2n) tr td:nth-child(3n) a').each do |link|
51
+ urls << link['href']
52
+ end
51
53
  end
52
54
  rescue Exception => e
53
55
  puts "\nError accessing metal-archives.com's album urls: #{e}"
@@ -65,14 +67,16 @@ module MetalArchives
65
67
  def album_from_url(url)
66
68
  begin
67
69
  page = @agent.get(SITE_URL + '/' + url)
68
- page.encoding = 'iso-8859-1' if !page.nil? && page.encoding != 'iso-8859-1' # needed for foreign characters
69
- band_and_album = page.search('body table tr:first-child .tt').text
70
+ if page
71
+ page.encoding = 'iso-8859-1' if !page.nil? && page.encoding != 'iso-8859-1' # needed for foreign characters
72
+ band_and_album = page.search('body table tr:first-child .tt').text
70
73
 
71
74
  # these fields can be in one of the following forms, so we need to find the specific fields appropriately:
72
75
  # "\n\t\t", "Demo", ", Nazgûl Distro & Prod.", "", "2011", "\t\t\t"
73
76
  # "\n\t\t", "Demo", ", Deific Mourning", "", "\n\n\t\tJanuary ", "2011", "\t\t\t"
74
77
  # "Full-length", ", ARX Productions", "", "\n\n\t\tFebruary 25th, ", "2011", "\t\t\t"
75
- album_fields = page.search('body table:nth-child(2n) tr:first-child > td:first-child').first.children
78
+ album_fields = page.search('body table:nth-child(2n) tr:first-child > td:first-child').first.children
79
+ end
76
80
  rescue Exception => e
77
81
  puts "\nError accessing metal-archives.com's album information: #{e}"
78
82
  return nil
@@ -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.5"
8
+ s.version = "0.1.6"
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-02-26}
12
+ s.date = %q{2011-03-06}
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 = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
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-02-26 00:00:00 -08:00
17
+ date: 2011-03-06 00:00:00 -08: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: 708635247568569300
146
+ hash: 4382458967996369210
147
147
  segments:
148
148
  - 0
149
149
  version: "0"