vagalume 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +39 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +44 -0
- data/VERSION +1 -0
- data/lib/vagalume.rb +19 -0
- data/lib/vagalume/artist.rb +13 -0
- data/lib/vagalume/core_ext/array.rb +9 -0
- data/lib/vagalume/language.rb +14 -0
- data/lib/vagalume/search_result.rb +25 -0
- data/lib/vagalume/song.rb +39 -0
- data/lib/vagalume/status.rb +8 -0
- data/spec/assets/unforgiven_lyric.txt +82 -0
- data/spec/assets/unforgiven_lyric_translation_pt.txt +82 -0
- data/spec/base_spec.rb +58 -0
- data/spec/fixtures/vcr_cassettes/vagalume.yml +100 -0
- data/spec/fixtures/vcr_cassettes/vagalume_not_found.yml +54 -0
- data/spec/fixtures/vcr_cassettes/vagalume_song_not_found.yml +54 -0
- data/spec/spec_helper.rb +8 -0
- data/test/helper.rb +18 -0
- data/test/test_vagalume.rb +7 -0
- data/vagalume.gemspec +78 -0
- metadata +140 -0
data/.document
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.2.7)
|
5
|
+
crack (0.1.8)
|
6
|
+
diff-lcs (1.1.3)
|
7
|
+
git (1.2.5)
|
8
|
+
jeweler (1.8.4)
|
9
|
+
bundler (~> 1.0)
|
10
|
+
git (>= 1.2.5)
|
11
|
+
rake
|
12
|
+
rdoc
|
13
|
+
json (1.7.1)
|
14
|
+
multi_json (1.3.4)
|
15
|
+
rake (0.9.2.2)
|
16
|
+
rdoc (3.12)
|
17
|
+
json (~> 1.4)
|
18
|
+
rspec (2.9.0)
|
19
|
+
rspec-core (~> 2.9.0)
|
20
|
+
rspec-expectations (~> 2.9.0)
|
21
|
+
rspec-mocks (~> 2.9.0)
|
22
|
+
rspec-core (2.9.0)
|
23
|
+
rspec-expectations (2.9.1)
|
24
|
+
diff-lcs (~> 1.1.3)
|
25
|
+
rspec-mocks (2.9.0)
|
26
|
+
vcr (2.2.2)
|
27
|
+
webmock (1.8.7)
|
28
|
+
addressable (>= 2.2.7)
|
29
|
+
crack (>= 0.1.7)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
jeweler (~> 1.8.4)
|
36
|
+
multi_json
|
37
|
+
rspec
|
38
|
+
vcr
|
39
|
+
webmock
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Brian Thomas Storti
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= vagalume
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to vagalume
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2012 Brian Thomas Storti. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
gem.name = "vagalume"
|
17
|
+
gem.homepage = "http://github.com/brianstorti/vagalume"
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = %Q{Ruby interface for the Vagalume API}
|
20
|
+
gem.description = %Q{Ruby interface for the Vagalume API}
|
21
|
+
gem.email = "btstorti@gmail.com"
|
22
|
+
gem.authors = ["Brian Thomas Storti"]
|
23
|
+
gem.add_dependency "multi_json"
|
24
|
+
end
|
25
|
+
Jeweler::RubygemsDotOrgTasks.new
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
Rake::TestTask.new(:test) do |test|
|
29
|
+
test.libs << 'lib' << 'spec'
|
30
|
+
test.pattern = 'spec/**/*_spec.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :default => :test
|
35
|
+
|
36
|
+
require 'rdoc/task'
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
38
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
39
|
+
|
40
|
+
rdoc.rdoc_dir = 'rdoc'
|
41
|
+
rdoc.title = "vagalume #{version}"
|
42
|
+
rdoc.rdoc_files.include('README*')
|
43
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
44
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/vagalume.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "multi_json"
|
2
|
+
require "cgi"
|
3
|
+
require "open-uri"
|
4
|
+
require "vagalume/core_ext/array"
|
5
|
+
require "vagalume/search_result"
|
6
|
+
require "vagalume/language"
|
7
|
+
require "vagalume/song"
|
8
|
+
require "vagalume/artist"
|
9
|
+
require "vagalume/status"
|
10
|
+
|
11
|
+
module Vagalume
|
12
|
+
BASE_URL = "http://www.vagalume.com.br/api/search.php?"
|
13
|
+
|
14
|
+
def self.find(artist, song)
|
15
|
+
request_url = BASE_URL + "art=#{CGI.escape(artist)}&mus=#{CGI.escape(song)}"
|
16
|
+
result_json = MultiJson.decode(open(request_url).read)
|
17
|
+
search_result = Vagalume::SearchResult.fetch(result_json)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Vagalume
|
2
|
+
class Artist
|
3
|
+
attr_accessor :id, :name, :url
|
4
|
+
|
5
|
+
def self.fetch(artist_json)
|
6
|
+
artist = Vagalume::Artist.new
|
7
|
+
artist.id = artist_json["id"]
|
8
|
+
artist.name = artist_json["name"]
|
9
|
+
artist.url = artist_json["url"]
|
10
|
+
artist
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Vagalume
|
2
|
+
class SearchResult
|
3
|
+
attr_accessor :status, :artist, :song, :translations
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@translations = []
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.fetch(result_json)
|
10
|
+
result = Vagalume::SearchResult.new
|
11
|
+
result.status = result_json["type"]
|
12
|
+
return result if result.status == Vagalume::Status::NOT_FOUND || result.status == Vagalume::Status::SONG_NOT_FOUND
|
13
|
+
song = result_json["mus"].first
|
14
|
+
artist = result_json["art"]
|
15
|
+
translations = song["translate"]
|
16
|
+
result.song = Vagalume::Song.fetch(song)
|
17
|
+
result.artist = Vagalume::Artist.fetch(artist)
|
18
|
+
|
19
|
+
translations.each do |translation|
|
20
|
+
result.translations << Vagalume::Song.fetch(translation)
|
21
|
+
end
|
22
|
+
result
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Vagalume
|
2
|
+
class Song
|
3
|
+
attr_accessor :id, :name, :language, :url, :lyric
|
4
|
+
|
5
|
+
def self.fetch(song_json)
|
6
|
+
song = Vagalume::Song.new
|
7
|
+
song.id = song_json["id"]
|
8
|
+
song.language = song_json["lang"]
|
9
|
+
song.url = song_json["url"]
|
10
|
+
song.lyric = song_json["text"]
|
11
|
+
song.name = song_json["name"]
|
12
|
+
if song.translation?
|
13
|
+
song.name = get_name_from_lyric(song.lyric)
|
14
|
+
song.lyric = remove_title(song.lyric)
|
15
|
+
end
|
16
|
+
song
|
17
|
+
end
|
18
|
+
|
19
|
+
def translation?
|
20
|
+
@name.nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.get_name_from_lyric(lyric)
|
24
|
+
title = lyric.lines.first
|
25
|
+
title.gsub(/\[|\]|\n/, "")
|
26
|
+
end
|
27
|
+
|
28
|
+
# This is necessary because on translations, the song title comes with the
|
29
|
+
# lyric text, so we need to remove the first two lines, in order to
|
30
|
+
# have a consistent API with the song object
|
31
|
+
def self.remove_title(lyric)
|
32
|
+
lyric_lines_array = lyric.lines.to_a
|
33
|
+
lyric_lines_array.shift(2)
|
34
|
+
lyric = ""
|
35
|
+
lyric_lines_array.each { |line| lyric << line }
|
36
|
+
lyric
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
New blood joins this earth
|
2
|
+
And quickly he's subdued
|
3
|
+
Through constant pained disgrace
|
4
|
+
The young boy learns their rules
|
5
|
+
|
6
|
+
With time the child draws in
|
7
|
+
This whipping boy done wrong
|
8
|
+
Deprived of all his thoughts
|
9
|
+
The young man struggles on and on he's known
|
10
|
+
A vow unto his own
|
11
|
+
That never from this day
|
12
|
+
His will they'll take away
|
13
|
+
|
14
|
+
What I've felt
|
15
|
+
What I've known
|
16
|
+
Never shined through in what I've shown
|
17
|
+
Never be
|
18
|
+
Never see
|
19
|
+
Won't see what might have been
|
20
|
+
|
21
|
+
What I've felt
|
22
|
+
What I've known
|
23
|
+
Never shined through in what I've shown
|
24
|
+
Never free
|
25
|
+
Never me
|
26
|
+
So I dub the unforgiven
|
27
|
+
|
28
|
+
They dedicate their lives
|
29
|
+
To running all of his
|
30
|
+
He tries to please them all
|
31
|
+
This bitter man he is
|
32
|
+
Throughout his life the same
|
33
|
+
He's battled constantly
|
34
|
+
This fight he cannot win
|
35
|
+
A tired man they see no longer cares
|
36
|
+
The old man then prepares
|
37
|
+
To die regretfully
|
38
|
+
That old man here is me
|
39
|
+
|
40
|
+
What I've felt
|
41
|
+
What I've known
|
42
|
+
Never shined through in what I've shown
|
43
|
+
Never be
|
44
|
+
Never see
|
45
|
+
Won't see what might have been
|
46
|
+
|
47
|
+
What I've felt
|
48
|
+
What I've known
|
49
|
+
Never shined through in what I've shown
|
50
|
+
Never free
|
51
|
+
Never me
|
52
|
+
So I dub the unforgiven
|
53
|
+
|
54
|
+
What I've felt
|
55
|
+
What I've known
|
56
|
+
Never shined through in what I've shown
|
57
|
+
Never be
|
58
|
+
Never see
|
59
|
+
Won't see what might have been
|
60
|
+
|
61
|
+
What I've felt
|
62
|
+
What I've known
|
63
|
+
Never shined through in what I've shown
|
64
|
+
Never free
|
65
|
+
Never me
|
66
|
+
So I dub the unforgiven
|
67
|
+
|
68
|
+
Never free
|
69
|
+
Never me
|
70
|
+
So I dub the unforgiven
|
71
|
+
|
72
|
+
You labeled me
|
73
|
+
I'll label you
|
74
|
+
So I dub the unforgiven
|
75
|
+
|
76
|
+
Never free
|
77
|
+
Never me
|
78
|
+
So I dub the unforgiven
|
79
|
+
|
80
|
+
You labeled me
|
81
|
+
I'll label you
|
82
|
+
So I dub the unforgiven
|
@@ -0,0 +1,82 @@
|
|
1
|
+
Sangue novo se junta a esta terra
|
2
|
+
E rapidamente ele é subjugado
|
3
|
+
Atravessando constante e dolorosa desgraça
|
4
|
+
O jovem garoto aprende suas regras
|
5
|
+
|
6
|
+
Com o tempo a criança é enganada
|
7
|
+
Este rapaz subjugado fez errado
|
8
|
+
Desprovido de todos os seus pensamentos
|
9
|
+
O jovem homem aguenta e aguenta, ele sabe
|
10
|
+
Um juramento para si mesmo
|
11
|
+
Que nunca a partir deste dia
|
12
|
+
Eles vão tirar o seu desejo
|
13
|
+
|
14
|
+
O que eu senti
|
15
|
+
O que eu soube
|
16
|
+
Nunca transpareceu no que eu mostrei
|
17
|
+
Nunca ser
|
18
|
+
Nunca ver
|
19
|
+
Não verei o que poderia ter sido
|
20
|
+
|
21
|
+
O que eu senti
|
22
|
+
O que eu soube
|
23
|
+
Nunca transpareceu no que eu mostrei
|
24
|
+
Nunca livre
|
25
|
+
Nunca eu mesmo
|
26
|
+
Então eu os nomeio imperdoáveis
|
27
|
+
|
28
|
+
Eles dedicaram suas vidas
|
29
|
+
A tomar tudo deles
|
30
|
+
Ele tenta satisfazer a todos
|
31
|
+
Este homem amargo ele se torna
|
32
|
+
Por toda a sua vida o mesmo
|
33
|
+
Ele lutou constantemente
|
34
|
+
Esta luta ele não pode vencer
|
35
|
+
Um homem cansado eles vêem, não importa mais
|
36
|
+
O velho homem então se prepara
|
37
|
+
Para morrer cheio de arrependimentos
|
38
|
+
Este velho homem aqui sou eu
|
39
|
+
|
40
|
+
O que eu senti
|
41
|
+
O que eu soube
|
42
|
+
Nunca apareceram no que eu mostrei
|
43
|
+
Nunca ser
|
44
|
+
Nunca ver
|
45
|
+
Não ver o que poderia ter sido
|
46
|
+
|
47
|
+
O que eu senti
|
48
|
+
O que eu soube
|
49
|
+
Nunca apareceram no que eu mostrei
|
50
|
+
Nunca livre
|
51
|
+
Nunca eu mesmo
|
52
|
+
Então eu os nomeio imperdoáveis
|
53
|
+
|
54
|
+
O que eu senti
|
55
|
+
O que eu soube
|
56
|
+
Nunca apareceram no que eu mostrei
|
57
|
+
Nunca ser
|
58
|
+
Nunca ver
|
59
|
+
Não ver o que poderia ter sido
|
60
|
+
|
61
|
+
O que eu senti
|
62
|
+
O que eu soube
|
63
|
+
Nunca apareceram no que eu mostrei
|
64
|
+
Nunca livre
|
65
|
+
Nunca eu mesmo
|
66
|
+
Então eu os nomeio imperdoáveis
|
67
|
+
|
68
|
+
Nunca livre
|
69
|
+
Nunca eu mesmo
|
70
|
+
Então eu os nomeio imperdoáveis
|
71
|
+
|
72
|
+
Vocês me rotularam
|
73
|
+
Eu rotularei vocês
|
74
|
+
Então eu os nomeio imperdoáveis
|
75
|
+
|
76
|
+
Nunca livre
|
77
|
+
Nunca eu mesmo
|
78
|
+
Então eu os nomeio imperdoáveis
|
79
|
+
|
80
|
+
Vocês me rotularam
|
81
|
+
Eu rotularei vocês
|
82
|
+
Então eu os nomeio imperdoáveis
|
data/spec/base_spec.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe "Base" do
|
6
|
+
it "should bring song" do
|
7
|
+
VCR.use_cassette('vagalume') do
|
8
|
+
result = Vagalume.find("Metallica", "The Unforgiven")
|
9
|
+
song = result.song
|
10
|
+
artist = result.artist
|
11
|
+
lyric = File.read 'spec/assets/unforgiven_lyric.txt'
|
12
|
+
|
13
|
+
result.status.should == Vagalume::Status::EXACT
|
14
|
+
|
15
|
+
song.id.should == "3ade68b6g470deda3"
|
16
|
+
song.name.should == "The Unforgiven"
|
17
|
+
song.language.should == Vagalume::Language::ENGLISH
|
18
|
+
song.url.should == "http://www.vagalume.com.br/metallica/the-unforgiven.html"
|
19
|
+
song.lyric.should == lyric.chop!
|
20
|
+
|
21
|
+
artist.id.should == "3ade68b5g7257eda3"
|
22
|
+
artist.name.should == "Metallica"
|
23
|
+
artist.url.should == "http://www.vagalume.com.br/metallica/"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should return result with song not found status" do
|
28
|
+
VCR.use_cassette('vagalume_song_not_found') do
|
29
|
+
result = Vagalume.find("Metallica", "Oops")
|
30
|
+
result.status.should == Vagalume::Status::SONG_NOT_FOUND
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should return result with not found status" do
|
35
|
+
VCR.use_cassette('vagalume_not_found') do
|
36
|
+
result = Vagalume.find("Oops", "Oops")
|
37
|
+
result.status.should == Vagalume::Status::NOT_FOUND
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should have translations" do
|
42
|
+
VCR.use_cassette('vagalume') do
|
43
|
+
result = Vagalume.find("Metallica", "The Unforgiven")
|
44
|
+
result.translations.should_not be_empty
|
45
|
+
pt_translation = result.translations.with_language(Vagalume::Language::PORTUGUESE)
|
46
|
+
lyric = File.read 'spec/assets/unforgiven_lyric_translation_pt.txt'
|
47
|
+
pt_translation.lyric.should == lyric.chop!
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should get right song name for translations" do
|
52
|
+
VCR.use_cassette('vagalume') do
|
53
|
+
result = Vagalume.find("Metallica", "The Unforgiven")
|
54
|
+
translated_song = result.translations.with_language(Vagalume::Language::PORTUGUESE)
|
55
|
+
translated_song.name.should == "Os Imperdoáveis"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://www.vagalume.com.br/api/search.php?art=Metallica&mus=The%20Unforgiven
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Server:
|
20
|
+
- nginx
|
21
|
+
Content-Type:
|
22
|
+
- application/x-javascript; charset=UTF-8
|
23
|
+
Keep-Alive:
|
24
|
+
- timeout=60
|
25
|
+
Vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
Expires:
|
28
|
+
- Mon, 09 Jul 2012 22:38:58 GMT
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=30
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- ! '*'
|
33
|
+
X-Count:
|
34
|
+
- '4'
|
35
|
+
X-Powered-By:
|
36
|
+
- Vagalume
|
37
|
+
Transfer-Encoding:
|
38
|
+
- chunked
|
39
|
+
Date:
|
40
|
+
- Mon, 09 Jul 2012 22:38:28 GMT
|
41
|
+
X-Varnish:
|
42
|
+
- '2281949281'
|
43
|
+
Age:
|
44
|
+
- '0'
|
45
|
+
Via:
|
46
|
+
- 1.1 varnish
|
47
|
+
Connection:
|
48
|
+
- keep-alive
|
49
|
+
body:
|
50
|
+
encoding: US-ASCII
|
51
|
+
string: ! '{"type":"exact","art":{"id":"3ade68b5g7257eda3","name":"Metallica","url":"http:\/\/www.vagalume.com.br\/metallica\/"},"mus":[{"id":"3ade68b6g470deda3","name":"The
|
52
|
+
Unforgiven","url":"http:\/\/www.vagalume.com.br\/metallica\/the-unforgiven.html","lang":2,"text":"New
|
53
|
+
blood joins this earth\nAnd quickly he''s subdued\nThrough constant pained
|
54
|
+
disgrace\nThe young boy learns their rules\n\nWith time the child draws in\nThis
|
55
|
+
whipping boy done wrong\nDeprived of all his thoughts\nThe young man struggles
|
56
|
+
on and on he''s known\nA vow unto his own\nThat never from this day\nHis will
|
57
|
+
they''ll take away\n\nWhat I''ve felt\nWhat I''ve known\nNever shined through
|
58
|
+
in what I''ve shown\nNever be\nNever see\nWon''t see what might have been\n\nWhat
|
59
|
+
I''ve felt\nWhat I''ve known\nNever shined through in what I''ve shown\nNever
|
60
|
+
free\nNever me\nSo I dub the unforgiven\n\nThey dedicate their lives\nTo running
|
61
|
+
all of his\nHe tries to please them all\nThis bitter man he is\nThroughout
|
62
|
+
his life the same\nHe''s battled constantly\nThis fight he cannot win\nA tired
|
63
|
+
man they see no longer cares\nThe old man then prepares\nTo die regretfully\nThat
|
64
|
+
old man here is me\n\nWhat I''ve felt\nWhat I''ve known\nNever shined through
|
65
|
+
in what I''ve shown\nNever be\nNever see\nWon''t see what might have been\n\nWhat
|
66
|
+
I''ve felt\nWhat I''ve known\nNever shined through in what I''ve shown\nNever
|
67
|
+
free\nNever me\nSo I dub the unforgiven\n\nWhat I''ve felt\nWhat I''ve known\nNever
|
68
|
+
shined through in what I''ve shown\nNever be\nNever see\nWon''t see what might
|
69
|
+
have been\n\nWhat I''ve felt\nWhat I''ve known\nNever shined through in what
|
70
|
+
I''ve shown\nNever free\nNever me\nSo I dub the unforgiven\n\nNever free\nNever
|
71
|
+
me\nSo I dub the unforgiven\n\nYou labeled me\nI''ll label you\nSo I dub the
|
72
|
+
unforgiven\n\nNever free\nNever me\nSo I dub the unforgiven\n\nYou labeled
|
73
|
+
me\nI''ll label you\nSo I dub the unforgiven","translate":[{"id":"3ade68b6gf3b9fda3","lang":1,"url":"http:\/\/www.vagalume.com.br\/metallica\/the-unforgiven-traducao.html","text":"[Os
|
74
|
+
Imperdo\u00e1veis]\n\nSangue novo se junta a esta terra\nE rapidamente ele
|
75
|
+
\u00e9 subjugado\nAtravessando constante e dolorosa desgra\u00e7a\nO jovem
|
76
|
+
garoto aprende suas regras\n\nCom o tempo a crian\u00e7a \u00e9 enganada\nEste
|
77
|
+
rapaz subjugado fez errado\nDesprovido de todos os seus pensamentos\nO jovem
|
78
|
+
homem aguenta e aguenta, ele sabe\nUm juramento para si mesmo\nQue nunca a
|
79
|
+
partir deste dia\nEles v\u00e3o tirar o seu desejo\n\nO que eu senti\nO que
|
80
|
+
eu soube\nNunca transpareceu no que eu mostrei\nNunca ser\nNunca ver\nN\u00e3o
|
81
|
+
verei o que poderia ter sido\n\nO que eu senti\nO que eu soube\nNunca transpareceu
|
82
|
+
no que eu mostrei\nNunca livre\nNunca eu mesmo\nEnt\u00e3o eu os nomeio imperdo\u00e1veis\n\nEles
|
83
|
+
dedicaram suas vidas\nA tomar tudo deles\nEle tenta satisfazer a todos\nEste
|
84
|
+
homem amargo ele se torna\nPor toda a sua vida o mesmo\nEle lutou constantemente\nEsta
|
85
|
+
luta ele n\u00e3o pode vencer\nUm homem cansado eles v\u00eaem, n\u00e3o importa
|
86
|
+
mais\nO velho homem ent\u00e3o se prepara\nPara morrer cheio de arrependimentos\nEste
|
87
|
+
velho homem aqui sou eu\n\nO que eu senti\nO que eu soube\nNunca apareceram
|
88
|
+
no que eu mostrei\nNunca ser\nNunca ver\nN\u00e3o ver o que poderia ter sido\n\nO
|
89
|
+
que eu senti\nO que eu soube\nNunca apareceram no que eu mostrei\nNunca livre\nNunca
|
90
|
+
eu mesmo\nEnt\u00e3o eu os nomeio imperdo\u00e1veis\n\nO que eu senti\nO que
|
91
|
+
eu soube\nNunca apareceram no que eu mostrei\nNunca ser\nNunca ver\nN\u00e3o
|
92
|
+
ver o que poderia ter sido\n\nO que eu senti\nO que eu soube\nNunca apareceram
|
93
|
+
no que eu mostrei\nNunca livre\nNunca eu mesmo\nEnt\u00e3o eu os nomeio imperdo\u00e1veis\n\nNunca
|
94
|
+
livre\nNunca eu mesmo\nEnt\u00e3o eu os nomeio imperdo\u00e1veis\n\nVoc\u00eas
|
95
|
+
me rotularam\nEu rotularei voc\u00eas\nEnt\u00e3o eu os nomeio imperdo\u00e1veis\n\nNunca
|
96
|
+
livre\nNunca eu mesmo\nEnt\u00e3o eu os nomeio imperdo\u00e1veis\n\nVoc\u00eas
|
97
|
+
me rotularam\nEu rotularei voc\u00eas\nEnt\u00e3o eu os nomeio imperdo\u00e1veis"}]}]}'
|
98
|
+
http_version:
|
99
|
+
recorded_at: Mon, 09 Jul 2012 22:38:28 GMT
|
100
|
+
recorded_with: VCR 2.2.2
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://www.vagalume.com.br/api/search.php?art=Oops&mus=Oops
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Server:
|
20
|
+
- nginx
|
21
|
+
Content-Type:
|
22
|
+
- application/x-javascript; charset=UTF-8
|
23
|
+
Keep-Alive:
|
24
|
+
- timeout=60
|
25
|
+
Vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
Expires:
|
28
|
+
- Mon, 09 Jul 2012 22:38:58 GMT
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=30
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- ! '*'
|
33
|
+
X-Count:
|
34
|
+
- '4'
|
35
|
+
X-Powered-By:
|
36
|
+
- Vagalume
|
37
|
+
Transfer-Encoding:
|
38
|
+
- chunked
|
39
|
+
Date:
|
40
|
+
- Mon, 09 Jul 2012 22:38:28 GMT
|
41
|
+
X-Varnish:
|
42
|
+
- '2629115666'
|
43
|
+
Age:
|
44
|
+
- '0'
|
45
|
+
Via:
|
46
|
+
- 1.1 varnish
|
47
|
+
Connection:
|
48
|
+
- keep-alive
|
49
|
+
body:
|
50
|
+
encoding: US-ASCII
|
51
|
+
string: ! '{"type":"notfound"}'
|
52
|
+
http_version:
|
53
|
+
recorded_at: Mon, 09 Jul 2012 22:38:28 GMT
|
54
|
+
recorded_with: VCR 2.2.2
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://www.vagalume.com.br/api/search.php?art=Metallica&mus=Oops
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Server:
|
20
|
+
- nginx
|
21
|
+
Content-Type:
|
22
|
+
- application/x-javascript; charset=UTF-8
|
23
|
+
Keep-Alive:
|
24
|
+
- timeout=60
|
25
|
+
Vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
Expires:
|
28
|
+
- Mon, 09 Jul 2012 22:38:58 GMT
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=30
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- ! '*'
|
33
|
+
X-Count:
|
34
|
+
- '4'
|
35
|
+
X-Powered-By:
|
36
|
+
- Vagalume
|
37
|
+
Transfer-Encoding:
|
38
|
+
- chunked
|
39
|
+
Date:
|
40
|
+
- Mon, 09 Jul 2012 22:38:28 GMT
|
41
|
+
X-Varnish:
|
42
|
+
- '2281949327'
|
43
|
+
Age:
|
44
|
+
- '0'
|
45
|
+
Via:
|
46
|
+
- 1.1 varnish
|
47
|
+
Connection:
|
48
|
+
- keep-alive
|
49
|
+
body:
|
50
|
+
encoding: US-ASCII
|
51
|
+
string: ! '{"type":"song_notfound","art":{"id":"3ade68b5g7257eda3","name":"Metallica","url":"http:\/\/www.vagalume.com.br\/metallica\/"}}'
|
52
|
+
http_version:
|
53
|
+
recorded_at: Mon, 09 Jul 2012 22:38:28 GMT
|
54
|
+
recorded_with: VCR 2.2.2
|
data/spec/spec_helper.rb
ADDED
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'vagalume'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
data/vagalume.gemspec
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "vagalume"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Brian Thomas Storti"]
|
12
|
+
s.date = "2012-07-10"
|
13
|
+
s.description = "Ruby interface for the Vagalume API"
|
14
|
+
s.email = "btstorti@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/vagalume.rb",
|
28
|
+
"lib/vagalume/artist.rb",
|
29
|
+
"lib/vagalume/core_ext/array.rb",
|
30
|
+
"lib/vagalume/language.rb",
|
31
|
+
"lib/vagalume/search_result.rb",
|
32
|
+
"lib/vagalume/song.rb",
|
33
|
+
"lib/vagalume/status.rb",
|
34
|
+
"spec/assets/unforgiven_lyric.txt",
|
35
|
+
"spec/assets/unforgiven_lyric_translation_pt.txt",
|
36
|
+
"spec/base_spec.rb",
|
37
|
+
"spec/fixtures/vcr_cassettes/vagalume.yml",
|
38
|
+
"spec/fixtures/vcr_cassettes/vagalume_not_found.yml",
|
39
|
+
"spec/fixtures/vcr_cassettes/vagalume_song_not_found.yml",
|
40
|
+
"spec/spec_helper.rb",
|
41
|
+
"test/helper.rb",
|
42
|
+
"test/test_vagalume.rb",
|
43
|
+
"vagalume.gemspec"
|
44
|
+
]
|
45
|
+
s.homepage = "http://github.com/brianstorti/vagalume"
|
46
|
+
s.licenses = ["MIT"]
|
47
|
+
s.require_paths = ["lib"]
|
48
|
+
s.rubygems_version = "1.8.10"
|
49
|
+
s.summary = "Ruby interface for the Vagalume API"
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_runtime_dependency(%q<multi_json>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
57
|
+
s.add_development_dependency(%q<vcr>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<webmock>, [">= 0"])
|
60
|
+
s.add_runtime_dependency(%q<multi_json>, [">= 0"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
63
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
64
|
+
s.add_dependency(%q<vcr>, [">= 0"])
|
65
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
66
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
67
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
71
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
72
|
+
s.add_dependency(%q<vcr>, [">= 0"])
|
73
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
74
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
75
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagalume
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brian Thomas Storti
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: multi_json
|
16
|
+
requirement: &2156966340 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2156966340
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jeweler
|
27
|
+
requirement: &2156980800 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.8.4
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2156980800
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: vcr
|
38
|
+
requirement: &2156979820 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2156979820
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: &2156977940 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2156977940
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: webmock
|
60
|
+
requirement: &2156975860 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2156975860
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: multi_json
|
71
|
+
requirement: &2156973300 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *2156973300
|
80
|
+
description: Ruby interface for the Vagalume API
|
81
|
+
email: btstorti@gmail.com
|
82
|
+
executables: []
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files:
|
85
|
+
- LICENSE.txt
|
86
|
+
- README.rdoc
|
87
|
+
files:
|
88
|
+
- .document
|
89
|
+
- Gemfile
|
90
|
+
- Gemfile.lock
|
91
|
+
- LICENSE.txt
|
92
|
+
- README.rdoc
|
93
|
+
- Rakefile
|
94
|
+
- VERSION
|
95
|
+
- lib/vagalume.rb
|
96
|
+
- lib/vagalume/artist.rb
|
97
|
+
- lib/vagalume/core_ext/array.rb
|
98
|
+
- lib/vagalume/language.rb
|
99
|
+
- lib/vagalume/search_result.rb
|
100
|
+
- lib/vagalume/song.rb
|
101
|
+
- lib/vagalume/status.rb
|
102
|
+
- spec/assets/unforgiven_lyric.txt
|
103
|
+
- spec/assets/unforgiven_lyric_translation_pt.txt
|
104
|
+
- spec/base_spec.rb
|
105
|
+
- spec/fixtures/vcr_cassettes/vagalume.yml
|
106
|
+
- spec/fixtures/vcr_cassettes/vagalume_not_found.yml
|
107
|
+
- spec/fixtures/vcr_cassettes/vagalume_song_not_found.yml
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- test/helper.rb
|
110
|
+
- test/test_vagalume.rb
|
111
|
+
- vagalume.gemspec
|
112
|
+
homepage: http://github.com/brianstorti/vagalume
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
hash: -650469950274153402
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 1.8.10
|
137
|
+
signing_key:
|
138
|
+
specification_version: 3
|
139
|
+
summary: Ruby interface for the Vagalume API
|
140
|
+
test_files: []
|