music

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package music provides support for all music and radio media.

Index

Constants

View Source
const (
	FieldArtist      = "artist"
	FieldAsin        = "asin"
	FieldDate        = "date"
	FieldFirstDate   = "first_date"
	FieldGenre       = "genre"
	FieldLabel       = "label"
	FieldLength      = "length"
	FieldMedia       = "media"
	FieldMediaTitle  = "media_title"
	FieldPopularity  = "popularity"
	FieldRating      = "rating"
	FieldRelease     = "release"
	FieldReleaseDate = "release_date"
	FieldSeries      = "series"
	FieldStatus      = "status"
	FieldTag         = "tag"
	FieldTitle       = "title"
	FieldTrack       = "track"
	FieldType        = "type"

	FieldBass      = "base"
	FieldClarinet  = "clarinet"
	FieldDrums     = "drums"
	FieldFlute     = "flute"
	FieldGuitar    = "guitar"
	FieldPiano     = "piano"
	FieldSaxophone = "saxophone"
	FieldVocals    = "vocals"

	TypePopular = "popular"
	TypeSingle  = "single"
	TypeCover   = "cover"
	TypeLive    = "live"
)
View Source
const (
	TakeoutUser    = "takeout"
	VariousArtists = "Various Artists"
)
View Source
const (
	// rename to Radio* or Station*
	TypeArtist  = "artist"  // Songs by single artist
	TypeGenre   = "genre"   // Songs from one or more genres
	TypeSimilar = "similar" // Songs from similar artists
	TypePeriod  = "period"  // Songs from one or more time periods
	TypeSeries  = "series"  // Songs from one or more series (chart)
	TypeStream  = "stream"  // Internet radio stream
	TypeOther   = "other"
)

Variables

This section is empty.

Functions

func Cover

func Cover(r Release, size string) string

func CoverArtArchiveImage

func CoverArtArchiveImage(r Release) string

Get the URL for the release cover from The Cover Art Archive. Use REID front cover.

See https://musicbrainz.org/doc/Cover_Art_Archive/API

func FuzzyName

func FuzzyName(name string) string

func Shuffle

func Shuffle(tracks []Track) []Track

Types

type Music

type Music struct {
	// contains filtered or unexported fields
}

func NewMusic

func NewMusic(config *config.Config) *Music

func (*Music) Artist

func (m *Music) Artist(artist string) *Artist

Find an artist by name.

func (*Music) ArtistBackground

func (m *Music) ArtistBackground(artist *Artist) string

func (*Music) ArtistDeep

func (m *Music) ArtistDeep(artist Artist, depth int) []Track

func (*Music) ArtistImage

func (m *Music) ArtistImage(artist *Artist) string

func (*Music) ArtistLike

func (m *Music) ArtistLike(artist string) *Artist

Find an artist by name.

func (*Music) ArtistPopularTracks

func (m *Music) ArtistPopularTracks(a Artist, limit ...int) []Track

func (*Music) ArtistRadio

func (m *Music) ArtistRadio(artist Artist) []Track

func (*Music) ArtistReleases

func (m *Music) ArtistReleases(a *Artist) []Release

All releases for an artist that have corresponing tracks.

func (*Music) ArtistShuffle

func (m *Music) ArtistShuffle(artist Artist, depth int) []Track

func (*Music) ArtistSimilar

func (m *Music) ArtistSimilar(artist Artist, depth int, breadth int) []Track

func (*Music) ArtistSingleTracks

func (m *Music) ArtistSingleTracks(a Artist, limit ...int) []Track

func (*Music) ArtistTracks

func (m *Music) ArtistTracks(a Artist) []Track

func (*Music) Artists

func (m *Music) Artists() []Artist

All artist names ordered by sortName from MusicBrainz.

func (*Music) ClearStations

func (m *Music) ClearStations()

func (*Music) Close

func (m *Music) Close()

func (*Music) CoverSmall

func (m *Music) CoverSmall(o interface{}) string

func (*Music) CreatePlaylist

func (m *Music) CreatePlaylist(p *Playlist) error

func (*Music) CreateStation

func (m *Music) CreateStation(s *Station) error

func (*Music) CreateStations

func (m *Music) CreateStations()

func (*Music) DeleteStation

func (m *Music) DeleteStation(s *Station) error

func (*Music) FindArtist

func (m *Music) FindArtist(identifier string) (Artist, error)

func (*Music) FindRelease

func (m *Music) FindRelease(identifier string) (Release, error)

func (*Music) FindStation

func (m *Music) FindStation(identifier string) (Station, error)

func (*Music) FindTrack

func (m *Music) FindTrack(identifier string) (Track, error)

func (*Music) FindTracks

func (m *Music) FindTracks(identifiers []string) []Track

func (*Music) HasMusic

func (m *Music) HasMusic() bool

func (*Music) LastModified

func (m *Music) LastModified() time.Time

func (*Music) LookupARID

func (m *Music) LookupARID(arid string) (Artist, error)

Lookup an artist given the MusicBrainz ARID.

func (*Music) LookupArtist

func (m *Music) LookupArtist(id int) (Artist, error)

Lookup an artist given the internal record ID.

func (*Music) LookupETag

func (m *Music) LookupETag(etag string) (*Track, error)

Lookup a track given the etag from the S3 bucket object. Etag can be used as a good external identifier (for playlists) since the interal record ID can change.

func (*Music) LookupPlaylist

func (m *Music) LookupPlaylist(user *auth.User) *Playlist

Lookup user playlist.

func (*Music) LookupREID

func (m *Music) LookupREID(reid string) (Release, error)

Lookup a release given the MusicBrainz REID.

func (*Music) LookupRID

func (m *Music) LookupRID(rid string) (Track, error)

Lookup a track given the MusicBrainz RID.

func (*Music) LookupRelease

func (m *Music) LookupRelease(id int) (Release, error)

Lookup a release given the internal record ID.

func (*Music) LookupStation

func (m *Music) LookupStation(id int) (Station, error)

Obtain user station by id.

func (*Music) LookupTrack

func (m *Music) LookupTrack(id int) (Track, error)

Lookup a track given the internal record ID.

func (*Music) LookupUUID

func (m *Music) LookupUUID(uuid string) (Track, error)

Lookup a track given the UUID.

func (*Music) Open

func (m *Music) Open() (err error)

func (*Music) Query

func (m *Music) Query(query string) ([]Artist, []Release, []Track, []Station)

Simple sql search for artists, releases, tracks and stations. Use config SearchLimit to change the result count.

func (*Music) RecentlyAdded

func (m *Music) RecentlyAdded() []Release

Recently added releases are ordered by LastModified which comes from the track object in the S3 bucket. Use config Recent and RecentLimit to tune the result count.

func (*Music) RecentlyReleased

func (m *Music) RecentlyReleased() []Release

Recently released releases are ordered by the MusicBrainz first release date of the release, newest first. Use config Recent and RecentLimit to tune the result count.

func (*Music) ReleasePopular

func (m *Music) ReleasePopular(release Release) []Track

func (*Music) ReleaseSingles

func (m *Music) ReleaseSingles(release Release) []Track

func (*Music) ReleaseTracks

func (m *Music) ReleaseTracks(release Release) []Track

Obtain all the tracks for this release, ordered by disc and track number.

func (*Music) ReleasesLike

func (m *Music) ReleasesLike(name string) []Release

func (*Music) Search

func (m *Music) Search(q string, limit ...int) []Track

func (*Music) SearchTracks

func (m *Music) SearchTracks(title, artist, album string) []Track

func (*Music) SimilarArtists

func (m *Music) SimilarArtists(a *Artist, limit ...int) []Artist

Similar artists based on similarity rank from Last.fm.

func (*Music) SimilarReleases

func (m *Music) SimilarReleases(a *Artist, r Release) []Release

Similar releases based on releases from similar artists in the previous and following year.

func (*Music) Stations

func (m *Music) Stations(user *auth.User) []Station

Obtain user stations.

func (*Music) Sync

func (m *Music) Sync(options SyncOptions)

func (*Music) SyncCovers

func (m *Music) SyncCovers(c client.Getter) error

func (*Music) SyncFanArt

func (m *Music) SyncFanArt(c client.Getter) error

func (*Music) TrackCount

func (m *Music) TrackCount() int64

func (*Music) TrackCover

func (m *Music) TrackCover(t Track, size string) string

Track cover based on assigned release.

func (*Music) TrackImage

func (m *Music) TrackImage(t Track) *url.URL

URL for track cover image.

func (*Music) TrackLookup

func (m *Music) TrackLookup(etag string) *Track

Find track using the etag from the S3 bucket.

func (*Music) TrackURL

func (m *Music) TrackURL(t *Track) *url.URL

URL to stream track from the S3 bucket. This will be signed and expired based on config.

func (*Music) UnmatchedTracks

func (m *Music) UnmatchedTracks() []Track

func (*Music) UpdatePlaylist

func (m *Music) UpdatePlaylist(p *Playlist) error

Save a playlist.

func (*Music) UpdateStation

func (m *Music) UpdateStation(s *Station) error

Update a station.

func (*Music) WantArtistReleases

func (m *Music) WantArtistReleases(a Artist) []Release

func (*Music) WantList

func (m *Music) WantList() []Release

type SyncOptions

type SyncOptions struct {
	Since    time.Time
	Tracks   bool
	Releases bool
	Popular  bool
	Similar  bool
	Index    bool
	Artwork  bool
	Artist   string
	Resolve  bool
}

func NewSyncOptions

func NewSyncOptions() SyncOptions

func NewSyncPopular

func NewSyncPopular() SyncOptions

func NewSyncSimilar

func NewSyncSimilar() SyncOptions

Jump to

Keyboard shortcuts

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