lastfm

package
v0.0.0-...-7e69f2d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2017 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LfmHelp = []string{
	"fm set [name]    -- Sets a last.fm username in the local cache",
	"fm now                -- Looks up last.fm users currently playing track. \n\t\t\t\t               If no username is given takes from local cache",
	"fm recent            -- Gets the users last 5 played songs.",
	"fm collage           -- Gets a 4x4 collage of the users top played albums the last 7 days",

	"fm top weekly    -- Weekly top tracks for the user",
	"fm top tracks      -- All time top tracks for the user",
	"fm top albums    -- All time top albums for the user",
	"fm top artists      -- All time top artists for the user",
}

Functions

This section is empty.

Types

type LastfmPlugin

type LastfmPlugin struct {
	sync.RWMutex
	APIKey      string            `json:"api_key"`
	CachedUsers map[string]string `json:"cached_users"`
}

func NewLastFMClient

func NewLastFMClient(apikey string) *LastfmPlugin

func (*LastfmPlugin) Load

func (p *LastfmPlugin) Load() (err error)

func (*LastfmPlugin) OnMessage

func (l *LastfmPlugin) OnMessage(m *dgofw.DiscordMessage)

func (*LastfmPlugin) Save

func (p *LastfmPlugin) Save() (err error)

type Recent

type Recent struct {
	RecentTracks struct {
		Track []struct {
			Artist struct {
				Text string `json:"#text"`
				MbID string `json:"mbid"`
			} `json:"artist"`
			Name       string `json:"name"`
			Streamable string `json:"streamable"`
			MbID       string `json:"mbid"`
			Album      struct {
				Text string `json:"#text"`
				MbID string `json:"mbid"`
			} `json:"album"`
			URL   string `json:"url"`
			Image []struct {
				Text string `json:"#text"`
				Size string `json:"size"`
			} `json:"image"`
			Attr struct {
				NowPlaying string `json:"nowplaying"`
			} `json:"@attr,omitempty"`
			Date struct {
				Uts  string `json:"uts"`
				Text string `json:"#text"`
			} `json:"date,omitempty"`
		} `json:"track"`
		Attr struct {
			User       string `json:"user"`
			Page       string `json:"page"`
			PerPage    string `json:"perPage"`
			TotalPages string `json:"totalPages"`
			Total      string `json:"total"`
		} `json:"@attr"`
	} `json:"recenttracks"`
}

type Top

type Top struct {
	TopTracks struct {
		Track []struct {
			Artist struct {
				Name string `json:"name"`
				URL  string `json:"url"`
			} `json:"artist"`
			Name      string `json:"name"`
			URL       string `json:"url"`
			Playcount string `json:"playcount"`
			Image     []struct {
				URL string `json:"#text"`
			} `json:"image"`
		} `json:"track"`
	} `json:"toptracks"`
}

type TopAlbum

type TopAlbum struct {
	TopAlbums struct {
		Album []struct {
			Name      string `json:"name"`
			Playcount string `json:"playcount"`
			URL       string `json:"url"`
			Artist    struct {
				Name string `json:"name"`
				URL  string `json:"url"`
			} `json:"url"`
			Image []struct {
				URL string `json:"#text"`
			}
		} `json:"album"`
	} `json:"topalbums"`
}

type TopArtist

type TopArtist struct {
	TopArtists struct {
		Artist []struct {
			Name      string `json:"name"`
			Playcount string `json:"playcount"`
			URL       string `json:"url"`
			Image     []struct {
				URL string `json:"#text"`
			} `json:"image"`
		} `json:"artist"`
	} `json:"topartists"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL