types

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserRoleAdmin         UserRole = "admin"
	UserRoleRead          UserRole = "read"
	UserRoleWrite         UserRole = "write"
	UserRoleImporterRead  UserRole = "importer:read"
	UserRoleImporterWrite UserRole = "importer:write"
	UserRoleUsersRead     UserRole = "users:read"
	UserRoleUsersCreate   UserRole = "users:create"
	UserRoleUsersUpdate   UserRole = "users:update"
	UserRoleUsersDelete   UserRole = "users:delete"

	AuthLocal AuthProvider = "local"

	TokenFrontendLong  TokenType = "frontend_long"
	TokenFrontendShort TokenType = "frontend_short"
	TokenAPI           TokenType = "api"
)
View Source
const (
	DeviceTypeStreaming DeviceType = "streaming"
	DeviceTypeSync      DeviceType = "sync"

	DeviceInterfaceDaemon   DeviceInterface = "daemon"
	DeviceInterfaceDesktop  DeviceInterface = "desktop"
	DeviceInterfaceTerminal DeviceInterface = "terminal"
	DeviceInterfaceWeb      DeviceInterface = "web"

	DeviceIconLaptop   DeviceIcon = "laptop"
	DeviceIconComputer DeviceIcon = "computer"
	DeviceIconPhone    DeviceIcon = "phone"
	DeviceIconSpeaker  DeviceIcon = "speaker"
	DeviceIconTV       DeviceIcon = "tv"
	DeviceIconGeneric  DeviceIcon = "generic"
)
View Source
const (
	EntityArtist               EntityType = "artist"
	EntityAlbum                EntityType = "album"
	EntityTrack                EntityType = "track"
	EntityAlbumArtist          EntityType = "album_artist"
	EntityAlbumTrack           EntityType = "album_track"
	EntityMediaFile            EntityType = "media_file"
	EntityPlaylist             EntityType = "playlist"
	EntitySmartPlaylistContent EntityType = "smart_playlist_content"
	EntitySmartPlaylistArtist  EntityType = "smart_playlist_artist"
	EntityPlaylistTrack        EntityType = "playlist_track"
	EntityPlayHistoryItem      EntityType = "play_history_item"
	EntitySearchItem           EntityType = "search_item"
	EntityImport               EntityType = "import"
	EntityRating               EntityType = "rating"
	EntityLike                 EntityType = "like"
	EntityEntityEvent          EntityType = "entity_event"
	EntityDevice               EntityType = "device"
	EntityDeviceToken          EntityType = "device_token"
	EntityToken                EntityType = "token"
	EntityTrackAnalysis        EntityType = "track_analysis"
	EntityTrackArtist          EntityType = "track_artist"

	EntityEventDelete EntityEventType = "delete"
	EntityEventCreate EntityEventType = "create"
	EntityEventUpdate EntityEventType = "update"
)
View Source
const (
	ImportStateNotStarted ImportState = "not_started"
	ImportStateRunning    ImportState = "running"
	ImportStateFinished   ImportState = "finished"
	ImportStateError      ImportState = "error"

	ImportTypeAlbum ImportType = "album"
	ImportTypeTrack ImportType = "track"
)
View Source
const (
	PlayContextAlbum       PlayContextType = "album"
	PlayContextLikedTracks PlayContextType = "liked_tracks"
	PlayContextTopTracks   PlayContextType = "top_tracks"
	PlayContextPlaylist    PlayContextType = "playlist"
	PlayContextFilter      PlayContextType = "filter"

	RepeatOne RepeatType = "one"
	RepeatAll RepeatType = "all"
	RepeatOff RepeatType = "off"

	TrackSourceContext TrackSource = "context"
	TrackSourceQueue   TrackSource = "queue"
)
View Source
const (
	SiStateNotStarted SyncItemState = "NotStarted"
	SiStateRunning    SyncItemState = "Running"
	SiStateFinished   SyncItemState = "Finished"

	SiTypeMediaFile SyncItemType = "MediaFile"
)

Variables

Functions

func DecodeEventData

func DecodeEventData[T any](evt SSEvent) (T, error)

Types

type Action

type Action string
const (
	ActionCreate Action = "create"
	ActionRead   Action = "read"
	ActionUpdate Action = "update"
	ActionDelete Action = "delete"
)

func (Action) P

func (a Action) P() *Action

type Album

type Album struct {
	ID uuid.UUID `db:"id" json:"id"`
	AlbumBase
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type AlbumArtist

type AlbumArtist struct {
	ID        uuid.UUID  `db:"id" json:"id"`
	AlbumID   uuid.UUID  `db:"album_id" json:"album_id"`
	ArtistID  uuid.UUID  `db:"artist_id" json:"artist_id"`
	Role      ArtistRole `db:"role" json:"role"`
	Position  int        `db:"position" json:"position"`
	CreatedAt time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt time.Time  `db:"updated_at" json:"updated_at"`
}

type AlbumBase

type AlbumBase struct {
	MusicBrainzID *string    `db:"musicbrainz_id" json:"musicbrainz_id" description:"ID and stuff"`
	Name          string     `db:"name" json:"name"`
	SortName      string     `db:"sort_name" json:"sort_name"`
	ReleaseDate   *time.Time `db:"release_date" json:"release_date,omitempty"`
	Tracks        *int       `db:"tracks" json:"tracks,omitempty"`
	Discs         *int       `db:"discs" json:"discs,omitempty"`
	Description   *string    `db:"description" json:"description,omitempty"`
	Owner         string     `db:"owner" json:"owner"`
	Public        *bool      `db:"public" json:"public,omitempty"`
}

type AlbumDetailed

type AlbumDetailed struct {
	ID            string     `db:"id" json:"id"`
	MusicBrainzID *string    `db:"musicbrainz_id" json:"musicbrainz_id"`
	Name          string     `db:"name" json:"name"`
	SortName      string     `db:"sort_name" json:"sort_name"`
	ArtistIDs     []string   `db:"artist_ids" json:"artist_ids,omitempty"`
	ArtistNames   []string   `db:"artist_names" json:"artist_names,omitempty"`
	ReleaseDate   *time.Time `db:"release_date" json:"release_date,omitempty" ts_type:"string | undefined"`
	TrackCount    int        `db:"track_count" json:"track_count"`
	DiscCount     int        `db:"disc_count" json:"disc_count"`
	Description   *string    `db:"description" json:"description,omitempty"`
	Owner         string     `db:"owner" json:"owner"`
	Public        *bool      `db:"public" json:"public,omitempty"`
	CreatedAt     time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt     time.Time  `db:"updated_at" json:"updated_at"`
}

type AlbumTrack

type AlbumTrack struct {
	ID          uuid.UUID `db:"id" json:"id"`
	AlbumID     uuid.UUID `db:"album_id" json:"album_id"`
	TrackID     uuid.UUID `db:"track_id" json:"track_id"`
	DiscNumber  int       `db:"disc_number" json:"disc_number"`
	TrackNumber int       `db:"track_number" json:"track_number"`
	CreatedAt   time.Time `db:"created_at" json:"created_at"`
	UpdatedAt   time.Time `db:"updated_at" json:"updated_at"`
}

type AlbumUpdate

type AlbumUpdate struct {
	AlbumBase
	Artists []uuid.UUID `json:"artists"`
}

type Artist

type Artist struct {
	ID uuid.UUID `db:"id" json:"id" ts_type:"string"`
	ArtistBase
	Role      ArtistRole `db:"role" json:"role"`
	CreatedAt time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt time.Time  `db:"updated_at" json:"updated_at"`
}

type ArtistBase

type ArtistBase struct {
	MusicBrainzID *string `db:"musicbrainz_id" json:"musicbrainz_id"`
	Name          string  `db:"name" json:"name" required:"true"`
	SortName      string  `db:"sort_name" json:"sort_name" required:"true"`
	Country       *string `db:"country" json:"country,omitempty"`
	YearStarted   *int    `db:"year_started" json:"year_started,omitempty"`
	YearEnded     *int    `db:"year_ended" json:"year_ended,omitempty"`
	Description   *string `db:"description" json:"description,omitempty"`
}

type ArtistDetailed

type ArtistDetailed struct {
	Artist
	AlbumCount int `json:"album_count"`
	TrackCount int `json:"track_count"`
}

type ArtistMinimal

type ArtistMinimal struct {
	ID       uuid.UUID  `db:"id" json:"id" ts_type:"string"`
	Name     string     `db:"name" json:"name" required:"true"`
	SortName string     `db:"sort_name" json:"sort_name" required:"true"`
	Role     ArtistRole `db:"role" json:"role"`
}

type ArtistRole

type ArtistRole string
const (
	ArPrimary         ArtistRole = "primary"
	ArFeatured        ArtistRole = "featured"
	ArComposer        ArtistRole = "composer"
	ArConductor       ArtistRole = "conductor"
	ArProducer        ArtistRole = "producer"
	ArRemixer         ArtistRole = "remixer"
	ArExecutive       ArtistRole = "executive"
	ArPerformer       ArtistRole = "performer"
	ArVocalist        ArtistRole = "vocalist"
	ArLyricist        ArtistRole = "lyricist"
	ArInstrumentalist ArtistRole = "instrumentalist"
)

type AudioFile

type AudioFile interface {
	io.Reader
	SampleRate() int
	NChannels() int
	Bitrate() int
	FileSize() int64
	DurationMS() int64
}

type AuthIdentity

type AuthIdentity struct {
	ID             uuid.UUID    `db:"id" json:"id"`
	UserID         uuid.UUID    `db:"user_id" json:"user_id"`
	Provider       AuthProvider `db:"provider" json:"provider"`
	ProviderUserID uuid.UUID    `db:"provider_user_id" json:"provider_user_id"`
	Email          string       `db:"email" json:"email"`
	CreatedAt      time.Time    `db:"created_at" json:"created_at"`
	UpdatedAt      time.Time    `db:"updated_at" json:"updated_at"`
}

type AuthProvider

type AuthProvider string

type ClientConfig

type ClientConfig struct {
	ConfigPath    string
	ImagePath     string
	MusicDirPath  string
	PlayerName    string
	ServerBaseURL string
}

type ClientEvent

type ClientEvent string
const (
	ClientEventMsgErr     ClientEvent = "msg.error"
	ClientEventMsgSuccess ClientEvent = "msg.success"
	ClientEventMsgInfo    ClientEvent = "msg.info"
	ClientEventMsgWarn    ClientEvent = "msg.warn"

	ClientEventServerOnline ClientEvent = "server.status"

	ClientEventSyncInProgress ClientEvent = "sync.inprogress"

	ClientEventEntitiesUpdated ClientEvent = "entities.updated"

	ClientEventPlayerContextChange  ClientEvent = "player.contextchange"
	ClientEventPlayerPlaybackChange ClientEvent = "player.playbackchange"

	ClientEventUserUpdated ClientEvent = "user.updated"

	ClientEventAuthLoggedIn ClientEvent = "auth.loggedin"
)

type ClientMessage

type ClientMessage struct {
	Title   string     `json:"title"`
	Message string     `json:"message"`
	Level   slog.Level `json:"level"`
}

type Codec

type Codec string
const (
	CodecFlac Codec = "flac"
)

type ColorScheme

type ColorScheme string
const (
	ColorSchemeLight ColorScheme = "light"
	ColorSchemeDark  ColorScheme = "dark"
)

type CreateUserApiTokenReq

type CreateUserApiTokenReq struct {
	Name string `json:"name"`
}

type CreateUserApiTokenResp

type CreateUserApiTokenResp struct {
	Token string `json:"token"`
}

type CreateUserReq

type CreateUserReq struct {
	Email    string     `json:"email"`
	Username string     `json:"username"`
	Password string     `json:"password"`
	Roles    []UserRole `json:"roles"`
}

type DBSyncState

type DBSyncState struct {
	ID             string    `db:"id" json:"id"`
	SyncedAt       time.Time `db:"synced_at" json:"synced_at"`
	ArtistsCreated int       `db:"artists_created" json:"artists_created"`
	ArtistsUpdated int       `db:"artists_updated" json:"artists_updated"`
	AlbumsCreated  int       `db:"albums_created" json:"albums_created"`
	AlbumsUpdated  int       `db:"albums_updated" json:"albums_updated"`
	TracksCreated  int       `db:"tracks_created" json:"tracks_created"`
	TracksUpdated  int       `db:"tracks_updated" json:"tracks_updated"`
}

type Device

type Device struct {
	DeviceBase
	ID        uuid.UUID `db:"id" json:"id" ts_type:"string"`
	UserID    uuid.UUID `db:"user_id" json:"user_id"`
	LastIP    string    `db:"last_ip" json:"last_ip"`
	LastSeen  time.Time `db:"last_seen" json:"last_seen"`
	Active    bool      `db:"-" json:"active"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type DeviceBase

type DeviceBase struct {
	Name             string          `db:"name" json:"name" `
	Type             DeviceType      `db:"type" json:"type"`
	Interface        DeviceInterface `db:"interface" json:"interface"`
	Icon             DeviceIcon      `db:"icon" json:"icon"`
	SupportsPlayback bool            `db:"supports_playback" json:"supports_playback"`
	Platform         string          `db:"platform" json:"platform"`
	Version          string          `db:"version" json:"version"`
}

TODO:UNIQUE(token_id) (maybe, might not be necessary. Should not be able to disable a client, but a token. A token should be able to be used in multiple places)

type DeviceDetailed

type DeviceDetailed struct {
	Device
	PlayerState *PlayerStateDTO `json:"player_state"`
}

type DeviceIcon

type DeviceIcon string

type DeviceInterface

type DeviceInterface string

type DeviceToken

type DeviceToken struct {
	DeviceID  uuid.UUID `db:"device_id"`
	TokenID   uuid.UUID `db:"token_id"`
	CreatedAt time.Time `db:"created_at"`
}

type DeviceType

type DeviceType string

type EntityEvent

type EntityEvent struct {
	ID         uuid.UUID       `db:"id" json:"id" ts_type:"string"`
	ItemID     uuid.UUID       `db:"item_id" json:"item_id" ts_type:"string"`
	UserID     uuid.UUID       `db:"user_id" json:"user_id" ts_type:"string"`
	Type       EntityEventType `db:"event_type" json:"event_type"`
	EntityType EntityType      `db:"entity_type" json:"entity_type"`
	EventTime  time.Time       `db:"event_time" json:"event_time" ts_type:"string"`
}

type EntityEventType

type EntityEventType string

type EntityEvents

type EntityEvents []EntityEvent

func (EntityEvents) LaterDeleteExists

func (es EntityEvents) LaterDeleteExists(e EntityEvent) bool

type EntityType

type EntityType string

func (EntityType) P

func (e EntityType) P() *EntityType

type FilterMood

type FilterMood struct {
	Aggressive *float64 `json:"aggressive"`
	Calm       *float64 `json:"calm"`
	Happy      *float64 `json:"happy"`
	Sad        *float64 `json:"sad"`
}

type FilterUpperLower

type FilterUpperLower[T any] struct {
	Upper T `json:"upper"`
	Lower T `json:"lower"`
}

type Healthz

type Healthz struct {
	Status HealthzStatus `json:"status"`
}

type HealthzStatus

type HealthzStatus string
const (
	HealthzRunning     HealthzStatus = "running"
	HealthzUnavailable HealthzStatus = "unavailable"
	HealthzNoAuth      HealthzStatus = "no_auth"
)

type HexColor

type HexColor string

func (HexColor) NRGBA

func (h HexColor) NRGBA(opacity float32) color.NRGBA

func (HexColor) RGBA

func (h HexColor) RGBA() color.RGBA

type Import

type Import struct {
	ID            uuid.UUID   `db:"id" json:"id" ts_type:"string"`
	MusicBrainzID *string     `db:"musicbrainz_id" json:"musicbrainz_id"`
	Owner         uuid.UUID   `db:"owner" json:"owner" ts_type:"string"`
	Filename      string      `db:"filename" json:"filename"`
	Type          ImportType  `db:"type" json:"type"`
	State         ImportState `db:"state" json:"state"`
	CreatedAt     time.Time   `db:"created_at" json:"created_at" ts_type:"string"`
	UpdatedAt     time.Time   `db:"updated_at" json:"updated_at" ts_type:"string"`
}

type ImportAlbum

type ImportAlbum struct {
	MusicbrainzID *string `json:"musicbrainz_id"`
}

type ImportState

type ImportState string

type ImportType

type ImportType string

type JobType

type JobType string
const (
	JobImporterRun                 JobType = "importer:run"
	JobMetaSyncRun                 JobType = "metasync:run"
	JobAuthClientServerStatus      JobType = "authclient:serverstatus"
	JobSyncerDaemon                JobType = "syncer:daemon"
	JobMediaManagerUpdateSyncItems JobType = "mediamanager:update-searchitems"
	JobAnalyserRunTrackAnalysis    JobType = "analyser:run-track-analysis"
	JobAuthExpiredTokenCleanup     JobType = "auth:expired-token-cleanup"
)

type Like

type Like struct {
	ID        uuid.UUID `db:"id" json:"id"`
	TrackID   uuid.UUID `db:"track_id" json:"track_id"`
	Owner     uuid.UUID `db:"owner" json:"owner"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type ListPaginationPayload

type ListPaginationPayload[T any] struct {
	Items      []T `json:"items,omitempty"`
	Page       int `json:"page"`
	Limit      int `json:"limit"`
	TotalPages int `json:"total_pages"`
	TotalItems int `json:"total_items"`
}

type ListPayload

type ListPayload[T any] struct {
	Items []T `json:"items,omitempty"`
	Count int `json:"count"`
}

type LocalCredentials

type LocalCredentials struct {
	UserID       uuid.UUID `db:"user_id" json:"user_id"`
	PasswordHash string    `db:"password_hash" json:"password_hash"`
	CreatedAt    time.Time `db:"created_at" json:"created_at"`
	UpdatedAt    time.Time `db:"updated_at" json:"updated_at"`
}

type LoginReq

type LoginReq struct {
	Email          string `json:"email"`
	Password       string `json:"password"`
	LongLivedToken bool   `json:"long_lived_token"`
}

type LoginResp

type LoginResp struct {
	Token     string `json:"token"`
	TokenType string `json:"token_type"`
	ExpiresIn int    `json:"expires_in"`
}

type MediaFile

type MediaFile struct {
	ID          uuid.UUID `db:"id" json:"id"`
	DurationMs  int64     `db:"duration_ms" json:"duration_ms"`
	Bitrate     int       `db:"bitrate" json:"bitrate"`
	SampleRate  int       `db:"sample_rate" json:"sample_rate"`
	FileSize    int64     `db:"file_size" json:"file_size"`
	Codec       Codec     `db:"codec" json:"codec"`
	Checksum    string    `db:"checksum" json:"checksum"`
	CreatedAt   time.Time `db:"created_at" json:"created_at"`
	UpdatedAt   time.Time `db:"updated_at" json:"updated_at"`
	OrgFilename string    `db:"-" json:"-"`
}

func (MediaFile) Filename

func (m MediaFile) Filename() string

type MediaStream

type MediaStream interface {
	io.ReadSeekCloser
	Size() (int64, error)
}

type NoResponse

type NoResponse struct{}

type PlayContext

type PlayContext struct {
	Type       PlayContextType `json:"type"`
	RefID      uuid.UUID       `json:"ref_id" ts_type:"string"`
	Tracks     []TrackDetailed `json:"tracks" `
	TrackOrder []int           `json:"track_order"`
	Queue      []TrackDetailed `json:"queue"`
}

func (PlayContext) DTO

func (pc PlayContext) DTO(deviceID uuid.UUID) PlayContextDTO

type PlayContextDTO

type PlayContextDTO struct {
	DeviceID uuid.UUID `json:"device_id" ts_type:"string"`
	PlayContext
}

type PlayContextOld

type PlayContextOld struct {
	PlaybackState   PlaybackState   `json:"playback_state"`
	Type            PlayContextType `json:"type"`
	RefID           uuid.UUID       `json:"ref_id" ts_type:"string"`
	Tracks          []TrackDetailed `json:"tracks"`
	Queue           []TrackDetailed `json:"queue"`
	CurrentTrackIdx int             `json:"current_track_idx"`
	CurrentTrack    *TrackDetailed  `json:"current_track"`
	TrackOrder      []int           `json:"track_order"`
}

func (*PlayContextOld) PullFromQueue

func (pc *PlayContextOld) PullFromQueue() *TrackDetailed

type PlayContextType

type PlayContextType string

type PlayHistory

type PlayHistory struct {
	ID       string    `db:"id" json:"id"`
	UserID   string    `db:"user_id" json:"user_id"`
	TrackID  string    `db:"track_id" json:"track_id"`
	PlayedAt time.Time `db:"played_at" json:"played_at"`
}

type PlayHistorySyncState

type PlayHistorySyncState struct {
	Time        time.Time     `json:"time"`
	RemoteItems []PlayHistory `json:"remote_items"`
}

type PlaybackState

type PlaybackState struct {
	Playing bool       `json:"playing"`
	Shuffle bool       `json:"shuffle"`
	Repeat  RepeatType `json:"repeat"`

	ProgressMS int64     `json:"progress"`
	UpdatedAt  time.Time `json:"updated_at" ts_type:"string"`

	TrackSource TrackSource `json:"track_source"`
	TrackIndex  int         `json:"track_index"`
}

func (PlaybackState) DTO

func (p PlaybackState) DTO(deviceID uuid.UUID) PlaybackStateDTO

func (PlaybackState) TotalProgress

func (p PlaybackState) TotalProgress() int64

type PlaybackStateDTO

type PlaybackStateDTO struct {
	DeviceID uuid.UUID `json:"device_id" ts_type:"string"`
	PlaybackState
}

type PlayerState

type PlayerState struct {
	Playback PlaybackState `json:"playback"`
	Context  PlayContext   `json:"context"`
}

func (*PlayerState) CurrentTrack

func (p *PlayerState) CurrentTrack() (TrackDetailed, error)

func (*PlayerState) DTO

func (p *PlayerState) DTO(deviceID uuid.UUID) PlayerStateDTO

func (*PlayerState) NextTrack

func (p *PlayerState) NextTrack() (contextUpdated, stop bool)

func (*PlayerState) PreviousTrack

func (p *PlayerState) PreviousTrack() (stop bool)

func (*PlayerState) RebuildTrackOrder

func (p *PlayerState) RebuildTrackOrder()

type PlayerStateDTO

type PlayerStateDTO struct {
	Playback PlaybackStateDTO `json:"playback"`
	Context  PlayContextDTO   `json:"context"`
}

type Playlist

type Playlist struct {
	ID uuid.UUID `db:"id" json:"id" ts_type:"string"`
	PlaylistBase
	Type      PlaylistType `db:"type" json:"type"`
	Owner     uuid.UUID    `db:"owner" json:"owner"`
	CreatedAt time.Time    `db:"created_at" json:"created_at"`
	UpdatedAt time.Time    `db:"updated_at" json:"updated_at"`
}

type PlaylistBase

type PlaylistBase struct {
	Name        string  `db:"name" json:"name"`
	Description *string `db:"description" json:"description,omitempty"`
	Public      bool    `db:"public" json:"public"`
}

type PlaylistTrack

type PlaylistTrack struct {
	ID           uuid.UUID `db:"id" json:"id" ts_type:"string"`
	PlaylistID   uuid.UUID `db:"playlist_id" json:"playlist_id"`
	AlbumTrackID uuid.UUID `db:"album_track_id" json:"album_track_id"`
	CreatedAt    time.Time `db:"created_at" json:"created_at"`
	UpdatedAt    time.Time `db:"updated_at" json:"updated_at"`
}

type PlaylistTrackReq

type PlaylistTrackReq struct {
	AlbumID uuid.UUID `json:"album_id"`
	TrackID uuid.UUID `json:"track_id"`
}

type PlaylistType

type PlaylistType string
const (
	PlaylistTypeStandard PlaylistType = "standard"
	PlaylistTypeSmart    PlaylistType = "smart"
)

type Rating

type Rating struct {
	ID        uuid.UUID `db:"id" json:"id"`
	TrackID   uuid.UUID `db:"track_id" json:"track_id"`
	Rating    int       `db:"rating" json:"rating"`
	Owner     uuid.UUID `db:"owner" json:"owner"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type RatingReq

type RatingReq struct {
	Value int `json:"value"`
}

type RepeatType

type RepeatType string

type ReqDevicesRegister

type ReqDevicesRegister struct {
	ID *uuid.UUID `json:"id" ts_type:"string"`
	DeviceBase
}

type ReqPlaylistsAdd

type ReqPlaylistsAdd struct {
	PlaylistBase
	Filter    TrackFilter `json:"filter"`
	PlistType string      `query:"type" description:"Type of playlist. Defaults to 'standard'" json:"-"`
}

func (ReqPlaylistsAdd) Validate

func (r ReqPlaylistsAdd) Validate() (validationMessages string, err error)

type RespDevicesRegister

type RespDevicesRegister struct {
	DeviceID uuid.UUID `json:"id"`
}

type Response

type Response[T any] struct {
	Payload T   `json:"payload,omitempty"`
	Status  int `json:"-"`
}

type SSENoData

type SSENoData struct{}

type SSEvent

type SSEvent struct {
	ID   uuid.UUID       `json:"id"`
	Type SSEventType     `json:"type"`
	Data json.RawMessage `json:"data"`
}

func SSEDeviceConnected

func SSEDeviceConnected(d Device) SSEvent

func SSEDeviceDeleted

func SSEDeviceDeleted(id uuid.UUID) SSEvent

func SSEDeviceDisconnected

func SSEDeviceDisconnected(d Device) SSEvent

func SSEDevicePlayContext

func SSEDevicePlayContext(pc PlayContextDTO) SSEvent

func SSEDevicePlaybackState

func SSEDevicePlaybackState(ps PlaybackStateDTO) SSEvent

func SSEDeviceUpdated

func SSEDeviceUpdated(d Device) SSEvent

func SSEImporterItemsUpdated

func SSEImporterItemsUpdated() SSEvent

func SSEPlayerAddToQueue

func SSEPlayerAddToQueue(t TrackDetailed) SSEvent

func SSEPlayerNextTrack

func SSEPlayerNextTrack() SSEvent

func SSEPlayerPlayContext

func SSEPlayerPlayContext(pc PlayContextDTO) SSEvent

func SSEPlayerPlayPause

func SSEPlayerPlayPause() SSEvent

func SSEPlayerPlaybackState

func SSEPlayerPlaybackState(ps PlaybackStateDTO) SSEvent

func SSEPlayerPreviousTrack

func SSEPlayerPreviousTrack() SSEvent

func SSEPlayerSetRepeat

func SSEPlayerSetRepeat(rt RepeatType) SSEvent

func SSEPlayerSetShuffle

func SSEPlayerSetShuffle(a bool) SSEvent

func SSEPlayerSetState

func SSEPlayerSetState(pc PlayerState) SSEvent

func SSEPlayerStop

func SSEPlayerStop() SSEvent

func SSEServerMessage

func SSEServerMessage(level SSEventMsgLevel, title, body string) SSEvent

type SSEventMsgLevel

type SSEventMsgLevel string
const (
	SSEventMsgInfo SSEventMsgLevel = "info"
)

type SSEventMsgPayload

type SSEventMsgPayload struct {
	Level SSEventMsgLevel `json:"level"`
	Title string          `json:"title"`
	Body  string          `json:"body"`
}

type SSEventType

type SSEventType string
const (
	SSEventTypeServerMessage        SSEventType = "server.message"
	SSEventTypeDeviceConnected      SSEventType = "device.connected"
	SSEventTypeDeviceDisconnected   SSEventType = "device.disconnected"
	SSEventTypeDeviceUpdated        SSEventType = "device.updated"
	SSEventTypeDeviceDeleted        SSEventType = "device.deleted"
	SSEventTypeDevicePlayContext    SSEventType = "device.playcontext"
	SSEventTypeDevicePlaybackState  SSEventType = "device.playbackstate"
	SSEventTypePlayerAddToQueue     SSEventType = "player.addtoqueue"
	SSEventTypePlayerPlayContext    SSEventType = "player.playcontext"
	SSEventTypePlayerPlaybackState  SSEventType = "player.playbackstate"
	SSEventTypePlayerSetRepeat      SSEventType = "player.setrepeat"
	SSEventTypePlayerSetShuffle     SSEventType = "player.setshuffle"
	SSEventTypePlayerSetState       SSEventType = "player.setstate"
	SSEventTypePlayerStop           SSEventType = "player.stop"
	SSEventTypePlayerNextTrack      SSEventType = "player.nexttrack"
	SSEventTypePlayerPlayPause      SSEventType = "player.playpause"
	SSEventTypePlayerPreviousTrack  SSEventType = "player.previoustrack"
	SSEventTypeImporterItemsUpdated SSEventType = "importer.itemsupdated"
)

type SearchItem

type SearchItem struct {
	Name     string     `db:"name" json:"name"`
	HtmlName string     `db:"html_name" json:"html_name"`
	ID       uuid.UUID  `db:"id" json:"id"`
	Type     EntityType `db:"type" json:"type"`
	LinkID   uuid.UUID  `db:"link_id" json:"link_id"`
	LinkType EntityType `db:"link_type" json:"link_type"`
}

type ServerApiInfo

type ServerApiInfo struct {
	ServerInfo
	Version string `json:"version"`
}

type ServerInfo

type ServerInfo struct {
	Application string        `json:"application"`
	ID          uuid.UUID     `json:"id" ts_type:"string"`
	Status      HealthzStatus `json:"status"`
	Name        string        `json:"name"`
}

type SetDevicePlayerRepeatReq

type SetDevicePlayerRepeatReq struct {
	Type RepeatType `json:"type" description:"Type of repeat"`
}

type SetDevicePlayerShuffleReq

type SetDevicePlayerShuffleReq struct {
	Active bool `json:"active" description:"Shuffle is active"`
}

type SmartPlaylist

type SmartPlaylist struct {
	Playlist
	Content SmartPlaylistContent
}

type SmartPlaylistArtist

type SmartPlaylistArtist struct {
	ID        uuid.UUID `db:"id" json:"id" ts_type:"string"`
	ParentID  uuid.UUID `db:"parent_id" json:"parent_id"`
	ArtistID  uuid.UUID `db:"artist_id" json:"artist_id"`
	Owner     uuid.UUID `db:"owner" json:"owner" ts_type:"string"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type SmartPlaylistContent

type SmartPlaylistContent struct {
	ID             uuid.UUID    `db:"id" json:"id" ts_type:"string"`
	PlaylistID     uuid.UUID    `db:"playlist_id" json:"playlist_id"`
	BpmUpper       *int         `db:"bpm_upper" json:"bpm_upper"`
	BpmLower       *int         `db:"bpm_lower" json:"bpm_lower"`
	MoodAggressive *float64     `db:"mood_aggressive" json:"mood_aggressive"`
	MoodCalm       *float64     `db:"mood_calm" json:"mood_calm"`
	MoodHappy      *float64     `db:"mood_happy" json:"mood_happy"`
	MoodSad        *float64     `db:"mood_sad" json:"mood_sad"`
	Artists        *[]uuid.UUID `json:"artists" ts_type:"string[]"`
	Owner          uuid.UUID    `db:"owner" json:"owner" ts_type:"string"`

	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

func (SmartPlaylistContent) TrackFilter

func (s SmartPlaylistContent) TrackFilter() TrackFilter

type SyncData

type SyncData struct {
	Artists        []string    `json:"artists"`
	Albums         []string    `json:"albums"`
	Tracks         []string    `json:"tracks"`
	AlbumTracks    []uuid.UUID `json:"album_tracks"`
	AlbumArtists   []uuid.UUID `json:"album_artists"`
	Playlists      []uuid.UUID `json:"playlists"`
	PlaylistTracks []uuid.UUID `json:"playlist_tracks"`
	MediaFiles     []uuid.UUID `json:"media_files"`
}

type SyncItem

type SyncItem struct {
	ID        uuid.UUID     `db:"id" json:"id"`
	SyncID    uuid.UUID     `db:"sync_id" json:"sync_id"`
	ItemID    uuid.UUID     `db:"item_id" json:"item_id"`
	Type      SyncItemType  `db:"type" json:"type"`
	State     SyncItemState `db:"state" json:"state"`
	CreatedAt time.Time     `db:"created_at" json:"created_at"`
	UpdatedAt time.Time     `db:"updated_at" json:"updated_at"`
}

type SyncItemState

type SyncItemState string

type SyncItemType

type SyncItemType string

type SyncPlayHistoryReq

type SyncPlayHistoryReq struct {
	ChangesSince       time.Time     `json:"changes_since"`
	UpdatedClientItems []PlayHistory `json:"updated_client_items"`
}

type SyncReq

type SyncReq struct {
	ChangesSince time.Time `json:"changes_since"`
}

type SyncState

type SyncState struct {
	Time             time.Time    `json:"time"`
	CreatedOrUpdated SyncData     `json:"created_or_updated"`
	Deleted          SyncData     `json:"deleted"`
	New              EntityEvents `json:"new"`
}

type Theme

type Theme struct {
	Name        string      `toml:"name" desc:"The name of the theme. Used in the GUI for human readable selection."`
	ColorScheme ColorScheme `toml:"color_scheme" desc:"Define if your color scheme is light or dark. Nothing else is accepted."`
	Colors      ThemeColors `toml:"colors" desc:"Definition of all colors of the theme."`
}

func (Theme) CSS

func (t Theme) CSS(themeName string) string

func (Theme) Validate

func (t Theme) Validate(themeName string) error

type ThemeColors

type ThemeColors struct {
	Accent            HexColor `toml:"accent" desc:"Main brand color"`
	AccentForeground  HexColor `toml:"accent_foreground" desc:"Foreground color on components with accent background."`
	Background        HexColor `toml:"background" desc:"Background color of the main frame."`
	Border            HexColor `toml:"border" desc:"Border color."`
	Danger            HexColor `toml:"danger" desc:"Error message color."`
	DangerForeground  HexColor `toml:"danger_foreground" desc:"Foreground color on components with error background."`
	Default           HexColor `` /* 140-byte string literal not displayed */
	DefaultForeground HexColor `toml:"default_foreground" desc:"Used for player buttons, excluding play/pause."`
	FieldForeground   HexColor `toml:"field_foreground" desc:"Text color in forms."`
	Foreground        HexColor `toml:"foreground" desc:"Main text color."`
	Overlay           HexColor `toml:"overlay" desc:"Background in popup windows."`
	Success           HexColor `toml:"success" desc:"Success message color."`
	SuccessForeground HexColor `toml:"success_foreground" desc:"Foreground color on components with success background."`
	Surface           HexColor `toml:"surface" desc:"Background color of player, cards and notifications."`
	Surface2          HexColor `toml:"surface2" desc:"Background color of the menu."`
	Warning           HexColor `toml:"warning" desc:"Warning message color."`
	WarningForeground HexColor `toml:"warning_foreground" desc:"Foreground color on components with warning background."`
}

type ThemeDescription

type ThemeDescription struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Token

type Token struct {
	ID         uuid.UUID  `db:"id" json:"id"`
	UserID     uuid.UUID  `db:"user_id" json:"user_id"`
	Type       TokenType  `db:"type" json:"type"`
	Name       *string    `db:"name" json:"name,omitempty"`
	Hash       string     `db:"hash" json:"-"`
	Scopes     string     `db:"scopes" json:"scopes"`
	ExpiresAt  *time.Time `db:"expires_at" json:"expires_at,omitempty"`
	LastUsedAt *time.Time `db:"last_used_at" json:"last_used_at,omitempty"`
	CreatedAt  time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt  time.Time  `db:"updated_at" json:"updated_at"`
}

type TokenLimited

type TokenLimited struct {
	ID         uuid.UUID  `db:"id" json:"id" ts_type:"string"`
	Type       TokenType  `db:"type" json:"type"`
	Name       *string    `db:"name" json:"name,omitempty"`
	Scopes     string     `db:"scopes" json:"scopes"`
	ExpiresAt  *time.Time `db:"expires_at" json:"expires_at,omitempty" ts_type:"string"`
	LastUsedAt *time.Time `db:"last_used_at" json:"last_used_at,omitempty" ts_type:"string"`
	CreatedAt  time.Time  `db:"created_at" json:"created_at" ts_type:"string"`
	UpdatedAt  time.Time  `db:"updated_at" json:"updated_at" ts_type:"string"`
}

type TokenType

type TokenType string

type Track

type Track struct {
	ID            uuid.UUID  `db:"id" json:"id"` // UUID
	Title         string     `db:"title" json:"title"`
	MusicBrainzID *string    `db:"musicbrainz_id" json:"musicbrainz_id"`
	Genre         *string    `db:"genre" json:"genre,omitempty"`
	Comment       *string    `db:"comment" json:"comment,omitempty"`
	MediaFile     *uuid.UUID `db:"media_file" json:"media_file"`
	TitleMatch    float32    `db:"-" json:"-"`
	CreatedAt     time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt     time.Time  `db:"updated_at" json:"updated_at"`
}

type TrackAnalysis

type TrackAnalysis struct {
	ID uuid.UUID `db:"id" json:"id" ts_type:"string"`
	TrackAnalysisResults
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type TrackAnalysisResults

type TrackAnalysisResults struct {
	BPM           int     `db:"bpm" json:"bpm"`
	Key           string  `db:"key" json:"key"`
	KeyScale      string  `db:"key_scale" json:"key_scale"`
	KeyConfidence float64 `db:"key_confidence" json:"key_confidence"`
	Loudness      int     `db:"loudness" json:"loudness"`
	Energy        float64 `db:"energy" json:"energy"`
	Danceability  float64 `db:"danceability" json:"danceability"`
	MoodHappy     float64 `db:"mood_happy" json:"mood_happy"`
	MoodSad       float64 `db:"mood_sad" json:"mood_sad"`
	MoodAggresive float64 `db:"mood_aggresive" json:"mood_aggresive"`
	MoodCalm      float64 `db:"mood_calm" json:"mood_calm"`
}

type TrackArtist

type TrackArtist struct {
	ID        uuid.UUID  `db:"id" json:"id"`
	TrackID   uuid.UUID  `db:"track_id" json:"album_id"`
	ArtistID  uuid.UUID  `db:"artist_id" json:"artist_id"`
	Role      ArtistRole `db:"role" json:"role"`
	CreatedAt time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt time.Time  `db:"updated_at" json:"updated_at"`
}

type TrackDetailed

type TrackDetailed struct {
	ID        uuid.UUID `db:"id" json:"id" ts_type:"string"` // UUID
	Title     string    `db:"title" json:"title"`
	AlbumID   string    `db:"album_id" json:"album_id,omitempty"`
	AlbumName string    `db:"album_name" json:"album_name,omitempty"`
	// ArtistIDs     []string        `db:"artist_ids" json:"artist_ids,omitempty"`
	// ArtistNames   []string        `db:"artist_names" json:"artist_names,omitempty"`
	Artists       []ArtistMinimal `json:"artists,omitempty"`
	MusicBrainzID *string         `db:"musicbrainz_id" json:"musicbrainz_id"`
	TrackNumber   int             `db:"track_number" json:"track_number,omitempty"`
	DiscNumber    int             `db:"disc_number" json:"disc_number,omitempty"`
	Genre         *string         `db:"genre" json:"genre,omitempty"`
	Comment       *string         `db:"comment" json:"comment,omitempty"`
	MediaFile     *MediaFile      `db:"media_file" json:"media_file"`
	PlayCount     int             `db:"play_count" json:"play_count"`
	ContextID     *uuid.UUID      `db:"context_id" json:"context_id" ts_type:"string"`
	Rating        *float64        `json:"rating"`
	UserRating    *int            `json:"user_rating"`
	Liked         bool            `json:"liked"`
	CreatedAt     time.Time       `db:"created_at" json:"created_at"`
	UpdatedAt     time.Time       `db:"updated_at" json:"updated_at"`
	Analysis      TrackAnalysis   `json:"analysis"`
}

func (TrackDetailed) ArtistNames

func (t TrackDetailed) ArtistNames() []string

type TrackDetailedNew

type TrackDetailedNew struct {
	Track      Track         `json:"track"`
	Album      Album         `json:"album"`
	Artists    []Artist      `json:"artists"`
	AlbumTrack AlbumTrack    `json:"album_track"`
	Mediafile  *MediaFile    `json:"media_file"`
	Analysis   TrackAnalysis `json:"analysis"`
}

type TrackFilter

type TrackFilter struct {
	BPM     *FilterUpperLower[int] `json:"bpm"`
	Mood    FilterMood             `json:"mood"`
	Artists *[]uuid.UUID           `json:"artists" ts_type:"string[]"`
}

type TrackSource

type TrackSource string

type TrackUpdate

type TrackUpdate struct {
	Track
	DiscNumber  int         `json:"disc_number"`
	TrackNumber int         `json:"track_number"`
	AlbumID     uuid.UUID   `json:"album_id" ts_type:"string"`
	Artists     []uuid.UUID `json:"artists,omitempty" ts_type="string[]"`
}

type UpdateProfileReq

type UpdateProfileReq struct {
	Email              *string `json:"email"`
	Username           *string `json:"username"`
	Password           *string `json:"password"`
	NewPassword        *string `json:"new_password"`
	NewPasswordConfirm *string `json:"new_password_confirm"`
}

type UpdateUserReq

type UpdateUserReq struct {
	Email    string     `json:"email"`
	Username string     `json:"username"`
	Password *string    `json:"password"`
	Roles    []UserRole `json:"roles"`
}

type User

type User struct {
	ID        uuid.UUID `db:"id" json:"id" ts_type:"string"`
	Email     string    `db:"email" json:"email"`
	Username  string    `db:"username" json:"username"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type UserDetails

type UserDetails struct {
	ID        uuid.UUID    `db:"id" json:"id" ts_type:"string"`
	Email     string       `db:"email" json:"email"`
	Username  string       `db:"username" json:"username"`
	Provider  AuthProvider `db:"provider" json:"provider"`
	Roles     []UserRole   `db:"role" json:"role"`
	CreatedAt time.Time    `db:"created_at" json:"created_at"`
}

func (UserDetails) HasRole

func (u UserDetails) HasRole(r UserRole) bool

type UserRole

type UserRole string

type UserScope

type UserScope struct {
	UserID    uuid.UUID `db:"user_id" json:"user_id"`
	Role      UserRole  `db:"role" json:"role"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

Jump to

Keyboard shortcuts

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