|
1 |
| -=Scrobbler |
| 1 | += Scrobbler |
2 | 2 |
|
3 | 3 | Scrobbler is a wrapper for the audioscrobbler web services (http://www.audioscrobbler.net/data/webservices/).
|
4 | 4 |
|
5 | 5 | Below is just a sampling of how easy this lib is to use.
|
6 | 6 |
|
7 | 7 | == Users
|
8 | 8 |
|
9 |
| - user = Scrobbler::User.new('jnunemaker') |
| 9 | + user = Scrobbler::User.new('jnunemaker') |
10 | 10 |
|
11 |
| - puts "#{user.username}'s Recent Tracks" |
12 |
| - puts "=" * (user.username.length + 16) |
13 |
| - user.recent_tracks.each { |t| puts t.name } |
| 11 | + puts "#{user.username}'s Recent Tracks" |
| 12 | + puts "=" * (user.username.length + 16) |
| 13 | + user.recent_tracks.each { |t| puts t.name } |
14 | 14 |
|
15 |
| - puts |
16 |
| - puts |
| 15 | + puts |
| 16 | + puts |
17 | 17 |
|
18 |
| - puts "#{user.username}'s Top Tracks" |
19 |
| - puts "=" * (user.username.length + 13) |
20 |
| - user.top_tracks.each { |t| puts "(#{t.playcount}) #{t.name}" } |
21 |
| - |
| 18 | + puts "#{user.username}'s Top Tracks" |
| 19 | + puts "=" * (user.username.length + 13) |
| 20 | + user.top_tracks.each { |t| puts "(#{t.playcount}) #{t.name}" } |
| 21 | + |
22 | 22 | == Albums
|
23 |
| - |
24 |
| - album = Scrobbler::Album.new('Carrie Underwood', 'Some Hearts', :include_info => true) |
25 |
| - |
26 |
| - puts "Album: #{album.name}" |
27 |
| - puts "Artist: #{album.artist}" |
28 |
| - puts "Reach: #{album.reach}" |
29 |
| - puts "URL: #{album.url}" |
30 |
| - puts "Release Date: #{album.release_date.strftime('%m/%d/%Y')}" |
31 |
| - |
32 |
| - puts |
33 |
| - puts |
34 |
| - |
35 |
| - puts "Tracks" |
36 |
| - longest_track_name = album.tracks.collect(&:name).sort { |x, y| y.length <=> x.length }.first.length |
37 |
| - puts "=" * longest_track_name |
38 |
| - album.tracks.each { |t| puts t.name } |
39 |
| - |
40 |
| -==Artists |
41 |
| - |
42 |
| - artist = Scrobbler::Artist.new('Carrie Underwood') |
43 |
| - |
44 |
| - puts 'Top Tracks' |
45 |
| - puts "=" * 10 |
46 |
| - artist.top_tracks.each { |t| puts "(#{t.reach}) #{t.name}" } |
47 |
| - |
48 |
| - puts |
49 |
| - |
50 |
| - puts 'Similar Artists' |
51 |
| - puts "=" * 15 |
52 |
| - artist.similar.each { |a| puts "(#{a.match}%) #{a.name}" } |
53 |
| - |
54 |
| -==Tags |
55 |
| - |
56 |
| - tag = Scrobbler::Tag.new('country') |
57 |
| - |
58 |
| - puts 'Top Albums' |
59 |
| - tag.top_albums.each { |a| puts "(#{a.count}) #{a.name} by #{a.artist}" } |
60 |
| - |
61 |
| - puts |
62 |
| - |
63 |
| - puts 'Top Tracks' |
64 |
| - tag.top_tracks.each { |t| puts "(#{t.count}) #{t.name} by #{t.artist}" } |
65 |
| - |
66 |
| -==Tracks |
67 |
| - |
68 |
| - track = Scrobbler::Track.new('Carrie Underwood', 'Before He Cheats') |
69 |
| - puts 'Fans' |
70 |
| - puts "=" * 4 |
71 |
| - track.fans.each { |u| puts "(#{u.weight}) #{u.username}" } |
72 |
| - |
| 23 | + |
| 24 | + album = Scrobbler::Album.new('Carrie Underwood', 'Some Hearts', :include_info => true) |
| 25 | + |
| 26 | + puts "Album: #{album.name}" |
| 27 | + puts "Artist: #{album.artist}" |
| 28 | + puts "Reach: #{album.reach}" |
| 29 | + puts "URL: #{album.url}" |
| 30 | + puts "Release Date: #{album.release_date.strftime('%m/%d/%Y')}" |
| 31 | + |
| 32 | + puts |
| 33 | + puts |
| 34 | + |
| 35 | + puts "Tracks" |
| 36 | + longest_track_name = album.tracks.collect(&:name).sort { |x, y| y.length <=> x.length }.first.length |
| 37 | + puts "=" * longest_track_name |
| 38 | + album.tracks.each { |t| puts t.name } |
| 39 | + |
| 40 | +== Artists |
| 41 | + |
| 42 | + artist = Scrobbler::Artist.new('Carrie Underwood') |
| 43 | + |
| 44 | + puts 'Top Tracks' |
| 45 | + puts "=" * 10 |
| 46 | + artist.top_tracks.each { |t| puts "(#{t.reach}) #{t.name}" } |
| 47 | + |
| 48 | + puts |
| 49 | + |
| 50 | + puts 'Similar Artists' |
| 51 | + puts "=" * 15 |
| 52 | + artist.similar.each { |a| puts "(#{a.match}%) #{a.name}" } |
| 53 | + |
| 54 | +== Tags |
| 55 | + |
| 56 | + tag = Scrobbler::Tag.new('country') |
| 57 | + |
| 58 | + puts 'Top Albums' |
| 59 | + tag.top_albums.each { |a| puts "(#{a.count}) #{a.name} by #{a.artist}" } |
| 60 | + |
| 61 | + puts |
| 62 | + |
| 63 | + puts 'Top Tracks' |
| 64 | + tag.top_tracks.each { |t| puts "(#{t.count}) #{t.name} by #{t.artist}" } |
| 65 | + |
| 66 | +== Tracks |
| 67 | + |
| 68 | + track = Scrobbler::Track.new('Carrie Underwood', 'Before He Cheats') |
| 69 | + puts 'Fans' |
| 70 | + puts "=" * 4 |
| 71 | + track.fans.each { |u| puts "(#{u.weight}) #{u.username}" } |
| 72 | + |
73 | 73 | == Simple Authentication (for Scrobbling)
|
74 | 74 |
|
75 | 75 | auth = Scrobbler::SimpleAuth.new(:user => 'chunky', :password => 'bacon')
|
@@ -108,4 +108,4 @@ Below is just a sampling of how easy this lib is to use.
|
108 | 108 |
|
109 | 109 | == Docs
|
110 | 110 |
|
111 |
| -http://rdoc.info/projects/jnunemaker/scrobbler |
| 111 | +http://rdoc.info/projects/jnunemaker/scrobbler |
0 commit comments