collages

package
v0.0.0-...-56d3c23 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: GPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCollage

func CreateCollage(
	ctx context.Context,
	collageElements []CollageElement,
	displayOptions DisplayOptions,
) (image.Image, *bytes.Buffer, error)

func DownloadImage

func DownloadImage(ctx context.Context, url string) (image.Image, error)

func DownloadImageWithRetry

func DownloadImageWithRetry(ctx context.Context, url string) (image.Image, error)

Types

type Album

type Album struct {
	Image     image.Image
	ImageUrl  string
	Artist    string
	Name      string
	Playcound string
	ImageSize string
	Mbid      string
	Playcount string
}

func (*Album) CacheEntry

func (a *Album) CacheEntry() cache.CacheEntry

func (*Album) Identifier

func (a *Album) Identifier() string

func (*Album) Parameters

func (a *Album) Parameters() map[string]string

type Artist

type Artist struct {
	Name      string
	Playcount string
	Image     image.Image
	ImageUrl  string
	Mbid      string
	ImageSize string
	Url       string
}

func (*Artist) CacheEntry

func (a *Artist) CacheEntry() cache.CacheEntry

func (*Artist) Identifier

func (a *Artist) Identifier() string

func (*Artist) Parameters

func (a *Artist) Parameters() map[string]string

type CollageElement

type CollageElement struct {
	Image      image.Image
	Parameters map[string]string
}

func GetElementsForAlbum

func GetElementsForAlbum(
	ctx context.Context,
	username string,
	period constants.Period,
	count int,
	imageSize string,
	displayOptions DisplayOptions,
) ([]CollageElement, error)

func GetElementsForArtist

func GetElementsForArtist(
	ctx context.Context,
	username string,
	period constants.Period,
	count int,
	imageSize string,
	displayOptions DisplayOptions,
) ([]CollageElement, error)

func GetElementsForTrack

func GetElementsForTrack(
	ctx context.Context,
	username string,
	period constants.Period,
	count int,
	imageSize string,
	displayOptions DisplayOptions,
) ([]CollageElement, error)

type DisplayOptions

type DisplayOptions struct {
	TextLocation   constants.TextLocation
	Height         uint
	ImageDimension int
	Columns        int
	Rows           int
	FontSize       float64
	Width          uint
	PlayCount      bool
	Resize         bool
	BoldFont       bool
	Grayscale      bool
	Compress       bool
	ArtistName     bool
	TrackName      bool
	Webp           bool
	AlbumName      bool
}

type LastfmAlbum

type LastfmAlbum struct {
	Artist struct {
		URL        string `json:"url"`
		ArtistName string `json:"name"`
		Mbid       string `json:"mbid"`
	} `json:"artist"`
	Mbid      string `json:"mbid"`
	URL       string `json:"url"`
	Playcount string `json:"playcount"`
	Attr      struct {
		Rank string `json:"rank"`
	} `json:"@attr"`
	AlbumName string               `json:"name"`
	Images    []lastfm.LastfmImage `json:"image"`
}

type LastfmArtist

type LastfmArtist struct {
	Mbid      string `json:"mbid"`
	URL       string `json:"url"`
	Playcount string `json:"playcount"`
	Attr      struct {
		Rank string `json:"rank"`
	} `json:"@attr"`
	Name   string               `json:"name"`
	Images []lastfm.LastfmImage `json:"image"`
}

type LastfmTopAlbums

type LastfmTopAlbums struct {
	TopAlbums struct {
		Attr   lastfm.LastfmUser `json:"@attr"`
		Albums []LastfmAlbum     `json:"album"`
	} `json:"topalbums"`
}

type LastfmTopArtists

type LastfmTopArtists struct {
	TopArtists struct {
		Attr    lastfm.LastfmUser `json:"@attr"`
		Artists []LastfmArtist    `json:"artist"`
	} `json:"topartists"`
}

type LastfmTopTracks

type LastfmTopTracks struct {
	TopTracks struct {
		Attr   lastfm.LastfmUser `json:"@attr"`
		Tracks []LastfmTrack     `json:"track"`
	} `json:"toptracks"`
}

type LastfmTrack

type LastfmTrack struct {
	Artist struct {
		URL  string `json:"url"`
		Name string `json:"name"`
		Mbid string `json:"mbid"`
	} `json:"artist"`
	Mbid     string `json:"mbid"`
	Name     string `json:"name"`
	URL      string `json:"url"`
	Duration string `json:"duration"`
	Attr     struct {
		Rank string `json:"rank"`
	} `json:"@attr"`
	Playcount string               `json:"playcount"`
	Images    []lastfm.LastfmImage `json:"image"`
}

type Track

type Track struct {
	Name      string
	Artist    string
	Playcount string
	Album     string
	ImageUrl  string
	Image     image.Image
	Mbid      string
	ImageSize string
}

func (*Track) CacheEntry

func (t *Track) CacheEntry() cache.CacheEntry

func (*Track) Identifier

func (t *Track) Identifier() string

func (*Track) Parameters

func (t *Track) Parameters() map[string]string

Jump to

Keyboard shortcuts

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