Class: Shortwave::Facade::Track
- Defined in:
- lib/shortwave/facade/lastfm.rb
Instance Attribute Summary
Attributes inherited from Remote
Instance Method Summary collapse
-
#add_tags(artist, track, tags) ⇒ Object
Tag an album using a list of user supplied tags.
-
#ban(track, artist) ⇒ Object
Ban a track for a given user profile.
-
#info(options = {}) ⇒ Object
Get the metadata for a track on Last.fm using the artist/track name or a musicbrainz id.
-
#love(track, artist) ⇒ Object
Love a track for a user profile.
-
#remove_tag(artist, track, tags) ⇒ Object
Remove a user’s tag from a track.
-
#search(track, options = {}) ⇒ Object
Search for a track by track name.
-
#share(artist, recipient, track, options = {}) ⇒ Object
Share a track twith one or more Last.fm users or other friends.
-
#similar(options = {}) ⇒ Object
Get the similar tracks for this track on Last.fm, based on listening data.
-
#tags(artist, track) ⇒ Object
Get the tags applied by an individual user to a track on Last.fm.
-
#top_fans(options = {}) ⇒ Object
Get the top fans for this track on Last.fm, based on listening data.
-
#top_tags(options = {}) ⇒ Object
Get the top tags for this track on Last.fm, ordered by tag count.
Methods inherited from Remote
Constructor Details
This class inherits a constructor from Shortwave::Facade::Remote
Instance Method Details
#add_tags(artist, track, tags) ⇒ Object
Tag an album using a list of user supplied tags.
artist
-
The artist name in question
track
-
The track name in question
tags
-
A comma delimited list of user supplied tags to apply to this track. Accepts a maximum of 10 tags.
43 44 45 |
# File 'lib/shortwave/facade/lastfm.rb', line 43 def (artist, track, ) post(:session, {:method => "track.addTags", :artist => artist, :track => track, :tags => }) end |
#ban(track, artist) ⇒ Object
Ban a track for a given user profile. This needs to be supplemented with a scrobbling submission containing the ‘ban’ rating (see the audioscrobbler API).
track
-
A track name (utf8 encoded)
artist
-
An artist name (utf8 encoded)
79 80 81 |
# File 'lib/shortwave/facade/lastfm.rb', line 79 def ban(track, artist) post(:session, {:method => "track.ban", :track => track, :artist => artist}) end |
#info(options = {}) ⇒ Object
Get the metadata for a track on Last.fm using the artist/track name or a musicbrainz id.
Options
artist
-
The artist name in question
track
-
The track name in question
mbid
-
The musicbrainz id for the track
53 54 55 |
# File 'lib/shortwave/facade/lastfm.rb', line 53 def info(={}) get(:standard, {:method => "track.getInfo"}.merge()) end |
#love(track, artist) ⇒ Object
Love a track for a user profile. This needs to be supplemented with a scrobbling submission containing the ‘love’ rating (see the audioscrobbler API).
track
-
A track name (utf8 encoded)
artist
-
An artist name (utf8 encoded)
13 14 15 |
# File 'lib/shortwave/facade/lastfm.rb', line 13 def love(track, artist) post(:session, {:method => "track.love", :track => track, :artist => artist}) end |
#remove_tag(artist, track, tags) ⇒ Object
Remove a user’s tag from a track.
artist
-
The artist name in question
track
-
The track name in question
tags
-
A single user tag to remove from this track.
22 23 24 |
# File 'lib/shortwave/facade/lastfm.rb', line 22 def remove_tag(artist, track, ) post(:session, {:method => "track.removeTag", :artist => artist, :track => track, :tags => }) end |
#search(track, options = {}) ⇒ Object
Search for a track by track name. Returns track matches sorted by relevance.
track
-
The track name in question.
Options
limit
-
Limit the number of tracks returned at one time. Default (maximum) is 30.
page
-
Scan into the results by specifying a page number. Defaults to first page.
artist
-
Narrow your search by specifying an artist.
34 35 36 |
# File 'lib/shortwave/facade/lastfm.rb', line 34 def search(track, ={}) get(:standard, {:method => "track.search", :track => track}.merge()) end |
#share(artist, recipient, track, options = {}) ⇒ Object
Share a track twith one or more Last.fm users or other friends.
artist
-
An artist name.
recipient
-
Email Address | Last.fm Username - A comma delimited list of email addresses or Last.fm usernames. Maximum is 10.
track
-
A track name.
Options
message
-
An optional message to send with the recommendation. If not supplied a default message will be used.
111 112 113 |
# File 'lib/shortwave/facade/lastfm.rb', line 111 def share(artist, recipient, track, ={}) post(:session, {:method => "track.share", :artist => artist, :recipient => recipient, :track => track}.merge()) end |
#similar(options = {}) ⇒ Object
Get the similar tracks for this track on Last.fm, based on listening data.
Options
track
-
The track name in question
artist
-
The artist name in question
mbid
-
The musicbrainz id for the track
99 100 101 |
# File 'lib/shortwave/facade/lastfm.rb', line 99 def similar(={}) get(:standard, {:method => "track.getSimilar"}.merge()) end |
#tags(artist, track) ⇒ Object
Get the tags applied by an individual user to a track on Last.fm.
artist
-
The artist name in question
track
-
The track name in question
61 62 63 |
# File 'lib/shortwave/facade/lastfm.rb', line 61 def (artist, track) get(:session, {:method => "track.getTags", :artist => artist, :track => track}) end |
#top_fans(options = {}) ⇒ Object
Get the top fans for this track on Last.fm, based on listening data. Supply either track & artist name or musicbrainz id.
Options
track
-
The track name in question
artist
-
The artist name in question
mbid
-
The musicbrainz id for the track
71 72 73 |
# File 'lib/shortwave/facade/lastfm.rb', line 71 def top_fans(={}) get(:standard, {:method => "track.getTopFans"}.merge()) end |
#top_tags(options = {}) ⇒ Object
Get the top tags for this track on Last.fm, ordered by tag count. Supply either track & artist name or mbid.
Options
track
-
The track name in question
artist
-
The artist name in question
mbid
-
The musicbrainz id for the track
89 90 91 |
# File 'lib/shortwave/facade/lastfm.rb', line 89 def (={}) get(:standard, {:method => "track.getTopTags"}.merge()) end |