Documentation ¶
Index ¶
- Constants
- Variables
- func GetParamSignature(params url.Values, secret string) string
- type Album
- type Artist
- type ArtistBio
- type ArtistTag
- type Client
- func (c *Client) AlbumGetInfo(artistName, albumName string) (Album, error)
- func (c *Client) ArtistGetInfo(artistName string) (Artist, error)
- func (c *Client) ArtistGetSimilar(artistName string) (SimilarArtists, error)
- func (c *Client) ArtistGetTopTracks(artistName string) (TopTracks, error)
- func (c *Client) GetCurrentUser(user *db.User) (User, error)
- func (c *Client) GetSession(token string) (string, error)
- func (c *Client) IsUserAuthenticated(user db.User) bool
- func (c *Client) LoveTrack(user *db.User, track *db.Track) error
- func (c *Client) Scrobble(user db.User, track scrobble.Track, stamp time.Time, submission bool) error
- func (c *Client) StealArtistImage(artistURL string) (string, error)
- func (c *Client) TrackGetSimilarTracks(artistName, trackName string) (SimilarTracks, error)
- func (c *Client) UserGetLovedTracks(userName string) (LovedTracks, error)
- type Error
- type Image
- type KeySecretFunc
- type LastFM
- type LovedTracks
- type Session
- type SimilarArtist
- type SimilarArtists
- type SimilarTracks
- type TopTracks
- type Track
- type User
Constants ¶
View Source
const (
BaseURL = "https://ws.audioscrobbler.com/2.0/"
)
Variables ¶
View Source
var ( ErrLastFM = errors.New("last.fm error") ErrNoUserSession = errors.New("no lastfm user session present") )
Functions ¶
Types ¶
type Album ¶
type Album struct { XMLName xml.Name `xml:"album"` Name string `xml:"name"` Artist string `xml:"artist"` MBID string `xml:"mbid"` URL string `xml:"url"` Image []struct { Text string `xml:",chardata"` Size string `xml:"size,attr"` } `xml:"image"` Listeners string `xml:"listeners"` Playcount string `xml:"playcount"` Tracks struct { Text string `xml:",chardata"` Track []struct { Text string `xml:",chardata"` Rank string `xml:"rank,attr"` Name string `xml:"name"` URL string `xml:"url"` Duration string `xml:"duration"` Streamable struct { Text string `xml:",chardata"` Fulltrack string `xml:"fulltrack,attr"` } `xml:"streamable"` Artist struct { Text string `xml:",chardata"` Name string `xml:"name"` Mbid string `xml:"mbid"` URL string `xml:"url"` } `xml:"artist"` } `xml:"track"` } `xml:"tracks"` Tags struct { Text string `xml:",chardata"` Tag []struct { Text string `xml:",chardata"` Name string `xml:"name"` URL string `xml:"url"` } `xml:"tag"` } `xml:"tags"` Wiki struct { Text string `xml:",chardata"` Published string `xml:"published"` Summary string `xml:"summary"` Content string `xml:"content"` } `xml:"wiki"` }
type Artist ¶
type Artist struct { XMLName xml.Name `xml:"artist"` Name string `xml:"name"` MBID string `xml:"mbid"` URL string `xml:"url"` Image []Image `xml:"image"` Streamable string `xml:"streamable"` Stats struct { Listeners string `xml:"listeners"` Playcount string `xml:"playcount"` } `xml:"stats"` Similar struct { Artists []Artist `xml:"artist"` } `xml:"similar"` Tags struct { Tag []ArtistTag `xml:"tag"` } `xml:"tags"` Bio ArtistBio `xml:"bio"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(keySecret KeySecretFunc) *Client
func NewClientCustom ¶
func NewClientCustom(httpClient *http.Client, keySecret KeySecretFunc) *Client
func (*Client) AlbumGetInfo ¶
func (*Client) ArtistGetSimilar ¶
func (c *Client) ArtistGetSimilar(artistName string) (SimilarArtists, error)
func (*Client) ArtistGetTopTracks ¶
func (*Client) StealArtistImage ¶
func (*Client) TrackGetSimilarTracks ¶
func (c *Client) TrackGetSimilarTracks(artistName, trackName string) (SimilarTracks, error)
func (*Client) UserGetLovedTracks ¶
func (c *Client) UserGetLovedTracks(userName string) (LovedTracks, error)
type KeySecretFunc ¶
type LastFM ¶
type LastFM struct { XMLName xml.Name `xml:"lfm"` Status string `xml:"status,attr"` Session Session `xml:"session"` Error Error `xml:"error"` Artist Artist `xml:"artist"` Album Album `xml:"album"` TopTracks TopTracks `xml:"toptracks"` SimilarTracks SimilarTracks `xml:"similartracks"` SimilarArtists SimilarArtists `xml:"similarartists"` LovedTracks LovedTracks `xml:"lovedtracks"` User User `xml:"user"` }
type LovedTracks ¶
type SimilarArtist ¶
type SimilarArtists ¶
type SimilarTracks ¶
type User ¶
type User struct { Text string `xml:",chardata"` Name string `xml:"name"` Realname string `xml:"realname"` Image []struct { Text string `xml:",chardata"` Size string `xml:"size,attr"` } `xml:"image"` URL string `xml:"url"` Country string `xml:"country"` Age string `xml:"age"` Gender string `xml:"gender"` Subscriber string `xml:"subscriber"` Playcount string `xml:"playcount"` Playlists string `xml:"playlists"` Bootstrap string `xml:"bootstrap"` Registered struct { Text string `xml:",chardata"` Unixtime string `xml:"unixtime,attr"` } `xml:"registered"` Type string `xml:"type"` ArtistCount string `xml:"artist_count"` AlbumCount string `xml:"album_count"` TrackCount string `xml:"track_count"` }
Click to show internal directories.
Click to hide internal directories.