rockstar 0.7.0 → 0.7.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/README.md +26 -0
- data/VERSION +1 -1
- data/examples/geo.rb +51 -0
- data/lib/rockstar/geo.rb +27 -0
- data/rockstar.gemspec +4 -2
- data/test/fixtures/xml/geo/gettopartists_country_spain_limit_50_page_.xml +561 -0
- data/test/fixtures/xml/geo/gettoptracks_country_spain_limit_50_page_.xml +1004 -0
- data/test/unit/test_geo.rb +26 -0
- metadata +5 -3
data/README.md
CHANGED
@@ -91,6 +91,32 @@ object, you have to add `:include_info => true` .
|
|
91
91
|
# To get a list of possible locations use
|
92
92
|
geo.metros("germany").each{|m| p m.name}
|
93
93
|
|
94
|
+
# Retrieve list of top tracks by country
|
95
|
+
geo.toptracks('united kingdom', 10).each{|t| p "#{t.name} by #{t.artist}"}
|
96
|
+
|
97
|
+
# Retrieve list of top artists by country
|
98
|
+
geo.topartists('united kingdom', 10).each{|a| p "artist #{a.name} with #{a.listenercount} listeners"}
|
99
|
+
|
100
|
+
|
101
|
+
## Library
|
102
|
+
|
103
|
+
# Get artists and albums for user
|
104
|
+
library = Rockstar::Library.new
|
105
|
+
|
106
|
+
puts 'Artists'
|
107
|
+
library.artists(false, :user => 'jnunemaker').each { |a| puts a.name }
|
108
|
+
|
109
|
+
puts 'Albums'
|
110
|
+
library.albums(false, :user => 'jnunemaker').each { |a| puts a.name }
|
111
|
+
|
112
|
+
# Get it with Rockstar::User
|
113
|
+
user = Rockstar::User.new('jnunemaker')
|
114
|
+
|
115
|
+
puts 'Artists'
|
116
|
+
user.artists.each { |a| puts a.name }
|
117
|
+
|
118
|
+
puts 'Albums'
|
119
|
+
user.albums.each { |a| puts a.name }
|
94
120
|
|
95
121
|
## Get rights to access the user data for scrobbing, now playing, events etc...
|
96
122
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.1
|
data/examples/geo.rb
CHANGED
@@ -7,3 +7,54 @@ Rockstar.lastfm = YAML.load_file(File.join(File.dirname(__FILE__), 'lastfm.yml')
|
|
7
7
|
geo = Rockstar::Geo.new
|
8
8
|
|
9
9
|
geo.events(:location => 'london').each{|e| p "#{e.title} at #{e.venue.name}"}
|
10
|
+
|
11
|
+
|
12
|
+
# Get Top Tracks by country of the last week
|
13
|
+
#<toptracks country="Spain">
|
14
|
+
# <track rank="1">
|
15
|
+
# <name>Violet Hill</name>
|
16
|
+
# <playcount>1055</playcount>
|
17
|
+
# <mbid/>
|
18
|
+
# <url>http://www.last.fm/music/Coldplay/_/Violet+Hill</url>
|
19
|
+
# <streamable fulltrack="0">1</streamable>
|
20
|
+
# <artist>
|
21
|
+
# <name>Coldplay</name>
|
22
|
+
# <mbid>cc197bad-dc9c-440d-a5b5-d52ba2e14234</mbid>
|
23
|
+
# <url>http://www.last.fm/music/Coldplay</url>
|
24
|
+
# </artist>
|
25
|
+
# <image size="small">...</image>
|
26
|
+
# <image size="medium">...</image>
|
27
|
+
# <image size="large">...</image>
|
28
|
+
# </track>
|
29
|
+
# ...
|
30
|
+
#</toptracks>
|
31
|
+
geo.toptracks('united kingdom', 10).each{|t| p "#{t.name} by #{t.artist}"}
|
32
|
+
|
33
|
+
|
34
|
+
#Get the most popular artists on Last.fm by country
|
35
|
+
#<topartists country="Spain" page="1" perPage="50" totalPages="10" total="500">
|
36
|
+
#
|
37
|
+
# <artist rank="1">
|
38
|
+
# <name>Muse</name>
|
39
|
+
# <listeners>1736</listeners>
|
40
|
+
# <mbid>1695c115-bf3f-4014-9966-2b0c50179193</mbid>
|
41
|
+
# <url>http://www.last.fm/music/Muse</url>
|
42
|
+
# <streamable>1</streamable>
|
43
|
+
# <image size="small">http://userserve-ak.last.fm/serve/34/416065.jpg</image>
|
44
|
+
# <image size="medium">http://userserve-ak.last.fm/serve/64/416065.jpg</image>
|
45
|
+
# <image size="large">http://userserve-ak.last.fm/serve/126/416065.jpg</image>
|
46
|
+
# <image size="extralarge">http://userserve-ak.last.fm/serve/252/416065.jpg</image>
|
47
|
+
# <image size="mega">http://userserve-ak.last.fm/serve/500/416065/Muse.jpg</image>
|
48
|
+
# </artist> <artist rank="2">
|
49
|
+
# <name>Coldplay</name>
|
50
|
+
# <listeners>1497</listeners>
|
51
|
+
# <mbid>cc197bad-dc9c-440d-a5b5-d52ba2e14234</mbid>
|
52
|
+
# <url>http://www.last.fm/music/Coldplay</url>
|
53
|
+
# <streamable>1</streamable>
|
54
|
+
# <image size="small">http://userserve-ak.last.fm/serve/34/210303.jpg</image>
|
55
|
+
# <image size="medium">http://userserve-ak.last.fm/serve/64/210303.jpg</image>
|
56
|
+
# <image size="large">http://userserve-ak.last.fm/serve/126/210303.jpg</image>
|
57
|
+
# <image size="extralarge">http://userserve-ak.last.fm/serve/252/210303.jpg</image>
|
58
|
+
# <image size="mega">http://userserve-ak.last.fm/serve/500/210303/Coldplay.jpg</image>
|
59
|
+
# </artist> <a
|
60
|
+
geo.topartists('united kingdom', 10).each{|a| p "artist #{a.name} with #{a.listenercount} listeners"}
|
data/lib/rockstar/geo.rb
CHANGED
@@ -16,5 +16,32 @@ module Rockstar
|
|
16
16
|
get_instance("geo.getMetros", :metros, :metro, {:country => country}, force)
|
17
17
|
end
|
18
18
|
|
19
|
+
|
20
|
+
|
21
|
+
# Get a list of the Top Artists for a specified country
|
22
|
+
#
|
23
|
+
# Country is specified in last.fm API docs as 'A country name, as defined by the ISO 3166-1 country names standard'
|
24
|
+
# Not sure of the coverage
|
25
|
+
#
|
26
|
+
# Also specify limit and page to page through full resultset
|
27
|
+
#
|
28
|
+
# returns array of Artist instances
|
29
|
+
def topartists(country, limit = nil, page = nil, force = false)
|
30
|
+
get_instance("geo.getTopArtists", :topartists, :artist, {:country => country, :limit => limit, :page => page}, force)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get a list of the Top Tracks for a specified country
|
34
|
+
#
|
35
|
+
# Country is specified in last.fm API docs as 'A country name, as defined by the ISO 3166-1 country names standard'
|
36
|
+
# Not sure of the coverage
|
37
|
+
#
|
38
|
+
# Also specify limit and page to page through full resultset
|
39
|
+
#
|
40
|
+
# returns array of Track instances
|
41
|
+
# TODO: is this the correct object to return? We dont have the full data so is this really best
|
42
|
+
def toptracks(country, limit = nil, page = nil, force = false)
|
43
|
+
get_instance("geo.getTopTracks", :toptracks, :track, {:country => country, :limit => limit, :page => page}, force)
|
44
|
+
end
|
45
|
+
|
19
46
|
end
|
20
47
|
end
|
data/rockstar.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rockstar"
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bodo Tasche"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-02-19"
|
13
13
|
s.description = "This gem is an updated version of jnunemakers scrobbler gem. Rockstar uses v2.0 of the last.fm api."
|
14
14
|
s.email = "bodo@putpat.tv"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -65,6 +65,8 @@ Gem::Specification.new do |s|
|
|
65
65
|
"test/fixtures/xml/artist/gettoptracks_artist_Metallica.xml",
|
66
66
|
"test/fixtures/xml/geo/getevents_location_london.xml",
|
67
67
|
"test/fixtures/xml/geo/getmetros_country_germany.xml",
|
68
|
+
"test/fixtures/xml/geo/gettopartists_country_spain_limit_50_page_.xml",
|
69
|
+
"test/fixtures/xml/geo/gettoptracks_country_spain_limit_50_page_.xml",
|
68
70
|
"test/fixtures/xml/library/getalbums_user_jnunemaker.xml",
|
69
71
|
"test/fixtures/xml/library/getartists_user_jnunemaker.xml",
|
70
72
|
"test/fixtures/xml/tag/gettopalbums_tag_rock.xml",
|