gbv 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.
- checksums.yaml +15 -0
- data/bin/gbv +13 -0
- data/lib/gbv.rb +13 -0
- data/lib/gbv/version.rb +3 -0
- data/lib/song.rb +15 -0
- data/lib/song_fetcher.rb +36 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTMzNGJmZWQ5MmZjNDE1OTViZGQzZmJhYmI2MzkyZmJiOGM4MDRjNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTIwNWQzNWIzZGU0NTk3M2RlZGU5NjFhOGJhYzNlZWExZmYwNzU5NQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NDc2OWMwNThiYTAxMzAzNjhjNzIzODc2YjFlYmQzOTQ4Y2I5N2U4MDk2ODg1
|
10
|
+
MjM2ZWYzMzI2MGU5OWM0ZjlhOWExMDg5MmFiNDUxZWEzMDZlN2NlZjRkMWRj
|
11
|
+
MzYyNTE1OGVjZTg5ZmE1OGQxNGVjNmQ0ZmFhYzc3YjNiODExYTE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MGVhYjNjYjU1ZmM4NWY2MjRkZWQxMDA3YjgxYWI0YmEzZjc0ZWQzZGNkMWZk
|
14
|
+
ZTZiZTgyN2Q2MzFkMmVkYWM3ODU5YjRhNmI5YTFmNjU1ODZhNTkyOWViMWQ4
|
15
|
+
ZGVkMzAxMGNkZWJjZWE0ZDk3ZGUxM2RlN2Q3ZjA5YTc2Y2Q1MjQ=
|
data/bin/gbv
ADDED
data/lib/gbv.rb
ADDED
data/lib/gbv/version.rb
ADDED
data/lib/song.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
class Song
|
4
|
+
|
5
|
+
attr_accessor :lyrics
|
6
|
+
attr_accessor :title
|
7
|
+
|
8
|
+
def initialize(nokogiriDoc)
|
9
|
+
if nokogiriDoc
|
10
|
+
@lyrics = nokogiriDoc.css("textarea")[0].inner_text
|
11
|
+
@title = nokogiriDoc.css("h2")[0].inner_text
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
data/lib/song_fetcher.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class Gbv::SongFetcher
|
2
|
+
require 'httparty'
|
3
|
+
require 'uri'
|
4
|
+
require 'nokogiri'
|
5
|
+
require 'song'
|
6
|
+
|
7
|
+
# This, ladies and gentlemen, is weird, programatic code at its worst
|
8
|
+
def self.fetch_song(title)
|
9
|
+
begin
|
10
|
+
response = HTTParty.get(song_url(title))
|
11
|
+
|
12
|
+
if response.body.include?("No data found")
|
13
|
+
search_response = HTTParty.get(search_url(title))
|
14
|
+
song_node = Nokogiri::HTML(search_response).css("td a").find_all {|a| a['href'].include? "all=true" }.first
|
15
|
+
song = Song.new(Nokogiri::HTML(HTTParty.get(song_url(song_node.inner_text))))
|
16
|
+
else
|
17
|
+
song = Song.new(Nokogiri::HTML(response))
|
18
|
+
end
|
19
|
+
|
20
|
+
song
|
21
|
+
rescue Exception => e
|
22
|
+
return "Something went wrong. This thing is finicky about spelling. I'm not a scientist."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def self.song_url(title)
|
29
|
+
"http://gbvdb.com/track.asp?track=#{URI.encode(title)}&version=&live=False"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.search_url(title)
|
33
|
+
"http://gbvdb.com/tracks.asp?song_title=#{URI.encode(title)}"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gbv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- nodanaonlyzuul
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.6.6.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.6.6.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: httparty
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.13.3
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.13.3
|
83
|
+
description: The world's finest and only CLI tool for Guided By Voices lyrics.
|
84
|
+
email:
|
85
|
+
- beholdthepanda@gmail.com
|
86
|
+
executables:
|
87
|
+
- gbv
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- bin/gbv
|
92
|
+
- lib/gbv.rb
|
93
|
+
- lib/gbv/version.rb
|
94
|
+
- lib/song.rb
|
95
|
+
- lib/song_fetcher.rb
|
96
|
+
homepage: https://github.com/nodanaonlyzuul/gbv
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.4.5
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: A CLI tool for Guided By Voices Lyrics
|
120
|
+
test_files: []
|