lyrics_finder 0.1.0 → 0.2.0
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 +4 -4
- data/lib/lyrics_finder.rb +7 -11
- data/lib/lyrics_finder/providers.rb +20 -33
- data/lib/lyrics_finder/version.rb +1 -1
- data/lyrics_finder.gemspec +1 -1
- data/spec/lyrics_finder/lyrics_finder_spec.rb +62 -3
- data/spec/lyrics_finder/providers/azlyrics_spec.rb +2 -15
- data/spec/lyrics_finder/providers/lyrics_mania_spec.rb +2 -15
- data/spec/lyrics_finder/providers/lyrics_wikia_spec.rb +2 -15
- data/spec/lyrics_finder/providers/song_lyrics_spec.rb +2 -15
- data/spec/spec_helper.rb +1 -1
- data/spec/support/sample_songs.rb +185 -0
- metadata +6 -8
- data/spec/lyrics_finder/providers_spec.rb +0 -23
- data/spec/support/lyrics_wikia_sample_songs.rb +0 -46
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6d52b8b51b05a06518d6c99e7dcd8dafcdcae02
|
|
4
|
+
data.tar.gz: bbb99da5b68ea10299ffe998918fa8a29e57ab5f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a40784e26f911e006940c8ef9b41a77fb6afcc58e2c3863983f42e239d89b279c992ed437c0f6c73c0acddc2e1f1a4087e50c49f18879f299b971179d7c9fa0
|
|
7
|
+
data.tar.gz: 4f1e1d6dc038dbe68a9a5d11d51daecc0610588e6b56daa399dcb6b2d522afdd3f33704eae99a38cd30612f45d02b5e727e4811b7c7d6c1c6682ed80622a61cf
|
data/lib/lyrics_finder.rb
CHANGED
|
@@ -5,17 +5,13 @@ module LyricsFinder
|
|
|
5
5
|
|
|
6
6
|
Contract String, String => Or[Array, nil]
|
|
7
7
|
def self.search(author, title)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
throw :song_lyric, result unless result.nil?
|
|
16
|
-
end
|
|
17
|
-
throw :song_lyric, nil # because song cannot be found.
|
|
18
|
-
}
|
|
8
|
+
Providers.list.each do |provider|
|
|
9
|
+
url = Providers.provider_url_for_song(provider, Song.new(author, title))
|
|
10
|
+
data = perform_request(url)
|
|
11
|
+
result = Providers.extract_lyric_from_data(data) if data
|
|
12
|
+
return result unless result.nil?
|
|
13
|
+
end
|
|
14
|
+
return nil # because song cannot be found.
|
|
19
15
|
end
|
|
20
16
|
|
|
21
17
|
def self.perform_request(url)
|
|
@@ -2,19 +2,18 @@ module LyricsFinder::Providers
|
|
|
2
2
|
include Contracts
|
|
3
3
|
|
|
4
4
|
def self.list
|
|
5
|
-
[
|
|
5
|
+
[LyricsWikia, LyricsMania, SongLyrics, Azlyrics]
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
klass.constantize
|
|
8
|
+
def self.provider_url_for_song(provider, song)
|
|
9
|
+
@current_provider = provider.new(song)
|
|
10
|
+
@current_provider.format_url
|
|
12
11
|
end
|
|
13
12
|
|
|
14
|
-
Contract
|
|
15
|
-
def self.
|
|
13
|
+
Contract Tempfile => Or[Array, nil]
|
|
14
|
+
def self.extract_lyric_from_data(data)
|
|
16
15
|
html = Nokogiri::HTML(data)
|
|
17
|
-
lyrics_container = html.css(css_element).first
|
|
16
|
+
lyrics_container = html.css(@current_provider.css_element).first
|
|
18
17
|
unless lyrics_container.nil?
|
|
19
18
|
elements = lyrics_container.children.to_a
|
|
20
19
|
phrases = elements.select { |el| el.text? && el.text != "\n" && !el.blank? }
|
|
@@ -22,50 +21,38 @@ module LyricsFinder::Providers
|
|
|
22
21
|
end
|
|
23
22
|
end
|
|
24
23
|
|
|
25
|
-
# Providers
|
|
24
|
+
# Providers Structs
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
def
|
|
26
|
+
LyricsWikia = Struct.new(:song) do
|
|
27
|
+
def format_url
|
|
29
28
|
song.format_attributes_with_separator!("_")
|
|
30
29
|
"http://lyrics.wikia.com/#{song.author}:#{song.title}"
|
|
31
30
|
end
|
|
32
|
-
|
|
33
|
-
def self.extract_lyric(data)
|
|
34
|
-
LyricsFinder::Providers.extract_lyrics_at_css_from_data('.lyricbox', data)
|
|
35
|
-
end
|
|
31
|
+
def css_element; ".lyricbox"; end
|
|
36
32
|
end
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
def
|
|
34
|
+
LyricsMania = Struct.new(:song) do
|
|
35
|
+
def format_url
|
|
40
36
|
song.format_attributes_with_separator!("_")
|
|
41
37
|
"http://www.lyricsmania.com/#{song.title}_lyrics_#{song.author}.html"
|
|
42
38
|
end
|
|
43
|
-
|
|
44
|
-
def self.extract_lyric(data)
|
|
45
|
-
LyricsFinder::Providers.extract_lyrics_at_css_from_data('.lyrics-body', data)
|
|
46
|
-
end
|
|
39
|
+
def css_element; ".lyrics-body"; end
|
|
47
40
|
end
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
def
|
|
42
|
+
SongLyrics = Struct.new(:song) do
|
|
43
|
+
def format_url
|
|
51
44
|
song.format_attributes_with_separator!("-")
|
|
52
45
|
"http://www.songlyrics.com/#{song.author}/#{song.title}-lyrics/"
|
|
53
46
|
end
|
|
54
|
-
|
|
55
|
-
def self.extract_lyric(data)
|
|
56
|
-
LyricsFinder::Providers.extract_lyrics_at_css_from_data('#songLyricsDiv', data)
|
|
57
|
-
end
|
|
47
|
+
def css_element; "#songLyricsDiv"; end
|
|
58
48
|
end
|
|
59
49
|
|
|
60
|
-
|
|
61
|
-
def
|
|
50
|
+
Azlyrics = Struct.new(:song) do
|
|
51
|
+
def format_url
|
|
62
52
|
song.format_attributes_with_separator!("")
|
|
63
53
|
"http://www.azlyrics.com/lyrics/#{song.author}/#{song.title}.html"
|
|
64
54
|
end
|
|
65
|
-
|
|
66
|
-
def self.extract_lyric(data)
|
|
67
|
-
LyricsFinder::Providers.extract_lyrics_at_css_from_data('div:nth-child(7)', data)
|
|
68
|
-
end
|
|
55
|
+
def css_element; "div:nth-child(7)"; end
|
|
69
56
|
end
|
|
70
57
|
|
|
71
58
|
end
|
data/lyrics_finder.gemspec
CHANGED
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.add_development_dependency 'coveralls', '~> 0.7.0'
|
|
28
28
|
spec.add_development_dependency 'pry', '~> 0.9'
|
|
29
29
|
spec.add_development_dependency 'pry-byebug', '1.3.2'
|
|
30
|
-
spec.add_development_dependency 'awesome_print', '
|
|
30
|
+
spec.add_development_dependency 'awesome_print', '1.2.0'
|
|
31
31
|
|
|
32
32
|
spec.add_dependency 'nokogiri', '~> 1.6.1'
|
|
33
33
|
spec.add_dependency 'activesupport', '~> 4.1.0'
|
|
@@ -2,8 +2,10 @@ describe LyricsFinder do
|
|
|
2
2
|
|
|
3
3
|
describe '#search' do
|
|
4
4
|
|
|
5
|
-
context '
|
|
5
|
+
context 'With LyricsWikia as the provider' do
|
|
6
6
|
before :each do
|
|
7
|
+
# LyricsFinder::Providers.stub(:list).and_return([LyricsFinder::Providers::LyricsWikia])
|
|
8
|
+
LyricsFinder::Providers.stub(list: [LyricsFinder::Providers::LyricsWikia])
|
|
7
9
|
VCR.use_cassette 'LyricsWikia 200 search' do
|
|
8
10
|
@song = LyricsFinder.search("american authors", "best day of my life")
|
|
9
11
|
end
|
|
@@ -14,12 +16,69 @@ describe LyricsFinder do
|
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
it 'returns the desired song' do
|
|
17
|
-
expect(@song).to eq
|
|
19
|
+
expect(@song).to eq SampleSongs::LYRICS_WIKIA_EXAMPLE
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context 'With LyricsMania as the provider' do
|
|
24
|
+
before :each do
|
|
25
|
+
LyricsFinder::Providers.stub(list: [LyricsFinder::Providers::LyricsMania])
|
|
26
|
+
VCR.use_cassette 'LyricsMania 200 search' do
|
|
27
|
+
@song = LyricsFinder.search("american authors", "best day of my life")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'returns an instance of Array' do
|
|
32
|
+
expect(@song.class).to eq Array
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'returns the desired song' do
|
|
36
|
+
expect(@song).to eq SampleSongs::LYRICS_MANIA_EXAMPLE
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
context 'With SongLyrics as the provider' do
|
|
41
|
+
before :each do
|
|
42
|
+
LyricsFinder::Providers.stub(list: [LyricsFinder::Providers::SongLyrics])
|
|
43
|
+
VCR.use_cassette 'SongLyrics 200 search' do
|
|
44
|
+
@song = LyricsFinder.search("american authors", "best day of my life")
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'returns an instance of Array' do
|
|
49
|
+
expect(@song.class).to eq Array
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'returns the desired song' do
|
|
53
|
+
expect(@song).to eq SampleSongs::SONG_LYRICS_EXAMPLE
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
context 'With Azlyrics as the provider' do
|
|
58
|
+
before :each do
|
|
59
|
+
LyricsFinder::Providers.stub(list: [LyricsFinder::Providers::Azlyrics])
|
|
60
|
+
VCR.use_cassette 'Azlyrics 200 search' do
|
|
61
|
+
@song = LyricsFinder.search("american authors", "best day of my life")
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'returns an instance of Array' do
|
|
66
|
+
expect(@song.class).to eq Array
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it 'returns the desired song' do
|
|
70
|
+
expect(@song).to eq SampleSongs::AZ_LYRICS_EXAMPLE
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
context 'with a sound that does not exist yet in any provider' do
|
|
75
|
+
it 'returns nil' do
|
|
76
|
+
expect(LyricsFinder.search("","")).to eq nil
|
|
18
77
|
end
|
|
19
78
|
end
|
|
20
79
|
|
|
21
80
|
context 'with invalid parameters' do
|
|
22
|
-
it '
|
|
81
|
+
it 'returns nil' do
|
|
23
82
|
expect(LyricsFinder.search("","")).to eq nil
|
|
24
83
|
end
|
|
25
84
|
end
|
|
@@ -3,25 +3,12 @@ describe LyricsFinder::Providers::Azlyrics do
|
|
|
3
3
|
|
|
4
4
|
describe '.format_url' do
|
|
5
5
|
context 'with valid author and title' do
|
|
6
|
-
let(:klass) { LyricsFinder::Providers::Azlyrics }
|
|
7
6
|
let(:song) { Song.new("amêricàn authors", "best day of my life") }
|
|
7
|
+
let(:az_lyrics) { LyricsFinder::Providers::Azlyrics.new(song) }
|
|
8
8
|
let(:valid_url) { "http://www.azlyrics.com/lyrics/americanauthors/bestdayofmylife.html" }
|
|
9
9
|
|
|
10
10
|
it 'returns a properly formatted url' do
|
|
11
|
-
expect(
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '.extract_lyric' do
|
|
17
|
-
# with valid data it's already tested in lyrics_finder_spec.rb
|
|
18
|
-
context 'with invalid data' do
|
|
19
|
-
let(:klass) { LyricsFinder::Providers::Azlyrics }
|
|
20
|
-
|
|
21
|
-
it 'raises a ContractError Exception' do
|
|
22
|
-
expect{
|
|
23
|
-
klass.extract_lyric(3.14)
|
|
24
|
-
}.to raise_error ContractError
|
|
11
|
+
expect(az_lyrics.format_url).to eq valid_url
|
|
25
12
|
end
|
|
26
13
|
end
|
|
27
14
|
end
|
|
@@ -3,25 +3,12 @@ describe LyricsFinder::Providers::LyricsMania do
|
|
|
3
3
|
|
|
4
4
|
describe '.format_url' do
|
|
5
5
|
context 'with valid author and title' do
|
|
6
|
-
let(:klass) { LyricsFinder::Providers::LyricsMania }
|
|
7
6
|
let(:song) { Song.new("amêricàn authors", "best day of my life") }
|
|
7
|
+
let(:lyrics_mania) { LyricsFinder::Providers::LyricsMania.new(song) }
|
|
8
8
|
let(:valid_url) { "http://www.lyricsmania.com/best_day_of_my_life_lyrics_american_authors.html" }
|
|
9
9
|
|
|
10
10
|
it 'returns a properly formatted url' do
|
|
11
|
-
expect(
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '.extract_lyric' do
|
|
17
|
-
# with valid data it's already tested in lyrics_finder_spec.rb
|
|
18
|
-
context 'with invalid data' do
|
|
19
|
-
let(:klass) { LyricsFinder::Providers::LyricsMania }
|
|
20
|
-
|
|
21
|
-
it 'raises a ContractError Exception' do
|
|
22
|
-
expect{
|
|
23
|
-
klass.extract_lyric({})
|
|
24
|
-
}.to raise_error ContractError
|
|
11
|
+
expect(lyrics_mania.format_url).to eq valid_url
|
|
25
12
|
end
|
|
26
13
|
end
|
|
27
14
|
end
|
|
@@ -3,25 +3,12 @@ describe LyricsFinder::Providers::LyricsWikia do
|
|
|
3
3
|
|
|
4
4
|
describe '.format_url' do
|
|
5
5
|
context 'with valid author and title' do
|
|
6
|
-
let(:klass) { LyricsFinder::Providers::LyricsWikia }
|
|
7
6
|
let(:song) { Song.new("amëricán authòrs", "best day of my life") }
|
|
7
|
+
let(:lyrics_wikia) { LyricsFinder::Providers::LyricsWikia.new(song) }
|
|
8
8
|
let(:valid_url) { "http://lyrics.wikia.com/american_authors:best_day_of_my_life" }
|
|
9
9
|
|
|
10
10
|
it 'returns a properly formatted url' do
|
|
11
|
-
expect(
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '.extract_lyric' do
|
|
17
|
-
# with valid data it's already tested in lyrics_finder_spec.rb
|
|
18
|
-
context 'with invalid data' do
|
|
19
|
-
let(:klass) { LyricsFinder::Providers::LyricsWikia }
|
|
20
|
-
|
|
21
|
-
it 'raises a ContractError Exception' do
|
|
22
|
-
expect{
|
|
23
|
-
klass.extract_lyric("invalid data")
|
|
24
|
-
}.to raise_error ContractError
|
|
11
|
+
expect(lyrics_wikia.format_url).to eq valid_url
|
|
25
12
|
end
|
|
26
13
|
end
|
|
27
14
|
end
|
|
@@ -3,25 +3,12 @@ describe LyricsFinder::Providers::SongLyrics do
|
|
|
3
3
|
|
|
4
4
|
describe '.format_url' do
|
|
5
5
|
context 'with valid author and title' do
|
|
6
|
-
let(:klass) { LyricsFinder::Providers::SongLyrics}
|
|
7
6
|
let(:song) { Song.new("amêricàn authors", "best day of my life") }
|
|
7
|
+
let(:song_lyrics) { LyricsFinder::Providers::SongLyrics.new(song) }
|
|
8
8
|
let(:valid_url) { "http://www.songlyrics.com/american-authors/best-day-of-my-life-lyrics/" }
|
|
9
9
|
|
|
10
10
|
it 'returns a properly formatted url' do
|
|
11
|
-
expect(
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '.extract_lyric' do
|
|
17
|
-
# with valid data it's already tested in lyrics_finder_spec.rb
|
|
18
|
-
context 'with invalid data' do
|
|
19
|
-
let(:klass) { LyricsFinder::Providers::SongLyrics }
|
|
20
|
-
|
|
21
|
-
it 'raises a ContractError Exception' do
|
|
22
|
-
expect{
|
|
23
|
-
klass.extract_lyric([])
|
|
24
|
-
}.to raise_error ContractError
|
|
11
|
+
expect(song_lyrics.format_url).to eq valid_url
|
|
25
12
|
end
|
|
26
13
|
end
|
|
27
14
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
module SampleSongs
|
|
2
|
+
LYRICS_WIKIA_EXAMPLE = ["I had a dream so big and loud",
|
|
3
|
+
"I jumped so high I touched the clouds",
|
|
4
|
+
"Wo-oah-oah-oah-oah-oh",
|
|
5
|
+
"(Wo-oah-oah-oah-oah-oh)",
|
|
6
|
+
"I stretched my hands out to the sky",
|
|
7
|
+
"We danced with monsters through the night",
|
|
8
|
+
"Wo-oah-oah-oah-oah-oh",
|
|
9
|
+
"(Wo-oah-oah-oah-oah-oh)",
|
|
10
|
+
"I'm never gonna look back, whoa",
|
|
11
|
+
"Never gonna give it up, no",
|
|
12
|
+
"Please don't wake me now",
|
|
13
|
+
"This is gonna be the best day of my life",
|
|
14
|
+
"My life-ah-ah-ah-ah-ah-ife",
|
|
15
|
+
"This is gonna be the best day of my life",
|
|
16
|
+
"My life-ah-ah-ah-ah-ah-ife",
|
|
17
|
+
"I howled at the moon with friends",
|
|
18
|
+
"And then the sun came crashing in",
|
|
19
|
+
"Wo-oah-oah-oah-oah-oh",
|
|
20
|
+
"(Wo-oah-oah-oah-oah-oh)",
|
|
21
|
+
"But all the possibilities",
|
|
22
|
+
"No limits just epiphanies",
|
|
23
|
+
"Wo-oah-oah-oah-oah-oh",
|
|
24
|
+
"(Wo-oah-oah-oah-oah-oh)",
|
|
25
|
+
"I'm never gonna look back, whoa",
|
|
26
|
+
"Never gonna give it up, no",
|
|
27
|
+
"Just don't wake me now",
|
|
28
|
+
"This is gonna be the best day of my life",
|
|
29
|
+
"My life-ah-ah-ah-ah-ah-ife",
|
|
30
|
+
"This is gonna be the best day of my life",
|
|
31
|
+
"My life-ah-ah-ah-ah-ah-ife",
|
|
32
|
+
"I hear it calling outside my window",
|
|
33
|
+
"I feel it in my soul (soul)",
|
|
34
|
+
"The stars were burning so bright",
|
|
35
|
+
"The sun was out 'til midnight",
|
|
36
|
+
"I say we lose control (control)",
|
|
37
|
+
"This is gonna be the best day of my life",
|
|
38
|
+
"My life-ah-ah-ah-ah-ah-ife",
|
|
39
|
+
"This is gonna be the best day of my life",
|
|
40
|
+
"My life-ah-ah-ah-ah-ah-ife",
|
|
41
|
+
"This is gonna be, this is gonna be, this is gotta be",
|
|
42
|
+
"The best day of my life",
|
|
43
|
+
"Everything is looking up, everybody up now",
|
|
44
|
+
"This is gonna be the best day of my life",
|
|
45
|
+
"My life-ah-ah-ah-ah-ah-ife"]
|
|
46
|
+
|
|
47
|
+
LYRICS_MANIA_EXAMPLE = ["Wo-o-o-o-o-oh Wooh",
|
|
48
|
+
"I had a dream so big and loud",
|
|
49
|
+
"I jumped so high I touched the clouds",
|
|
50
|
+
"Wo-o-o-o-o-oh",
|
|
51
|
+
"Wo-o-o-o-o-oh",
|
|
52
|
+
"I stretched my hands out to the sky",
|
|
53
|
+
"We danced with monsters through the night",
|
|
54
|
+
"Wo-o-o-o-o-oh",
|
|
55
|
+
"Wo-o-o-o-o-oh",
|
|
56
|
+
"I'm never gonna look back",
|
|
57
|
+
"Woah, I'm never gonna give it up",
|
|
58
|
+
"No, please don't wake me now",
|
|
59
|
+
"Oo-o-o-o-oo",
|
|
60
|
+
"This is gonna be the best day of my life",
|
|
61
|
+
"My li-i-i-i-i-ife",
|
|
62
|
+
"Oo-o-o-o-oo",
|
|
63
|
+
"This is gonna be the best day of my life",
|
|
64
|
+
"My li-i-i-i-i-ife",
|
|
65
|
+
"I howled at the moon with friends",
|
|
66
|
+
"And then the sun came crashing in",
|
|
67
|
+
"Wo-o-o-o-o-oh",
|
|
68
|
+
"Wo-o-o-o-o-oh",
|
|
69
|
+
"But all the possibilities",
|
|
70
|
+
"No limits just epiphanies",
|
|
71
|
+
"Wo-o-o-o-o-oh",
|
|
72
|
+
"Wo-o-o-o-o-oh",
|
|
73
|
+
"I'm never gonna look back",
|
|
74
|
+
"Woah, I'm never gonna give it up",
|
|
75
|
+
"No, just don't wake me now",
|
|
76
|
+
"Oo-o-o-o-oo",
|
|
77
|
+
"This is gonna be the best day of my life",
|
|
78
|
+
"My li-i-i-i-i-ife",
|
|
79
|
+
"Oo-o-o-o-oo",
|
|
80
|
+
"This is gonna be the best day of my life",
|
|
81
|
+
"My li-i-i-i-i-ife",
|
|
82
|
+
"I hear it calling outside my window",
|
|
83
|
+
"I feel it in my soul (soul)",
|
|
84
|
+
"The stars were burning so bright",
|
|
85
|
+
"The sun was out 'til midnight",
|
|
86
|
+
"I say we lose control (control)",
|
|
87
|
+
"This is gonna be the best day of my life",
|
|
88
|
+
"My li-i-i-i-i-ife",
|
|
89
|
+
"Oo-o-o-o-o",
|
|
90
|
+
"This is gonna be the best day of my life",
|
|
91
|
+
"My li-i-i-i-i-ife",
|
|
92
|
+
"This is gonna be, this is gonna be, this is gonna be",
|
|
93
|
+
"The best day of my life",
|
|
94
|
+
"Everything is looking up, everybody up now",
|
|
95
|
+
"This is gonna be the best day of my life",
|
|
96
|
+
"My li-i-i-i-i-ife"]
|
|
97
|
+
|
|
98
|
+
SONG_LYRICS_EXAMPLE = ["I had a dream so big and loud",
|
|
99
|
+
"I jumped so high I touched the clouds",
|
|
100
|
+
"Wo-o-o-o-o-oh, wo-o-o-o-o-oh",
|
|
101
|
+
"I stretched my hands out to the sky",
|
|
102
|
+
"We danced with Angels through the night",
|
|
103
|
+
"Wo-o-o-o-o-oh, wo-o-o-o-o-oh",
|
|
104
|
+
"I'm never gonna look back",
|
|
105
|
+
"Woah, never gonna give it up",
|
|
106
|
+
"No, please don't wake me now",
|
|
107
|
+
"This is gonna be the best day of my life",
|
|
108
|
+
"My li-i-i-i-i-ife",
|
|
109
|
+
"This is gonna be the best day of my life",
|
|
110
|
+
"My li-i-i-i-i-ife",
|
|
111
|
+
"I hailed at the moon with friends",
|
|
112
|
+
"And then the sun came shinning in",
|
|
113
|
+
"Wo-o-o-o-o-oh, wo-o-o-o-o-oh",
|
|
114
|
+
"But all the possibilities",
|
|
115
|
+
"No limits just epiphanies",
|
|
116
|
+
"Wo-o-o-o-o-oh, wo-o-o-o-o-oh",
|
|
117
|
+
"I'm never gonna look back",
|
|
118
|
+
"Woah, never gonna give it up",
|
|
119
|
+
"No, just don't wake me now",
|
|
120
|
+
"This is gonna be the best day of my life",
|
|
121
|
+
"My li-i-i-i-i-ife",
|
|
122
|
+
"This is gonna be the best day of my life",
|
|
123
|
+
"My li-i-i-i-i-ife",
|
|
124
|
+
"I hear it calling outside my window",
|
|
125
|
+
"I feel it in my soul (soul)",
|
|
126
|
+
"The stars were flashing so bright",
|
|
127
|
+
"The sun was out 'til midnight",
|
|
128
|
+
"I say we gained control (control)",
|
|
129
|
+
"This is gonna be the best day of my life",
|
|
130
|
+
"My li-i-i-i-i-ife",
|
|
131
|
+
"This is gonna be the best day of my life",
|
|
132
|
+
"My li-i-i-i-i-ife",
|
|
133
|
+
"This is gonna be, this is gonna be, this is gonna be",
|
|
134
|
+
"The best day of my life",
|
|
135
|
+
"Everything is looking up, everybody up now",
|
|
136
|
+
"This is gonna be the best day of my life",
|
|
137
|
+
"My li-i-i-i-i-ife"]
|
|
138
|
+
|
|
139
|
+
AZ_LYRICS_EXAMPLE = ["I had a dream so big and loud",
|
|
140
|
+
"I jumped so high I touched the clouds",
|
|
141
|
+
"Wo-o-o-o-o-oh",
|
|
142
|
+
"I stretched my hands out to the sky",
|
|
143
|
+
"We danced with monsters through the night",
|
|
144
|
+
"Wo-o-o-o-o-oh",
|
|
145
|
+
"I'm never gonna look back",
|
|
146
|
+
"Whoa, I'm never gonna give it up",
|
|
147
|
+
"No, please don't wake me now",
|
|
148
|
+
"Oo-o-o-o-oo",
|
|
149
|
+
"This is gonna be the best day of my life",
|
|
150
|
+
"My life",
|
|
151
|
+
"Oo-o-o-o-oo",
|
|
152
|
+
"This is gonna be the best day of my life",
|
|
153
|
+
"My life",
|
|
154
|
+
"I howled at the moon with friends",
|
|
155
|
+
"And then the sun came crashing in",
|
|
156
|
+
"Wo-o-o-o-o-oh",
|
|
157
|
+
"But all the possibilities",
|
|
158
|
+
"No limits just epiphanies",
|
|
159
|
+
"Wo-o-o-o-o-oh",
|
|
160
|
+
"I'm never gonna look back",
|
|
161
|
+
"Whoa, I'm never gonna give it up",
|
|
162
|
+
"No, just don't wake me now",
|
|
163
|
+
"Oo-o-o-o-oo",
|
|
164
|
+
"This is gonna be the best day of my life",
|
|
165
|
+
"My life",
|
|
166
|
+
"Oo-o-o-o-oo",
|
|
167
|
+
"This is gonna be the best day of my life",
|
|
168
|
+
"My life",
|
|
169
|
+
"I hear it calling outside my window",
|
|
170
|
+
"I feel it in my soul (soul)",
|
|
171
|
+
"The stars were burning so bright",
|
|
172
|
+
"The sun was out 'til midnight",
|
|
173
|
+
"I say we lose control (control)",
|
|
174
|
+
"This is gonna be the best day of my life",
|
|
175
|
+
"My life",
|
|
176
|
+
"Oo-o-o-o-o",
|
|
177
|
+
"This is gonna be the best day of my life",
|
|
178
|
+
"My life",
|
|
179
|
+
"This is gonna be, this is gonna be, this is gonna be",
|
|
180
|
+
"The best day of my life",
|
|
181
|
+
"Everything is looking up, everybody up now",
|
|
182
|
+
"This is gonna be the best day of my life",
|
|
183
|
+
"My life"]
|
|
184
|
+
|
|
185
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lyrics_finder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Romero
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-09-
|
|
11
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -140,14 +140,14 @@ dependencies:
|
|
|
140
140
|
name: awesome_print
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements:
|
|
143
|
-
- -
|
|
143
|
+
- - '='
|
|
144
144
|
- !ruby/object:Gem::Version
|
|
145
145
|
version: 1.2.0
|
|
146
146
|
type: :development
|
|
147
147
|
prerelease: false
|
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
149
|
requirements:
|
|
150
|
-
- -
|
|
150
|
+
- - '='
|
|
151
151
|
- !ruby/object:Gem::Version
|
|
152
152
|
version: 1.2.0
|
|
153
153
|
- !ruby/object:Gem::Dependency
|
|
@@ -250,9 +250,8 @@ files:
|
|
|
250
250
|
- spec/lyrics_finder/providers/lyrics_mania_spec.rb
|
|
251
251
|
- spec/lyrics_finder/providers/lyrics_wikia_spec.rb
|
|
252
252
|
- spec/lyrics_finder/providers/song_lyrics_spec.rb
|
|
253
|
-
- spec/lyrics_finder/providers_spec.rb
|
|
254
253
|
- spec/spec_helper.rb
|
|
255
|
-
- spec/support/
|
|
254
|
+
- spec/support/sample_songs.rb
|
|
256
255
|
- spec/support/vcr_setup.rb
|
|
257
256
|
homepage: https://github.com/dnlR/lyrics_finder
|
|
258
257
|
licenses:
|
|
@@ -284,7 +283,6 @@ test_files:
|
|
|
284
283
|
- spec/lyrics_finder/providers/lyrics_mania_spec.rb
|
|
285
284
|
- spec/lyrics_finder/providers/lyrics_wikia_spec.rb
|
|
286
285
|
- spec/lyrics_finder/providers/song_lyrics_spec.rb
|
|
287
|
-
- spec/lyrics_finder/providers_spec.rb
|
|
288
286
|
- spec/spec_helper.rb
|
|
289
|
-
- spec/support/
|
|
287
|
+
- spec/support/sample_songs.rb
|
|
290
288
|
- spec/support/vcr_setup.rb
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
describe LyricsFinder::Providers do
|
|
2
|
-
|
|
3
|
-
describe '.build_klass' do
|
|
4
|
-
|
|
5
|
-
context 'with valid arguments' do
|
|
6
|
-
let(:klass) { LyricsFinder::Providers::LyricsWikia }
|
|
7
|
-
|
|
8
|
-
it 'builds the correct class' do
|
|
9
|
-
expect(LyricsFinder::Providers.build_klass(:lyrics_wikia)).to eq klass
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
context 'with invalid arguments' do
|
|
14
|
-
it 'raises a ContractError Exception' do
|
|
15
|
-
expect{
|
|
16
|
-
LyricsFinder::Providers.build_klass("klass")
|
|
17
|
-
}.to raise_error ContractError
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
end
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
module LyricsWikiaSampleSongs
|
|
2
|
-
BEST_DAY_OF_MY_LIFE = ["I had a dream so big and loud",
|
|
3
|
-
"I jumped so high I touched the clouds",
|
|
4
|
-
"Wo-oah-oah-oah-oah-oh",
|
|
5
|
-
"(Wo-oah-oah-oah-oah-oh)",
|
|
6
|
-
"I stretched my hands out to the sky",
|
|
7
|
-
"We danced with monsters through the night",
|
|
8
|
-
"Wo-oah-oah-oah-oah-oh",
|
|
9
|
-
"(Wo-oah-oah-oah-oah-oh)",
|
|
10
|
-
"I'm never gonna look back, whoa",
|
|
11
|
-
"Never gonna give it up, no",
|
|
12
|
-
"Please don't wake me now",
|
|
13
|
-
"This is gonna be the best day of my life",
|
|
14
|
-
"My life-ah-ah-ah-ah-ah-ife",
|
|
15
|
-
"This is gonna be the best day of my life",
|
|
16
|
-
"My life-ah-ah-ah-ah-ah-ife",
|
|
17
|
-
"I howled at the moon with friends",
|
|
18
|
-
"And then the sun came crashing in",
|
|
19
|
-
"Wo-oah-oah-oah-oah-oh",
|
|
20
|
-
"(Wo-oah-oah-oah-oah-oh)",
|
|
21
|
-
"But all the possibilities",
|
|
22
|
-
"No limits just epiphanies",
|
|
23
|
-
"Wo-oah-oah-oah-oah-oh",
|
|
24
|
-
"(Wo-oah-oah-oah-oah-oh)",
|
|
25
|
-
"I'm never gonna look back, whoa",
|
|
26
|
-
"Never gonna give it up, no",
|
|
27
|
-
"Just don't wake me now",
|
|
28
|
-
"This is gonna be the best day of my life",
|
|
29
|
-
"My life-ah-ah-ah-ah-ah-ife",
|
|
30
|
-
"This is gonna be the best day of my life",
|
|
31
|
-
"My life-ah-ah-ah-ah-ah-ife",
|
|
32
|
-
"I hear it calling outside my window",
|
|
33
|
-
"I feel it in my soul (soul)",
|
|
34
|
-
"The stars were burning so bright",
|
|
35
|
-
"The sun was out 'til midnight",
|
|
36
|
-
"I say we lose control (control)",
|
|
37
|
-
"This is gonna be the best day of my life",
|
|
38
|
-
"My life-ah-ah-ah-ah-ah-ife",
|
|
39
|
-
"This is gonna be the best day of my life",
|
|
40
|
-
"My life-ah-ah-ah-ah-ah-ife",
|
|
41
|
-
"This is gonna be, this is gonna be, this is gotta be",
|
|
42
|
-
"The best day of my life",
|
|
43
|
-
"Everything is looking up, everybody up now",
|
|
44
|
-
"This is gonna be the best day of my life",
|
|
45
|
-
"My life-ah-ah-ah-ah-ah-ife"]
|
|
46
|
-
end
|