Documentation ¶
Index ¶
Constants ¶
const (
// MaxTracksPerScrobble is the maximum number of tracks that can be included in a single request to Scrobble
MaxTracksPerScrobble = 50
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) LoveTrack ¶
LoveTrack calls https://www.last.fm/api/show/track.love
func (*API) Scrobble ¶
Scrobble sends the provided track and all other pending scrobbles to https://www.last.fm/api/show/track.scrobble
func (*API) UnLoveTrack ¶
UnLoveTrack calls https://www.last.fm/api/show/track.unlove
func (*API) UpdateNowPlaying ¶
UpdateNowPlaying calls https://www.last.fm/api/show/track.updateNowPlaying
type FeedbackProvider ¶
type FeedbackProvider interface { // LoveTrack should be called for tracks that have received a Thumbs-Up from the user LoveTrack(ctx context.Context, t pianobar.Track) error // UnLoveTrack should be called for tracks that have been banned or un-loved by the user UnLoveTrack(ctx context.Context, t pianobar.Track) error }
FeedbackProvider provides a way to translate pandora feedback on tracks to Last.FM
type ScrobbleResult ¶
type Scrobbler ¶
type Scrobbler interface { // Scrobble emits the specified tracks to Last.FM's track.Scrobble API. Tracks must meet the following criteria to be // accepted by Last.FM: // // * The track must be at least 30s long // * The track must have been played for at least half of its duration, or for at least 4 minutes // // These criteria should be checked by the caller before calling Scrobble. // // Any non-terminal error should save the tracks to be retried on the next scrobble request. Up to 50 tracks may be // queued for a single request. If the provided context is cancelled before the request can be made to Last.FM's API // it will be retried on the next request. If it is cancelled after the request has been sent but before the // response can be read, it will not be retried later. Scrobble(ctx context.Context, t ...pianobar.Track) error // UpdateNowPlaying submits the specified track to Last.FM's track.updateNowPlaying API UpdateNowPlaying(ctx context.Context, t pianobar.Track) error }
Scrobbler sends track information to the Last.FM API as Scrobbles. It also provides a way to notify Last.FM of the track a user is currently listening to. If Scrobble returns a non-terminal error, the provided track is saved and re-tried on the next scrobble. The Last.FM API accepts up to 50 tracks in one scrobble request.