Documentation ¶
Index ¶
- Constants
- Variables
- func GetEntityByID(ctx context.Context, ds DataStore, id string) (interface{}, error)
- func IsAudioFile(filePath string) bool
- func IsImageFile(filePath string) bool
- func IsValidPlaylist(filePath string) bool
- type Album
- type AlbumRepository
- type Albums
- type AnnotatedRepository
- type Annotations
- type Artist
- type ArtistIndex
- type ArtistIndexes
- type ArtistInfo
- type ArtistRepository
- type Artists
- type ArtworkID
- type Bookmark
- type Bookmarkable
- type BookmarkableRepository
- type Bookmarks
- type DataStore
- type DiscID
- type Discs
- type Genre
- type GenreRepository
- type Genres
- type Kind
- type Line
- type LyricList
- type Lyrics
- type MediaFile
- type MediaFileRepository
- type MediaFiles
- type MediaFolder
- type MediaFolderRepository
- type MediaFolders
- type PlayQueue
- type PlayQueueRepository
- type PlayQueues
- type Player
- type PlayerRepository
- type Players
- type Playlist
- func (pls *Playlist) AddMediaFiles(mfs MediaFiles)
- func (pls *Playlist) AddTracks(mediaFileIds []string)
- func (pls Playlist) CoverArtID() ArtworkID
- func (pls Playlist) IsSmartPlaylist() bool
- func (pls Playlist) MediaFiles() MediaFiles
- func (pls *Playlist) RemoveTracks(idxToRemove []int)
- func (pls *Playlist) ToM3U8() string
- type PlaylistRepository
- type PlaylistTrack
- type PlaylistTrackRepository
- type PlaylistTracks
- type Playlists
- type PropertyRepository
- type QueryOptions
- type Radio
- type RadioRepository
- type Radios
- type ResourceRepository
- type ScrobbleBufferRepository
- type ScrobbleEntries
- type ScrobbleEntry
- type Share
- type ShareRepository
- type Shares
- type Transcoding
- type TranscodingRepository
- type Transcodings
- type User
- type UserPropsRepository
- type UserRepository
- type Users
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"} )
Functions ¶
func GetEntityByID ¶ added in v0.49.0
TODO: Should the type be encoded in the ID?
func IsAudioFile ¶ added in v0.49.0
func IsImageFile ¶ added in v0.49.0
func IsValidPlaylist ¶ added in v0.49.0
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
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
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 Annotations ¶
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 (Artist) CoverArtID ¶ added in v0.49.0
type ArtistIndex ¶
type ArtistIndexes ¶
type ArtistIndexes []ArtistIndex
type ArtistInfo ¶
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 ArtworkID ¶ added in v0.49.0
func MustParseArtworkID ¶ added in v0.49.0
func NewArtworkID ¶ added in v0.49.0
func ParseArtworkID ¶ added in v0.49.0
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 DataStore ¶
type DataStore interface { Album(ctx context.Context) AlbumRepository Artist(ctx context.Context) ArtistRepository MediaFile(ctx context.Context) MediaFileRepository MediaFolder(ctx context.Context) MediaFolderRepository Genre(ctx context.Context) GenreRepository Playlist(ctx context.Context) PlaylistRepository PlayQueue(ctx context.Context) PlayQueueRepository Transcoding(ctx context.Context) TranscodingRepository Player(ctx context.Context) PlayerRepository Radio(ctx context.Context) RadioRepository Property(ctx context.Context) PropertyRepository User(ctx context.Context) UserRepository UserProps(ctx context.Context) UserPropsRepository ScrobbleBuffer(ctx context.Context) ScrobbleBufferRepository Resource(ctx context.Context, model interface{}) ResourceRepository WithTx(func(tx DataStore) error) error GC(ctx context.Context, rootFolder string) error }
type GenreRepository ¶
type GenreRepository interface { GetAll(...QueryOptions) (Genres, error) Put(*Genre) error }
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"` }
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 (MediaFile) ContentType ¶
func (MediaFile) CoverArtID ¶ added in v0.49.0
func (MediaFile) StructuredLyrics ¶ added in v0.51.0
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 ¶
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 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 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) CoverArtID ¶ added in v0.49.0
func (Playlist) IsSmartPlaylist ¶ added in v0.47.0
func (Playlist) MediaFiles ¶ added in v0.47.0
func (pls Playlist) MediaFiles() MediaFiles
func (*Playlist) RemoveTracks ¶ added in v0.47.0
func (*Playlist) ToM3U8 ¶ added in v0.49.0
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 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 PropertyRepository ¶
type QueryOptions ¶
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 ResourceRepository ¶
type ResourceRepository interface { rest.Repository }
type ScrobbleBufferRepository ¶ added in v0.45.0
type ScrobbleEntries ¶ added in v0.45.0
type ScrobbleEntries []ScrobbleEntry
type ScrobbleEntry ¶ added in v0.45.0
type ShareRepository ¶ added in v0.44.0
type ShareRepository interface {}
type Transcoding ¶
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 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) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.