model

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 24 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// TODO Move other prop keys to here
	PropLastScan = "LastScan"
)

Variables

View Source
var (
	KindMediaFileArtwork = Kind{"mf", "media_file"}
	KindArtistArtwork    = Kind{"ar", "artist"}
	KindAlbumArtwork     = Kind{"al", "album"}
	KindPlaylistArtwork  = Kind{"pl", "playlist"}
)
View Source
var (
	ErrNotFound      = errors.New("data not found")
	ErrInvalidAuth   = errors.New("invalid authentication")
	ErrNotAuthorized = errors.New("not authorized")
	ErrExpired       = errors.New("access expired")
	ErrNotAvailable  = errors.New("functionality not available")
)

Functions

func GetEntityByID added in v0.49.0

func GetEntityByID(ctx context.Context, ds DataStore, id string) (interface{}, error)

TODO: Should the type be encoded in the ID?

func IsAudioFile added in v0.49.0

func IsAudioFile(filePath string) bool

func IsImageFile added in v0.49.0

func IsImageFile(filePath string) bool

func IsValidPlaylist added in v0.49.0

func IsValidPlaylist(filePath string) bool

Types

type Album

type Album struct {
	Annotations `structs:"-"`

	ID                    string     `structs:"id" json:"id"`
	Name                  string     `structs:"name" json:"name"`
	EmbedArtPath          string     `structs:"embed_art_path" json:"embedArtPath"`
	ArtistID              string     `structs:"artist_id" json:"artistId"`
	Artist                string     `structs:"artist" json:"artist"`
	AlbumArtistID         string     `structs:"album_artist_id" json:"albumArtistId"`
	AlbumArtist           string     `structs:"album_artist" json:"albumArtist"`
	AllArtistIDs          string     `structs:"all_artist_ids" json:"allArtistIds"`
	MaxYear               int        `structs:"max_year" json:"maxYear"`
	MinYear               int        `structs:"min_year" json:"minYear"`
	Date                  string     `structs:"date" json:"date,omitempty"`
	MaxOriginalYear       int        `structs:"max_original_year" json:"maxOriginalYear"`
	MinOriginalYear       int        `structs:"min_original_year" json:"minOriginalYear"`
	OriginalDate          string     `structs:"original_date" json:"originalDate,omitempty"`
	ReleaseDate           string     `structs:"release_date" json:"releaseDate,omitempty"`
	Releases              int        `structs:"releases" json:"releases"`
	Compilation           bool       `structs:"compilation" json:"compilation"`
	Comment               string     `structs:"comment" json:"comment,omitempty"`
	SongCount             int        `structs:"song_count" json:"songCount"`
	Duration              float32    `structs:"duration" json:"duration"`
	Size                  int64      `structs:"size" json:"size"`
	Genre                 string     `structs:"genre" json:"genre"`
	Genres                Genres     `structs:"-" json:"genres"`
	Discs                 Discs      `structs:"discs" json:"discs,omitempty"`
	FullText              string     `structs:"full_text" json:"fullText"`
	SortAlbumName         string     `structs:"sort_album_name" json:"sortAlbumName,omitempty"`
	SortArtistName        string     `structs:"sort_artist_name" json:"sortArtistName,omitempty"`
	SortAlbumArtistName   string     `structs:"sort_album_artist_name" json:"sortAlbumArtistName,omitempty"`
	OrderAlbumName        string     `structs:"order_album_name" json:"orderAlbumName"`
	OrderAlbumArtistName  string     `structs:"order_album_artist_name" json:"orderAlbumArtistName"`
	CatalogNum            string     `structs:"catalog_num" json:"catalogNum,omitempty"`
	MbzAlbumID            string     `structs:"mbz_album_id" json:"mbzAlbumId,omitempty"`
	MbzAlbumArtistID      string     `structs:"mbz_album_artist_id" json:"mbzAlbumArtistId,omitempty"`
	MbzAlbumType          string     `structs:"mbz_album_type" json:"mbzAlbumType,omitempty"`
	MbzAlbumComment       string     `structs:"mbz_album_comment" json:"mbzAlbumComment,omitempty"`
	ImageFiles            string     `structs:"image_files" json:"imageFiles,omitempty"`
	Paths                 string     `structs:"paths" json:"paths,omitempty"`
	Description           string     `structs:"description" json:"description,omitempty"`
	SmallImageUrl         string     `structs:"small_image_url" json:"smallImageUrl,omitempty"`
	MediumImageUrl        string     `structs:"medium_image_url" json:"mediumImageUrl,omitempty"`
	LargeImageUrl         string     `structs:"large_image_url" json:"largeImageUrl,omitempty"`
	ExternalUrl           string     `structs:"external_url" json:"externalUrl,omitempty"`
	ExternalInfoUpdatedAt *time.Time `structs:"external_info_updated_at" json:"externalInfoUpdatedAt"`
	CreatedAt             time.Time  `structs:"created_at" json:"createdAt"`
	UpdatedAt             time.Time  `structs:"updated_at" json:"updatedAt"`
}

func (Album) CoverArtID added in v0.49.0

func (a Album) CoverArtID() ArtworkID

type AlbumRepository

type AlbumRepository interface {
	CountAll(...QueryOptions) (int64, error)
	Exists(id string) (bool, error)
	Put(*Album) error
	Get(id string) (*Album, error)
	GetAll(...QueryOptions) (Albums, error)
	GetAllWithoutGenres(...QueryOptions) (Albums, error)
	Search(q string, offset int, size int) (Albums, error)
	AnnotatedRepository
}

type Albums

type Albums []Album

func (Albums) ToAlbumArtist added in v0.49.0

func (als Albums) ToAlbumArtist() Artist

ToAlbumArtist creates an Artist object based on the attributes of this Albums collection. It assumes all albums have the same AlbumArtist, or else results are unpredictable.

type AnnotatedRepository

type AnnotatedRepository interface {
	IncPlayCount(itemID string, ts time.Time) error
	SetStar(starred bool, itemIDs ...string) error
	SetRating(rating int, itemID string) error
}

type Annotations

type Annotations struct {
	PlayCount int64      `structs:"-" json:"playCount"`
	PlayDate  *time.Time `structs:"-" json:"playDate" `
	Rating    int        `structs:"-" json:"rating"   `
	Starred   bool       `structs:"-" json:"starred"  `
	StarredAt *time.Time `structs:"-" json:"starredAt"`
}

type Artist

type Artist struct {
	Annotations `structs:"-"`

	ID                    string     `structs:"id" json:"id"`
	Name                  string     `structs:"name" json:"name"`
	AlbumCount            int        `structs:"album_count" json:"albumCount"`
	SongCount             int        `structs:"song_count" json:"songCount"`
	Genres                Genres     `structs:"-" json:"genres"`
	FullText              string     `structs:"full_text" json:"fullText"`
	SortArtistName        string     `structs:"sort_artist_name" json:"sortArtistName,omitempty"`
	OrderArtistName       string     `structs:"order_artist_name" json:"orderArtistName"`
	Size                  int64      `structs:"size" json:"size"`
	MbzArtistID           string     `structs:"mbz_artist_id" json:"mbzArtistId,omitempty"`
	Biography             string     `structs:"biography" json:"biography,omitempty"`
	SmallImageUrl         string     `structs:"small_image_url" json:"smallImageUrl,omitempty"`
	MediumImageUrl        string     `structs:"medium_image_url" json:"mediumImageUrl,omitempty"`
	LargeImageUrl         string     `structs:"large_image_url" json:"largeImageUrl,omitempty"`
	ExternalUrl           string     `structs:"external_url" json:"externalUrl,omitempty"`
	SimilarArtists        Artists    `structs:"similar_artists"  json:"-"`
	ExternalInfoUpdatedAt *time.Time `structs:"external_info_updated_at" json:"externalInfoUpdatedAt"`
}

func (Artist) ArtistImageUrl

func (a Artist) ArtistImageUrl() string

func (Artist) CoverArtID added in v0.49.0

func (a Artist) CoverArtID() ArtworkID

type ArtistIndex

type ArtistIndex struct {
	ID      string
	Artists Artists
}

type ArtistIndexes

type ArtistIndexes []ArtistIndex

type ArtistInfo

type ArtistInfo struct {
	ID             string
	Name           string
	MBID           string
	Biography      string
	SmallImageUrl  string
	MediumImageUrl string
	LargeImageUrl  string
	LastFMUrl      string
	SimilarArtists Artists
}

type ArtistRepository

type ArtistRepository interface {
	CountAll(options ...QueryOptions) (int64, error)
	Exists(id string) (bool, error)
	Put(m *Artist, colsToUpdate ...string) error
	Get(id string) (*Artist, error)
	GetAll(options ...QueryOptions) (Artists, error)
	Search(q string, offset int, size int) (Artists, error)
	GetIndex() (ArtistIndexes, error)
	AnnotatedRepository
}

type Artists

type Artists []Artist

type ArtworkID added in v0.49.0

type ArtworkID struct {
	Kind       Kind
	ID         string
	LastUpdate time.Time
}

func MustParseArtworkID added in v0.49.0

func MustParseArtworkID(id string) ArtworkID

func NewArtworkID added in v0.49.0

func NewArtworkID(kind Kind, id string, lastUpdate *time.Time) ArtworkID

func ParseArtworkID added in v0.49.0

func ParseArtworkID(id string) (ArtworkID, error)

func (ArtworkID) String added in v0.49.0

func (id ArtworkID) String() string

type Bookmark

type Bookmark struct {
	Item      MediaFile `structs:"item" json:"item"`
	Comment   string    `structs:"comment" json:"comment"`
	Position  int64     `structs:"position" json:"position"`
	ChangedBy string    `structs:"changed_by" json:"changed_by"`
	CreatedAt time.Time `structs:"created_at" json:"createdAt"`
	UpdatedAt time.Time `structs:"updated_at" json:"updatedAt"`
}

type Bookmarkable

type Bookmarkable struct {
	BookmarkPosition int64 `structs:"-" json:"bookmarkPosition"`
}

type BookmarkableRepository

type BookmarkableRepository interface {
	AddBookmark(id, comment string, position int64) error
	DeleteBookmark(id string) error
	GetBookmarks() (Bookmarks, error)
}

type Bookmarks

type Bookmarks []Bookmark

type DiscID added in v0.46.0

type DiscID struct {
	AlbumID     string `json:"albumId"`
	ReleaseDate string `json:"releaseDate"`
	DiscNumber  int    `json:"discNumber"`
}

type Discs added in v0.51.0

type Discs map[int]string

func (*Discs) Add added in v0.51.0

func (d *Discs) Add(discNumber int, discSubtitle string)

Add adds a disc to the Discs map. If the map is nil, it is initialized.

type Genre

type Genre struct {
	ID         string `structs:"id" json:"id,omitempty" toml:"id,omitempty" yaml:"id,omitempty"`
	Name       string `structs:"name" json:"name"`
	SongCount  int    `structs:"-" json:"-" toml:"-" yaml:"-"`
	AlbumCount int    `structs:"-" json:"-" toml:"-" yaml:"-"`
}

type GenreRepository

type GenreRepository interface {
	GetAll(...QueryOptions) (Genres, error)
	Put(*Genre) error
}

type Genres

type Genres []Genre

type Kind added in v0.49.0

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

func (Kind) String added in v0.49.0

func (k Kind) String() string

type Line added in v0.51.0

type Line struct {
	Start *int64 `structs:"start,omitempty" json:"start,omitempty"`
	Value string `structs:"value"           json:"value"`
}

type LyricList added in v0.51.0

type LyricList []Lyrics

type Lyrics added in v0.51.0

type Lyrics struct {
	DisplayArtist string `structs:"displayArtist,omitempty" json:"displayArtist,omitempty"`
	DisplayTitle  string `structs:"displayTitle,omitempty"  json:"displayTitle,omitempty"`
	Lang          string `structs:"lang"                    json:"lang"`
	Line          []Line `structs:"line"                    json:"line"`
	Offset        *int64 `structs:"offset,omitempty"        json:"offset,omitempty"`
	Synced        bool   `structs:"synced"                  json:"synced"`
}

func ToLyrics added in v0.51.0

func ToLyrics(language, text string) (*Lyrics, error)

type MediaFile

type MediaFile struct {
	Annotations  `structs:"-"`
	Bookmarkable `structs:"-"`

	ID                   string  `structs:"id" json:"id"`
	Path                 string  `structs:"path" json:"path"`
	Title                string  `structs:"title" json:"title"`
	Album                string  `structs:"album" json:"album"`
	ArtistID             string  `structs:"artist_id" json:"artistId"`
	Artist               string  `structs:"artist" json:"artist"`
	AlbumArtistID        string  `structs:"album_artist_id" json:"albumArtistId"`
	AlbumArtist          string  `structs:"album_artist" json:"albumArtist"`
	AlbumID              string  `structs:"album_id" json:"albumId"`
	HasCoverArt          bool    `structs:"has_cover_art" json:"hasCoverArt"`
	TrackNumber          int     `structs:"track_number" json:"trackNumber"`
	DiscNumber           int     `structs:"disc_number" json:"discNumber"`
	DiscSubtitle         string  `structs:"disc_subtitle" json:"discSubtitle,omitempty"`
	Year                 int     `structs:"year" json:"year"`
	Date                 string  `structs:"date" json:"date,omitempty"`
	OriginalYear         int     `structs:"original_year" json:"originalYear"`
	OriginalDate         string  `structs:"original_date" json:"originalDate,omitempty"`
	ReleaseYear          int     `structs:"release_year" json:"releaseYear"`
	ReleaseDate          string  `structs:"release_date" json:"releaseDate,omitempty"`
	Size                 int64   `structs:"size" json:"size"`
	Suffix               string  `structs:"suffix" json:"suffix"`
	Duration             float32 `structs:"duration" json:"duration"`
	BitRate              int     `structs:"bit_rate" json:"bitRate"`
	Channels             int     `structs:"channels" json:"channels"`
	Genre                string  `structs:"genre" json:"genre"`
	Genres               Genres  `structs:"-" json:"genres"`
	FullText             string  `structs:"full_text" json:"fullText"`
	SortTitle            string  `structs:"sort_title" json:"sortTitle,omitempty"`
	SortAlbumName        string  `structs:"sort_album_name" json:"sortAlbumName,omitempty"`
	SortArtistName       string  `structs:"sort_artist_name" json:"sortArtistName,omitempty"`
	SortAlbumArtistName  string  `structs:"sort_album_artist_name" json:"sortAlbumArtistName,omitempty"`
	OrderTitle           string  `structs:"order_title" json:"orderTitle,omitempty"`
	OrderAlbumName       string  `structs:"order_album_name" json:"orderAlbumName"`
	OrderArtistName      string  `structs:"order_artist_name" json:"orderArtistName"`
	OrderAlbumArtistName string  `structs:"order_album_artist_name" json:"orderAlbumArtistName"`
	Compilation          bool    `structs:"compilation" json:"compilation"`
	Comment              string  `structs:"comment" json:"comment,omitempty"`
	Lyrics               string  `structs:"lyrics" json:"lyrics"`
	Bpm                  int     `structs:"bpm" json:"bpm,omitempty"`
	CatalogNum           string  `structs:"catalog_num" json:"catalogNum,omitempty"`
	MbzRecordingID       string  `structs:"mbz_recording_id" json:"mbzRecordingID,omitempty"`
	MbzReleaseTrackID    string  `structs:"mbz_release_track_id" json:"mbzReleaseTrackId,omitempty"`
	MbzAlbumID           string  `structs:"mbz_album_id" json:"mbzAlbumId,omitempty"`
	MbzArtistID          string  `structs:"mbz_artist_id" json:"mbzArtistId,omitempty"`
	MbzAlbumArtistID     string  `structs:"mbz_album_artist_id" json:"mbzAlbumArtistId,omitempty"`
	MbzAlbumType         string  `structs:"mbz_album_type" json:"mbzAlbumType,omitempty"`
	MbzAlbumComment      string  `structs:"mbz_album_comment" json:"mbzAlbumComment,omitempty"`
	RgAlbumGain          float64 `structs:"rg_album_gain" json:"rgAlbumGain"`
	RgAlbumPeak          float64 `structs:"rg_album_peak" json:"rgAlbumPeak"`
	RgTrackGain          float64 `structs:"rg_track_gain" json:"rgTrackGain"`
	RgTrackPeak          float64 `structs:"rg_track_peak" json:"rgTrackPeak"`

	CreatedAt time.Time `structs:"created_at" json:"createdAt"` // Time this entry was created in the DB
	UpdatedAt time.Time `structs:"updated_at" json:"updatedAt"` // Time of file last update (mtime)
}

func (MediaFile) AlbumCoverArtID added in v0.49.0

func (mf MediaFile) AlbumCoverArtID() ArtworkID

func (MediaFile) ContentType

func (mf MediaFile) ContentType() string

func (MediaFile) CoverArtID added in v0.49.0

func (mf MediaFile) CoverArtID() ArtworkID

func (MediaFile) StructuredLyrics added in v0.51.0

func (mf MediaFile) StructuredLyrics() (LyricList, error)

type MediaFileRepository

type MediaFileRepository interface {
	CountAll(options ...QueryOptions) (int64, error)
	Exists(id string) (bool, error)
	Put(m *MediaFile) error
	Get(id string) (*MediaFile, error)
	GetAll(options ...QueryOptions) (MediaFiles, error)
	Search(q string, offset int, size int) (MediaFiles, error)
	Delete(id string) error

	// Queries by path to support the scanner, no Annotations or Bookmarks required in the response
	FindAllByPath(path string) (MediaFiles, error)
	FindByPath(path string) (*MediaFile, error)
	FindPathsRecursively(basePath string) ([]string, error)
	DeleteByPath(path string) (int64, error)

	AnnotatedRepository
	BookmarkableRepository
}

type MediaFiles

type MediaFiles []MediaFile

func (MediaFiles) Dirs added in v0.49.0

func (mfs MediaFiles) Dirs() []string

Dirs returns a deduped list of all directories from the MediaFiles' paths

func (MediaFiles) ToAlbum added in v0.49.0

func (mfs MediaFiles) ToAlbum() Album

ToAlbum creates an Album object based on the attributes of this MediaFiles collection. It assumes all mediafiles have the same Album, or else results are unpredictable.

type MediaFolder

type MediaFolder struct {
	ID   int32
	Name string
	Path string
}

func (MediaFolder) FS added in v0.48.0

func (f MediaFolder) FS() fs.FS

type MediaFolderRepository

type MediaFolderRepository interface {
	Get(id int32) (*MediaFolder, error)
	GetAll() (MediaFolders, error)
}

type MediaFolders

type MediaFolders []MediaFolder

type PlayQueue

type PlayQueue struct {
	ID        string     `structs:"id" json:"id"`
	UserID    string     `structs:"user_id" json:"userId"`
	Current   string     `structs:"current" json:"current"`
	Position  int64      `structs:"position" json:"position"`
	ChangedBy string     `structs:"changed_by" json:"changedBy"`
	Items     MediaFiles `structs:"-" json:"items,omitempty"`
	CreatedAt time.Time  `structs:"created_at" json:"createdAt"`
	UpdatedAt time.Time  `structs:"updated_at" json:"updatedAt"`
}

type PlayQueueRepository

type PlayQueueRepository interface {
	Store(queue *PlayQueue) error
	Retrieve(userId string) (*PlayQueue, error)
}

type PlayQueues

type PlayQueues []PlayQueue

type Player

type Player struct {
	ID              string    `structs:"id" json:"id"`
	Name            string    `structs:"name" json:"name"`
	UserAgent       string    `structs:"user_agent" json:"userAgent"`
	UserName        string    `structs:"user_name" json:"userName"`
	Client          string    `structs:"client" json:"client"`
	IPAddress       string    `structs:"ip_address" json:"ipAddress"`
	LastSeen        time.Time `structs:"last_seen" json:"lastSeen"`
	TranscodingId   string    `structs:"transcoding_id" json:"transcodingId"`
	MaxBitRate      int       `structs:"max_bit_rate" json:"maxBitRate"`
	ReportRealPath  bool      `structs:"report_real_path" json:"reportRealPath"`
	ScrobbleEnabled bool      `structs:"scrobble_enabled" json:"scrobbleEnabled"`
}

type PlayerRepository

type PlayerRepository interface {
	Get(id string) (*Player, error)
	FindMatch(userName, client, typ string) (*Player, error)
	Put(p *Player) error
}

type Players

type Players []Player

type Playlist

type Playlist struct {
	ID        string         `structs:"id" json:"id"`
	Name      string         `structs:"name" json:"name"`
	Comment   string         `structs:"comment" json:"comment"`
	Duration  float32        `structs:"duration" json:"duration"`
	Size      int64          `structs:"size" json:"size"`
	SongCount int            `structs:"song_count" json:"songCount"`
	OwnerName string         `structs:"-" json:"ownerName"`
	OwnerID   string         `structs:"owner_id" json:"ownerId"`
	Public    bool           `structs:"public" json:"public"`
	Tracks    PlaylistTracks `structs:"-" json:"tracks,omitempty"`
	Path      string         `structs:"path" json:"path"`
	Sync      bool           `structs:"sync" json:"sync"`
	CreatedAt time.Time      `structs:"created_at" json:"createdAt"`
	UpdatedAt time.Time      `structs:"updated_at" json:"updatedAt"`

	// SmartPlaylist attributes
	Rules       *criteria.Criteria `structs:"rules" json:"rules"`
	EvaluatedAt *time.Time         `structs:"evaluated_at" json:"evaluatedAt"`
}

func (*Playlist) AddMediaFiles added in v0.47.0

func (pls *Playlist) AddMediaFiles(mfs MediaFiles)

func (*Playlist) AddTracks added in v0.47.0

func (pls *Playlist) AddTracks(mediaFileIds []string)

func (Playlist) CoverArtID added in v0.49.0

func (pls Playlist) CoverArtID() ArtworkID

func (Playlist) IsSmartPlaylist added in v0.47.0

func (pls Playlist) IsSmartPlaylist() bool

func (Playlist) MediaFiles added in v0.47.0

func (pls Playlist) MediaFiles() MediaFiles

func (*Playlist) RemoveTracks added in v0.47.0

func (pls *Playlist) RemoveTracks(idxToRemove []int)

func (*Playlist) ToM3U8 added in v0.49.0

func (pls *Playlist) ToM3U8() string

ToM3U8 exports the playlist to the Extended M3U8 format, as specified in https://docs.fileformat.com/audio/m3u/#extended-m3u

type PlaylistRepository

type PlaylistRepository interface {
	ResourceRepository
	CountAll(options ...QueryOptions) (int64, error)
	Exists(id string) (bool, error)
	Put(pls *Playlist) error
	Get(id string) (*Playlist, error)
	GetWithTracks(id string, refreshSmartPlaylist bool) (*Playlist, error)
	GetAll(options ...QueryOptions) (Playlists, error)
	FindByPath(path string) (*Playlist, error)
	Delete(id string) error
	Tracks(playlistId string, refreshSmartPlaylist bool) PlaylistTrackRepository
}

type PlaylistTrack

type PlaylistTrack struct {
	ID          string `json:"id"`
	MediaFileID string `json:"mediaFileId"`
	PlaylistID  string `json:"playlistId"`
	MediaFile
}

type PlaylistTrackRepository

type PlaylistTrackRepository interface {
	ResourceRepository
	GetAll(options ...QueryOptions) (PlaylistTracks, error)
	GetAlbumIDs(options ...QueryOptions) ([]string, error)
	Add(mediaFileIds []string) (int, error)
	AddAlbums(albumIds []string) (int, error)
	AddArtists(artistIds []string) (int, error)
	AddDiscs(discs []DiscID) (int, error)
	Delete(id ...string) error
	DeleteAll() error
	Reorder(pos int, newPos int) error
}

type PlaylistTracks

type PlaylistTracks []PlaylistTrack

func (PlaylistTracks) MediaFiles added in v0.47.0

func (plt PlaylistTracks) MediaFiles() MediaFiles

type Playlists

type Playlists []Playlist

type PropertyRepository

type PropertyRepository interface {
	Put(id string, value string) error
	Get(id string) (string, error)
	Delete(id string) error
	DefaultGet(id string, defaultValue string) (string, error)
}

type QueryOptions

type QueryOptions struct {
	Sort    string
	Order   string
	Max     int
	Offset  int
	Filters squirrel.Sqlizer
}

type Radio added in v0.49.0

type Radio struct {
	ID          string    `structs:"id"            json:"id"`
	StreamUrl   string    `structs:"stream_url"    json:"streamUrl"`
	Name        string    `structs:"name"          json:"name"`
	HomePageUrl string    `structs:"home_page_url" json:"homePageUrl"`
	CreatedAt   time.Time `structs:"created_at"    json:"createdAt"`
	UpdatedAt   time.Time `structs:"updated_at"    json:"updatedAt"`
}

type RadioRepository added in v0.49.0

type RadioRepository interface {
	ResourceRepository
	CountAll(options ...QueryOptions) (int64, error)
	Delete(id string) error
	Get(id string) (*Radio, error)
	GetAll(options ...QueryOptions) (Radios, error)
	Put(u *Radio) error
}

type Radios added in v0.49.0

type Radios []Radio

type ResourceRepository

type ResourceRepository interface {
	rest.Repository
}

type ScrobbleBufferRepository added in v0.45.0

type ScrobbleBufferRepository interface {
	UserIDs(service string) ([]string, error)
	Enqueue(service, userId, mediaFileId string, playTime time.Time) error
	Next(service string, userId string) (*ScrobbleEntry, error)
	Dequeue(entry *ScrobbleEntry) error
	Length() (int64, error)
}

type ScrobbleEntries added in v0.45.0

type ScrobbleEntries []ScrobbleEntry

type ScrobbleEntry added in v0.45.0

type ScrobbleEntry struct {
	ID          string
	Service     string
	UserID      string
	PlayTime    time.Time
	EnqueueTime time.Time
	MediaFileID string
	MediaFile
}

type Share added in v0.44.0

type Share struct {
	ID            string     `structs:"id" json:"id,omitempty"`
	UserID        string     `structs:"user_id" json:"userId,omitempty"`
	Username      string     `structs:"-" json:"username,omitempty"`
	Description   string     `structs:"description" json:"description,omitempty"`
	Downloadable  bool       `structs:"downloadable" json:"downloadable"`
	ExpiresAt     *time.Time `structs:"expires_at" json:"expiresAt,omitempty"`
	LastVisitedAt *time.Time `structs:"last_visited_at" json:"lastVisitedAt,omitempty"`
	ResourceIDs   string     `structs:"resource_ids" json:"resourceIds,omitempty"`
	ResourceType  string     `structs:"resource_type" json:"resourceType,omitempty"`
	Contents      string     `structs:"contents" json:"contents,omitempty"`
	Format        string     `structs:"format" json:"format,omitempty"`
	MaxBitRate    int        `structs:"max_bit_rate" json:"maxBitRate,omitempty"`
	VisitCount    int        `structs:"visit_count" json:"visitCount,omitempty"`
	CreatedAt     time.Time  `structs:"created_at" json:"createdAt,omitempty"`
	UpdatedAt     time.Time  `structs:"updated_at" json:"updatedAt,omitempty"`
	Tracks        MediaFiles `structs:"-" json:"tracks,omitempty"`
	Albums        Albums     `structs:"-" json:"albums,omitempty"`
	URL           string     `structs:"-" json:"-"`
	ImageURL      string     `structs:"-" json:"-"`
}

func (Share) CoverArtID added in v0.49.0

func (s Share) CoverArtID() ArtworkID

type ShareRepository added in v0.44.0

type ShareRepository interface {
	Exists(id string) (bool, error)
	Get(id string) (*Share, error)
	GetAll(options ...QueryOptions) (Shares, error)
}

type Shares added in v0.44.0

type Shares []Share

type Transcoding

type Transcoding struct {
	ID             string `structs:"id" json:"id"`
	Name           string `structs:"name" json:"name"`
	TargetFormat   string `structs:"target_format" json:"targetFormat"`
	Command        string `structs:"command" json:"command"`
	DefaultBitRate int    `structs:"default_bit_rate" json:"defaultBitRate"`
}

type TranscodingRepository

type TranscodingRepository interface {
	Get(id string) (*Transcoding, error)
	CountAll(...QueryOptions) (int64, error)
	Put(*Transcoding) error
	FindByFormat(format string) (*Transcoding, error)
}

type Transcodings

type Transcodings []Transcoding

type User

type User struct {
	ID           string     `structs:"id" json:"id"`
	UserName     string     `structs:"user_name" json:"userName"`
	Name         string     `structs:"name" json:"name"`
	Email        string     `structs:"email" json:"email"`
	IsAdmin      bool       `structs:"is_admin" json:"isAdmin"`
	LastLoginAt  *time.Time `structs:"last_login_at" json:"lastLoginAt"`
	LastAccessAt *time.Time `structs:"last_access_at" json:"lastAccessAt"`
	CreatedAt    time.Time  `structs:"created_at" json:"createdAt"`
	UpdatedAt    time.Time  `structs:"updated_at" json:"updatedAt"`

	// This is only available on the backend, and it is never sent over the wire
	Password string `structs:"-" json:"-"`
	// This is used to set or change a password when calling Put. If it is empty, the password is not changed.
	// It is received from the UI with the name "password"
	NewPassword string `structs:"password,omitempty" json:"password,omitempty"`
	// If changing the password, this is also required
	CurrentPassword string `structs:"current_password,omitempty" json:"currentPassword,omitempty"`
}

type UserPropsRepository added in v0.44.0

type UserPropsRepository interface {
	Put(userId, key string, value string) error
	Get(userId, key string) (string, error)
	Delete(userId, key string) error
	DefaultGet(userId, key string, defaultValue string) (string, error)
}

type UserRepository

type UserRepository interface {
	CountAll(...QueryOptions) (int64, error)
	Get(id string) (*User, error)
	Put(*User) error
	UpdateLastLoginAt(id string) error
	UpdateLastAccessAt(id string) error
	FindFirstAdmin() (*User, error)
	// FindByUsername must be case-insensitive
	FindByUsername(username string) (*User, error)
	// FindByUsernameWithPassword is the same as above, but also returns the decrypted password
	FindByUsernameWithPassword(username string) (*User, error)
}

type Users

type Users []User

Directories

Path Synopsis
Package criteria implements a Criteria API based on Masterminds/squirrel
Package criteria implements a Criteria API based on Masterminds/squirrel

Jump to

Keyboard shortcuts

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