library

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("entry not found in library")

Functions

This section is empty.

Types

type Album

type Album struct {
	ID

	Title          string
	Duration       *int16
	Tracknum       *int16
	Release        *time.Time
	Added          time.Time
	ImageAvailable bool
}

type AlbumFull

type AlbumFull struct {
	Album  AlbumWithArtists
	Tracks []TrackFull
}

func (AlbumFull) Unify

func (a AlbumFull) Unify() unification.AlbumFull

type AlbumWithArtists

type AlbumWithArtists struct {
	Album
	Artists []Artist
}

func (AlbumWithArtists) Unify

type Albums

type Albums []AlbumWithArtists

func (Albums) Unify

func (a Albums) Unify() (res []unification.Album)

type Artist

type Artist struct {
	ID

	Title          string
	Added          time.Time
	ImageAvailable bool
}

func (Artist) Unify

func (a Artist) Unify() unification.Artist

type ArtistFull

type ArtistFull struct {
	Artist Artist
	Albums []AlbumWithArtists
}

type Artists

type Artists []Artist

func (Artists) Unify

func (a Artists) Unify() (res []unification.Artist)

type ID

type ID struct {
	LibID       *uuid.UUID
	StreamingID *string
}

func (*ID) Unify

func (i *ID) Unify() unification.ID

type Library

type Library interface {
	AddStreamingAlbum(ctx context.Context, album *streaming.AlbumFull) error
	AddStreamingArtist(ctx context.Context, artist *streaming.Artist) error

	AddPlaylist(ctx context.Context, title, description string) error

	AddStreamingTrackToPlaylist(ctx context.Context, playlistID uuid.UUID, track *streaming.Track) error
	AddTrackToPlaylist(ctx context.Context, playlistID, trackID uuid.UUID) error
	ImportStreamingPlaylist(ctx context.Context, playlist *streaming.PlaylistFull, title string) error

	Search(ctx context.Context, query string, limit int) (SearchRes, error)
}

type ListOpt

type ListOpt struct {
	SortBy    string
	SortOrder SortOrder
	Offset    *int
	Limit     *int
	Search    *string
}

type PlayedAlbum

type PlayedAlbum struct {
	ID             uuid.UUID
	AlbumID        ID
	Title          string
	Played         time.Time
	Release        *time.Time
	Artists        []string
	ImageAvailable bool
}

func (PlayedAlbum) Unify

func (a PlayedAlbum) Unify() unification.Album

type Playlist

type Playlist struct {
	ID             uuid.UUID
	Title          string
	Added          time.Time
	Description    *string
	ImageAvailable bool
}

func (Playlist) Unify

func (p Playlist) Unify() unification.Playlist

type PlaylistFull

type PlaylistFull struct {
	Playlist Playlist
	Tracks   []TrackFull
}

func (PlaylistFull) Unify

type SearchRes

type SearchRes struct {
	Artists []Artist
	Albums  []AlbumWithArtists
	Tracks  []TrackFull
}

func (SearchRes) Unify

func (r SearchRes) Unify() (res unification.SourceRes)

type Service

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

func InitService

func InitService(logger *slog.Logger, lib Library, streaming *streaming.Client) *Service

func (*Service) AddPlaylist

func (s *Service) AddPlaylist(ctx context.Context, title, description string) error

func (*Service) AddStreamingAlbum

func (s *Service) AddStreamingAlbum(ctx context.Context, id string) error

func (*Service) AddStreamingArtist

func (s *Service) AddStreamingArtist(ctx context.Context, id string) error

func (*Service) AddTrackToPlaylist

func (s *Service) AddTrackToPlaylist(ctx context.Context, playlistID uuid.UUID, trackID unification.ID) error

func (*Service) ImportStreamingPlaylist added in v0.4.1

func (s *Service) ImportStreamingPlaylist(ctx context.Context, id, title string) error

func (*Service) Search

func (s *Service) Search(ctx context.Context, query string) (SearchRes, error)

type SortOrder

type SortOrder int
const (
	ASC SortOrder = iota
	DESC
)

type Track

type Track struct {
	ID

	Path     *string
	Title    string
	Duration int16
	Num      int16
	AlbumID  uuid.UUID
	Disc     int16
	Version  *string
	LastSync *time.Time
}

type TrackFull

type TrackFull struct {
	Track
	Artists []Artist
	Album   AlbumWithArtists
}

func (TrackFull) Unify

func (t TrackFull) Unify() unification.Track

type Tracks

type Tracks []TrackFull

func (Tracks) Unify

func (t Tracks) Unify() (res []unification.Track)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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