findart 0.0.1
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/History.txt +3 -0
- data/Manifest.txt +33 -0
- data/README.rdoc +63 -0
- data/Rakefile +30 -0
- data/bin/findart +55 -0
- data/features/development.feature +13 -0
- data/features/findalbumarturls.feature +38 -0
- data/features/fixtures/search-albumartexchange-daft-punk-discovery.html +107 -0
- data/features/registerdscapers.feature +12 -0
- data/features/step_definitions/common_steps.rb +169 -0
- data/features/step_definitions/findalbumarturls_steps.rb +9 -0
- data/features/support/common.rb +29 -0
- data/features/support/env.rb +14 -0
- data/features/support/matchers.rb +11 -0
- data/lib/FindArt.rb +20 -0
- data/lib/FindArt/scraper.rb +76 -0
- data/lib/FindArt/scrapers/albumartexchange.rb +22 -0
- data/lib/FindArt/scrapers/amazon.rb.disabled +47 -0
- data/lib/FindArt/scrapers/discogs.rb +44 -0
- data/lib/FindArt/scrapers/junodownload.rb +31 -0
- data/lib/FindArt/scrapers/walmart.rb +38 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/albumartexchange_spec.rb +26 -0
- data/spec/amazon_spec.rb +34 -0
- data/spec/discogs_spec.rb +32 -0
- data/spec/junodownload_spec.rb +32 -0
- data/spec/scraper_spec.rb +121 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/walmart_spec.rb +26 -0
- data/tasks/rspec.rake +25 -0
- metadata +164 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
# require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
#
|
3
|
+
# describe Discogs do
|
4
|
+
#
|
5
|
+
# it "Should have a start url form where the scaper starts" do
|
6
|
+
# Discogs.class_variables.should include("@@url")
|
7
|
+
# Discogs.url.should == 'http://www.discogs.com/search?type=all&q='
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# it "Should find the album art url for DJ TIESTO - In Search Of Sunrise 6" do
|
11
|
+
# @discogs = Discogs.new()
|
12
|
+
# @discogs.scrape("TIESTO","In Search of Sunrise 6").should == "http://www.discogs.com/image/R-1055811-1190858484.jpeg"
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# it "Should return nil when no album art is found" do
|
16
|
+
# @discogs = Discogs.new()
|
17
|
+
# @discogs.scrape("Irene Moors & De Smurfen","Ga Je Mee Naar Smurfenland").should be(nil)
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# it "Should find the album art for the following albums" do
|
21
|
+
# # @discogs = De.new()
|
22
|
+
# # @juno.scrape("Social Disco Club & Maia","The Way You Move").should == "http://cdn.images.juno.co.uk/full/CS1432822-02A-BIG.jpg"
|
23
|
+
# # @juno.scrape("2SONIC","Bump Da Funk").should == "http://cdn.images.juno.co.uk/full/CS1427835-02A-BIG.jpg"
|
24
|
+
# # @juno.scrape("AIRPORT","Song 2 1").should == "http://cdn.images.juno.co.uk/full/CS1408816-02A-BIG.jpg"
|
25
|
+
# # @juno.scrape("1 LOVE","Beat It").should == "http://cdn.images.juno.co.uk/full/CS1442946-02A-BIG.jpg"
|
26
|
+
# # @juno.scrape("","trance world 7").should == "http://cdn.images.juno.co.uk/full/CS1436448-02A-BIG.jpg"
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
#
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe JunoDownload do
|
4
|
+
|
5
|
+
it "Should have a start url form where the scaper starts" do
|
6
|
+
JunoDownload.class_variables.should include("@@url")
|
7
|
+
JunoDownload.url.should == 'http://www.junodownload.com/search/'
|
8
|
+
end
|
9
|
+
|
10
|
+
it "Should find the album art url for DJ TIESTO - In Search Of Sunrise 6" do
|
11
|
+
@juno = JunoDownload.new()
|
12
|
+
@juno.scrape("TIESTO","In Search of Sunrise 6").should == "http://cdn.images.juno.co.uk/full/CS1270430-02A-BIG.jpg"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "Should return nil when no album art is found" do
|
16
|
+
# @juno = JunoDownload.new()
|
17
|
+
# @juno.scrape("Irene Moors & De Smurfen","Ga Je Mee Naar Smurfenland").should be(nil)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "Should find the album art for the following albums" do
|
21
|
+
@juno = JunoDownload.new()
|
22
|
+
@juno.scrape("Social Disco Club & Maia","The Way You Move").should == "http://cdn.images.juno.co.uk/full/CS1432822-02A-BIG.jpg"
|
23
|
+
@juno.scrape("2SONIC","Bump Da Funk").should == "http://cdn.images.juno.co.uk/full/CS1427835-02A-BIG.jpg"
|
24
|
+
@juno.scrape("AIRPORT","Song 2 1").should == "http://cdn.images.juno.co.uk/full/CS1408816-02A-BIG.jpg"
|
25
|
+
@juno.scrape("1 LOVE","Beat It").should == "http://cdn.images.juno.co.uk/full/CS1442946-02A-BIG.jpg"
|
26
|
+
@juno.scrape("","trance world 7").should == "http://cdn.images.juno.co.uk/full/CS1436448-02A-BIG.jpg"
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
# Time to add your specs!
|
4
|
+
# http://rspec.info/
|
5
|
+
describe Scraper do
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
#unregister scapers
|
9
|
+
Scraper.unregister_scrapers!
|
10
|
+
end
|
11
|
+
|
12
|
+
it "Should let site specific scaper classes self register" do
|
13
|
+
@scraper = Scraper.new
|
14
|
+
@scraper.scrapers.class == Hash
|
15
|
+
|
16
|
+
class TestScraper < Scraper
|
17
|
+
register_scraper :test_scraper
|
18
|
+
end
|
19
|
+
@scraper.scrapers.size.should_not be(0)
|
20
|
+
|
21
|
+
@scraper.scrapers[:test_scraper].should_not be(nil)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
it "Should remove all registerd scrapers when unregister_scrapers! is called" do
|
26
|
+
@scraper = Scraper.new
|
27
|
+
|
28
|
+
class TestScraper < Scraper
|
29
|
+
register_scraper :test_scraper
|
30
|
+
end
|
31
|
+
|
32
|
+
@scraper.scrapers.size.should be(1)
|
33
|
+
Scraper.unregister_scrapers!
|
34
|
+
@scraper.scrapers.size.should be(0)
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
it "Should use all registerd scrapers to find album art" do
|
40
|
+
|
41
|
+
@scraper = Scraper.new
|
42
|
+
|
43
|
+
# mock test scraper
|
44
|
+
class TestScraper < Scraper
|
45
|
+
def scrape(artist,title,opts=nil)
|
46
|
+
"http://cdn.images.juno.co.uk/full/CS1425717-02A-BIG.jpg"
|
47
|
+
end
|
48
|
+
register_scraper :test_scraper
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
# mock test scraper2
|
53
|
+
class TestScraper2 < Scraper
|
54
|
+
def scrape(artist,title,opts=nil)
|
55
|
+
"http://cdn.images.juno.co.uk/full/33333333-02A-BIG.jpg"
|
56
|
+
end
|
57
|
+
register_scraper :test_scraper2
|
58
|
+
end
|
59
|
+
|
60
|
+
@scraper.scrapers.size.should be(2)
|
61
|
+
|
62
|
+
artist = "FREELAND"
|
63
|
+
title = "Do You"
|
64
|
+
result = @scraper.find_art(artist,title)
|
65
|
+
result.should be_an_instance_of(Array)
|
66
|
+
result.should include("http://cdn.images.juno.co.uk/full/CS1425717-02A-BIG.jpg")
|
67
|
+
result.should include("http://cdn.images.juno.co.uk/full/33333333-02A-BIG.jpg")
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
it "Should return an empty array when no album art is found" do
|
73
|
+
@scraper = Scraper.new
|
74
|
+
Scraper.unregister_scrapers!
|
75
|
+
@scraper.scrapers.size.should be(0)
|
76
|
+
|
77
|
+
class TestScraper < Scraper
|
78
|
+
def scrape(artist,title,opts=nil)
|
79
|
+
nil
|
80
|
+
end
|
81
|
+
register_scraper :test_scraper
|
82
|
+
end
|
83
|
+
|
84
|
+
result = @scraper.find_art("no_way_that_there_is_an_artist_with_this_name","this_is_a_non_existing_album_tile")
|
85
|
+
result.should be_an_instance_of(Array)
|
86
|
+
result.size.should be(0)
|
87
|
+
end
|
88
|
+
|
89
|
+
it "Should set the url where the scaper starts" do
|
90
|
+
|
91
|
+
class TestScraper < Scraper
|
92
|
+
start_url "http://www.junodownload.com/search/"
|
93
|
+
register_scraper :test_scraper
|
94
|
+
end
|
95
|
+
|
96
|
+
class TestScraper2 < Scraper
|
97
|
+
start_url "http://www.junodownload2.com/search/"
|
98
|
+
register_scraper :test_scraper2
|
99
|
+
end
|
100
|
+
|
101
|
+
TestScraper.url.should == "http://www.junodownload.com/search/"
|
102
|
+
TestScraper2.url.should == "http://www.junodownload2.com/search/"
|
103
|
+
TestScraper.url.should == "http://www.junodownload.com/search/"
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
it "Should return an array of the hostnames of the websites that are being used in registerd scrapers" do
|
110
|
+
class TestScraper < Scraper
|
111
|
+
start_url "http://www.google.com"
|
112
|
+
register_scraper :test_scraper
|
113
|
+
end
|
114
|
+
|
115
|
+
Scraper.registerd_sites.should include("www.google.com")
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe WalMart do
|
4
|
+
|
5
|
+
it "Should have a start url form where the scaper starts" do
|
6
|
+
WalMart.class_variables.should include("@@url")
|
7
|
+
WalMart.url.should == 'http://www.walmart.com/search/search-ng.do?earch_sort=2&search_query='
|
8
|
+
end
|
9
|
+
|
10
|
+
it "Should find the album art url for DJ TIESTO - In Search Of Sunrise 6" do
|
11
|
+
@wallmart = WalMart.new()
|
12
|
+
@wallmart.scrape("DJ TIESTO","In Search of Sunrise 6").should == "http://i.walmartimages.com/i/p/00/06/70/03/07/0006700307592_500X500.jpg"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "Should take the first result when multible results are found" do
|
16
|
+
@wallmart = WalMart.new()
|
17
|
+
@wallmart.scrape("Daft Punk","").should == "http://i.walmartimages.com/i/p/00/72/43/59/63/0072435963890_500X500.jpg"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "Should return nil when no album art is found" do
|
21
|
+
@wallmart = WalMart.new()
|
22
|
+
@wallmart.scrape("Irene Moors & De Smurfen","Ga Je Mee Naar Smurfenland").should be(nil)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
end
|
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run the specs under spec/models"
|
18
|
+
Spec::Rake::SpecTask.new do |t|
|
19
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
20
|
+
t.rcov = false
|
21
|
+
t.spec_files = FileList['spec/*_spec.rb'].sort
|
22
|
+
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
23
|
+
t.rcov_opts << '--only-uncovered'
|
24
|
+
t.rcov_opts << '--output coverage/integration'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: findart
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michel de Graaf
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-12 00:00:00 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: mechanize
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.3
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hpricot
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.1
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: fakeweb
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.2.5
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: cucumber
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.3.97
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: newgem
|
57
|
+
type: :runtime
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 1.5.2
|
64
|
+
version:
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: visionmedia-commander
|
67
|
+
type: :runtime
|
68
|
+
version_requirement:
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 3.2.9
|
74
|
+
version:
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: hoe
|
77
|
+
type: :development
|
78
|
+
version_requirement:
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 2.3.3
|
84
|
+
version:
|
85
|
+
description: |-
|
86
|
+
Findart is a handy console application that helps you find high quality album art.
|
87
|
+
It scrapes various sites and returns a list of urls that contain album art images.
|
88
|
+
|
89
|
+
Findart is very basic in its current form but still usable.
|
90
|
+
Stay tuned for new features in the near future.
|
91
|
+
email:
|
92
|
+
- michel@re-invention.nl
|
93
|
+
executables:
|
94
|
+
- findart
|
95
|
+
extensions: []
|
96
|
+
|
97
|
+
extra_rdoc_files:
|
98
|
+
- History.txt
|
99
|
+
- Manifest.txt
|
100
|
+
files:
|
101
|
+
- History.txt
|
102
|
+
- Manifest.txt
|
103
|
+
- README.rdoc
|
104
|
+
- Rakefile
|
105
|
+
- bin/findart
|
106
|
+
- features/development.feature
|
107
|
+
- features/findalbumarturls.feature
|
108
|
+
- features/fixtures/search-albumartexchange-daft-punk-discovery.html
|
109
|
+
- features/registerdscapers.feature
|
110
|
+
- features/step_definitions/common_steps.rb
|
111
|
+
- features/step_definitions/findalbumarturls_steps.rb
|
112
|
+
- features/support/common.rb
|
113
|
+
- features/support/env.rb
|
114
|
+
- features/support/matchers.rb
|
115
|
+
- lib/FindArt.rb
|
116
|
+
- lib/FindArt/scraper.rb
|
117
|
+
- lib/FindArt/scrapers/albumartexchange.rb
|
118
|
+
- lib/FindArt/scrapers/amazon.rb.disabled
|
119
|
+
- lib/FindArt/scrapers/discogs.rb
|
120
|
+
- lib/FindArt/scrapers/junodownload.rb
|
121
|
+
- lib/FindArt/scrapers/walmart.rb
|
122
|
+
- script/console
|
123
|
+
- script/destroy
|
124
|
+
- script/generate
|
125
|
+
- spec/albumartexchange_spec.rb
|
126
|
+
- spec/amazon_spec.rb
|
127
|
+
- spec/discogs_spec.rb
|
128
|
+
- spec/junodownload_spec.rb
|
129
|
+
- spec/scraper_spec.rb
|
130
|
+
- spec/spec.opts
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
- spec/walmart_spec.rb
|
133
|
+
- tasks/rspec.rake
|
134
|
+
has_rdoc: true
|
135
|
+
homepage: http://github.com/michel/findart
|
136
|
+
licenses: []
|
137
|
+
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options:
|
140
|
+
- --main
|
141
|
+
- README.rdoc
|
142
|
+
require_paths:
|
143
|
+
- lib
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: "0"
|
149
|
+
version:
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: "0"
|
155
|
+
version:
|
156
|
+
requirements: []
|
157
|
+
|
158
|
+
rubyforge_project: findart
|
159
|
+
rubygems_version: 1.3.5
|
160
|
+
signing_key:
|
161
|
+
specification_version: 3
|
162
|
+
summary: Findart is a handy console application that helps you find high quality album art
|
163
|
+
test_files: []
|
164
|
+
|