pandora 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/lib/pandora/user.rb +43 -43
- data/lib/pandora/version.rb +1 -1
- data/pandora.gemspec +1 -2
- metadata +4 -8
data/README.md
CHANGED
@@ -13,14 +13,14 @@ Documentation
|
|
13
13
|
|
14
14
|
Usage
|
15
15
|
-----
|
16
|
-
This gem only works for public users. All users who did not set 'make my listening activity private'
|
16
|
+
This gem only works for public users. All users who did not set 'make my listening activity private'.
|
17
17
|
|
18
18
|
Usage Examples
|
19
19
|
--------------
|
20
20
|
require "rubygems"
|
21
21
|
require "pandora"
|
22
22
|
|
23
|
-
# Initialize a new User
|
23
|
+
# Initialize a new User with the Pandora username
|
24
24
|
user = Pandora::User.new("joe")
|
25
25
|
|
26
26
|
# Get a user's bookmarked songs
|
@@ -32,7 +32,7 @@ Usage Examples
|
|
32
32
|
# Get a user's stations
|
33
33
|
stations = user.stations # iterate over the stations array for each station
|
34
34
|
|
35
|
-
# Get a user's
|
35
|
+
# Get a user's now playing station
|
36
36
|
station = user.now_playing
|
37
37
|
|
38
38
|
# Get a user's recent activity
|
data/lib/pandora/user.rb
CHANGED
@@ -13,7 +13,7 @@ module Pandora
|
|
13
13
|
|
14
14
|
# Create a new user and make sure no whitespace, since it will be parsed as url in the request.
|
15
15
|
def initialize(user)
|
16
|
-
@user = user.strip
|
16
|
+
@user = user.downcase.strip
|
17
17
|
end
|
18
18
|
|
19
19
|
# == Returns the Bookmarked Songs
|
@@ -36,15 +36,15 @@ module Pandora
|
|
36
36
|
doc = request(@user, "favorites")
|
37
37
|
songs = []
|
38
38
|
doc.xpath('//rss/channel/item').each do |node|
|
39
|
-
songs << { :title => node.xpath('title').text,
|
40
|
-
:link => node.xpath('link').text,
|
41
|
-
:description => node.xpath('description').text,
|
42
|
-
:date => node.xpath('pubDate').text,
|
43
|
-
:track => node.xpath('mm:Track/dc:title').text,
|
44
|
-
:artist => node.xpath('mm:Artist/dc:title').text,
|
45
|
-
:album => node.xpath('mm:Album/dc:title').text,
|
46
|
-
:artwork => node.xpath('pandora:albumArtUrl').text,
|
47
|
-
:station => node.xpath('pandora:stationLink').text }
|
39
|
+
songs << { :title => node.xpath('title').text.strip,
|
40
|
+
:link => node.xpath('link').text.strip,
|
41
|
+
:description => node.xpath('description').text.strip,
|
42
|
+
:date => node.xpath('pubDate').text.strip,
|
43
|
+
:track => node.xpath('mm:Track/dc:title').text.strip,
|
44
|
+
:artist => node.xpath('mm:Artist/dc:title').text.strip,
|
45
|
+
:album => node.xpath('mm:Album/dc:title').text.strip,
|
46
|
+
:artwork => node.xpath('pandora:albumArtUrl').text.strip,
|
47
|
+
:station => node.xpath('pandora:stationLink').text.strip }
|
48
48
|
end
|
49
49
|
songs
|
50
50
|
end
|
@@ -65,12 +65,12 @@ module Pandora
|
|
65
65
|
doc = request(@user, "favoriteartists")
|
66
66
|
artists = []
|
67
67
|
doc.xpath('//rss/channel/item').each do |node|
|
68
|
-
artists << { :title => node.xpath('title').text,
|
69
|
-
:link => node.xpath('link').text,
|
70
|
-
:description => node.xpath('description').text,
|
71
|
-
:date => node.xpath('pubDate').text,
|
72
|
-
:artist => node.xpath('mm:Artist/dc:title').text,
|
73
|
-
:station => node.xpath('pandora:stationLink').text }
|
68
|
+
artists << { :title => node.xpath('title').text.strip,
|
69
|
+
:link => node.xpath('link').text.strip,
|
70
|
+
:description => node.xpath('description').text.strip,
|
71
|
+
:date => node.xpath('pubDate').text.strip,
|
72
|
+
:artist => node.xpath('mm:Artist/dc:title').text.strip,
|
73
|
+
:station => node.xpath('pandora:stationLink').text.strip }
|
74
74
|
end
|
75
75
|
artists
|
76
76
|
end
|
@@ -95,15 +95,15 @@ module Pandora
|
|
95
95
|
doc = request(@user, "stations")
|
96
96
|
stations = []
|
97
97
|
doc.xpath('//rss/channel/item').each do |node|
|
98
|
-
stations << { :title => node.xpath('title').text,
|
99
|
-
:link => node.xpath('link').text,
|
100
|
-
:description => node.xpath('description').text,
|
101
|
-
:date => node.xpath('pubDate').text,
|
102
|
-
:artwork => node.xpath('pandora:stationAlbumArtImageUrl').text,
|
103
|
-
:songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text,
|
104
|
-
:songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text,
|
105
|
-
:composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text,
|
106
|
-
:artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist')
|
98
|
+
stations << { :title => node.xpath('title').text.strip,
|
99
|
+
:link => node.xpath('link').text.strip,
|
100
|
+
:description => node.xpath('description').text.strip,
|
101
|
+
:date => node.xpath('pubDate').text.strip,
|
102
|
+
:artwork => node.xpath('pandora:stationAlbumArtImageUrl').text.strip,
|
103
|
+
:songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text.strip,
|
104
|
+
:songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text.strip,
|
105
|
+
:composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text.strip,
|
106
|
+
:artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist').text.strip}
|
107
107
|
end
|
108
108
|
stations
|
109
109
|
end
|
@@ -128,15 +128,15 @@ module Pandora
|
|
128
128
|
doc = request(@user, "nowplaying")
|
129
129
|
station = []
|
130
130
|
doc.xpath('//rss/channel/item').each do |node|
|
131
|
-
station << { :title => node.xpath('title').text,
|
132
|
-
:link => node.xpath('link').text,
|
133
|
-
:description => node.xpath('description').text,
|
134
|
-
:date => node.xpath('pubDate').text,
|
135
|
-
:artwork => node.xpath('pandora:stationAlbumArtImageUrl').text,
|
136
|
-
:songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text,
|
137
|
-
:songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text,
|
138
|
-
:composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text,
|
139
|
-
:artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist') }
|
131
|
+
station << { :title => node.xpath('title').text.strip,
|
132
|
+
:link => node.xpath('link').text.strip,
|
133
|
+
:description => node.xpath('description').text.strip,
|
134
|
+
:date => node.xpath('pubDate').text.strip,
|
135
|
+
:artwork => node.xpath('pandora:stationAlbumArtImageUrl').text.strip,
|
136
|
+
:songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text.strip,
|
137
|
+
:songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text.strip,
|
138
|
+
:composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text.strip,
|
139
|
+
:artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist').text.strip }
|
140
140
|
end
|
141
141
|
station
|
142
142
|
end
|
@@ -161,15 +161,15 @@ module Pandora
|
|
161
161
|
doc = request(@user, "recentactivity")
|
162
162
|
items = []
|
163
163
|
doc.xpath('//rss/channel/item').each do |node|
|
164
|
-
items << { :title => node.xpath('title').text,
|
165
|
-
:link => node.xpath('link').text,
|
166
|
-
:description => node.xpath('description').text,
|
167
|
-
:date => node.xpath('pubDate').text,
|
168
|
-
:track => node.xpath('mm:Track/dc:title').text,
|
169
|
-
:artist => node.xpath('mm:Artist/dc:title').text,
|
170
|
-
:album => node.xpath('mm:Album/dc:title').text,
|
171
|
-
:artwork => node.xpath('pandora:albumArtUrl').text,
|
172
|
-
:station => node.xpath('pandora:stationLink').text
|
164
|
+
items << { :title => node.xpath('title').text.strip,
|
165
|
+
:link => node.xpath('link').text.strip,
|
166
|
+
:description => node.xpath('description').text.strip,
|
167
|
+
:date => node.xpath('pubDate').text.strip,
|
168
|
+
:track => node.xpath('mm:Track/dc:title').text.strip,
|
169
|
+
:artist => node.xpath('mm:Artist/dc:title').text.strip,
|
170
|
+
:album => node.xpath('mm:Album/dc:title').text.strip,
|
171
|
+
:artwork => node.xpath('pandora:albumArtUrl').text.strip,
|
172
|
+
:station => node.xpath('pandora:stationLink').text.strip}
|
173
173
|
end
|
174
174
|
items
|
175
175
|
end
|
data/lib/pandora/version.rb
CHANGED
data/pandora.gemspec
CHANGED
@@ -9,8 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Anil"]
|
10
10
|
s.homepage = "http://github.com/anilv/pandora"
|
11
11
|
s.summary = %q{Get Music data from Pandora}
|
12
|
-
s.description = %q{
|
13
|
-
current station and list of the user created stations.}
|
12
|
+
s.description = %q{A Ruby wrapper for the Pandora public user feeds}
|
14
13
|
|
15
14
|
s.add_runtime_dependency 'nokogiri','~> 1.4'
|
16
15
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: pandora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Anil
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-06-02 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: nokogiri
|
@@ -24,9 +23,7 @@ dependencies:
|
|
24
23
|
version: "1.4"
|
25
24
|
type: :runtime
|
26
25
|
version_requirements: *id001
|
27
|
-
description:
|
28
|
-
With a given username get user's favorite artists, songs. Also recent acitvity,
|
29
|
-
current station and list of the user created stations.
|
26
|
+
description: A Ruby wrapper for the Pandora public user feeds
|
30
27
|
email:
|
31
28
|
executables: []
|
32
29
|
|
@@ -45,7 +42,6 @@ files:
|
|
45
42
|
- lib/pandora/user.rb
|
46
43
|
- lib/pandora/version.rb
|
47
44
|
- pandora.gemspec
|
48
|
-
has_rdoc: true
|
49
45
|
homepage: http://github.com/anilv/pandora
|
50
46
|
licenses: []
|
51
47
|
|
@@ -69,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
65
|
requirements: []
|
70
66
|
|
71
67
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.
|
68
|
+
rubygems_version: 1.8.5
|
73
69
|
signing_key:
|
74
70
|
specification_version: 3
|
75
71
|
summary: Get Music data from Pandora
|