Documentation ¶
Index ¶
- Constants
- Variables
- type AudioConfig
- type AudioFormat
- type Config
- type DBConfig
- type DeleteCounter
- type ErrFileInUse
- type ErrInvalidMetadataField
- type ErrInvalidPlaylistEntry
- type File
- type FileMetadata
- type FileSource
- type Import
- type ImportLog
- type ImportLogs
- type ImportState
- type Log
- type LogLine
- type LogReader
- type Playlist
- type PlaylistEntry
- type Show
- type Store
- func (st *Store) AddImportLog(showID uint64, id uint64, importStep string, log *Log) (err error)
- func (st *Store) CloneShow(name, from uint64) (show *Show, err error)
- func (st *Store) Close()
- func (st *Store) CreateFile(showID uint64, file File) (*File, error)
- func (st *Store) CreatePlaylist(showID uint64, playlist Playlist) (*Playlist, error)
- func (st *Store) CreateShow(name uint64) (show *Show, err error)
- func (st *Store) DeleteFile(showID uint64, id uint64) (err error)
- func (st *Store) DeletePlaylist(showID uint64, id uint64) (err error)
- func (st *Store) DeleteShow(showID uint64) (err error)
- func (st *Store) GetFile(showID uint64, fileID uint64) (file *File, err error)
- func (st *Store) GetFilePath(showID uint64, fileID uint64) string
- func (st *Store) GetFileShowID(id uint64) (uint64, error)
- func (st *Store) GetFileUsage(showID uint64, id uint64) (playlists []Playlist, err error)
- func (st *Store) GetImportLogs(showID uint64, id uint64) (logs ImportLogs, err error)
- func (st *Store) GetPlaylist(showID uint64, id uint64) (playlist *Playlist, err error)
- func (st *Store) GetPlaylistAllShows(id uint64) (playlist *Playlist, err error)
- func (st *Store) GetPlaylistShowID(id uint64) (uint64, error)
- func (st *Store) GetRevision() string
- func (st *Store) Healthz(ctx context.Context) error
- func (st *Store) ListFiles(showID uint64, offset, limit int) (files []File, err error)
- func (st *Store) ListPlaylists(showID uint64, offset, limit int) (playlists []Playlist, err error)
- func (st *Store) ListPlaylistsAllShows(offset, limit int) (playlists []Playlist, err error)
- func (st *Store) ListShows() (shows []Show, err error)
- func (st *Store) ResetState() (deleteCounter DeleteCounter, err error)
- func (st *Store) SetFileImportStateAborted(showID uint64, id uint64, error string) (file *File, err error)
- func (st *Store) SetFileImportStateDone(showID uint64, id uint64) (*File, error)
- func (st *Store) SetFileImportStateInitializing(showID uint64, id uint64) (file *File, err error)
- func (st *Store) SetFileImportStatePending(showID uint64, id uint64) (file *File, err error)
- func (st *Store) SetFileImportStateRunning(showID uint64, id uint64) (file *File, err error)
- func (st *Store) UpdateFile(showID uint64, id uint64, file File) (out *File, err error)
- func (st *Store) UpdateFileMetadata(showID uint64, id uint64, metadata map[string]string) (file *File, err error)
- func (st *Store) UpdateFileSourceHash(showID uint64, id uint64, hash string) (*File, error)
- func (st *Store) UpdatePlaylist(showID uint64, id uint64, playlist Playlist) (out *Playlist, err error)
Constants ¶
View Source
const (
FileURIScheme = "file"
)
Variables ¶
View Source
var ( ErrNotImplemented = errors.New("not implemented") ErrNotFound = gorm.ErrRecordNotFound ErrShowAlreadyExists = errors.New("show already exists") ErrFileNotNew = errors.New("file does not exist or is not new") ErrFileImportNotDone = errors.New("file import is not done") ErrPlaylistHasMultipleNullDurationEntries = errors.New("playlists may only have one entry without a duration") )
Functions ¶
This section is empty.
Types ¶
type AudioConfig ¶
type AudioConfig struct { Format AudioFormat `json:"format" yaml:"format" toml:"format"` SampleRate uint `json:"sample-rate" yaml:"sample-rate" toml:"sample-rate"` }
type AudioFormat ¶
type AudioFormat int
const ( FormatWAV AudioFormat = iota FormatFlac )
func (AudioFormat) Extension ¶
func (f AudioFormat) Extension() string
func (AudioFormat) MarshalText ¶
func (f AudioFormat) MarshalText() (data []byte, err error)
func (AudioFormat) String ¶
func (f AudioFormat) String() string
func (*AudioFormat) UnmarshalText ¶
func (f *AudioFormat) UnmarshalText(data []byte) (err error)
type Config ¶
type Config struct { BasePath string `json:"path" yaml:"path" toml:"path"` Audio AudioConfig `json:"audio" yaml:"audio" toml:"audio"` DB DBConfig `json:"db" yaml:"db" toml:"db"` }
type DBConfig ¶
type DBConfig struct { Type string `json:"type" yaml:"type" toml:"type"` Host string `json:"host" yaml:"host" toml:"host"` Port uint16 `json:"port" yaml:"port" toml:"port"` TLS string `json:"tls" yaml:"tls" toml:"tls"` Username string `json:"username" yaml:"username" toml:"username"` Password string `json:"password" yaml:"password" toml:"password"` DB string `json:"database" yaml:"database" toml:"database"` Charset string `json:"charset" yaml:"charset" toml:"charset"` Debug bool `json:"debug" yaml:"debug" toml:"debug"` }
type DeleteCounter ¶
type ErrFileInUse ¶
type ErrFileInUse struct {
Playlists []Playlist `json:"playlists"`
}
func (*ErrFileInUse) Error ¶
func (e *ErrFileInUse) Error() string
type ErrInvalidMetadataField ¶
type ErrInvalidMetadataField string
func (ErrInvalidMetadataField) Error ¶
func (e ErrInvalidMetadataField) Error() string
type ErrInvalidPlaylistEntry ¶
type ErrInvalidPlaylistEntry struct {
// contains filtered or unexported fields
}
func (ErrInvalidPlaylistEntry) Error ¶
func (e ErrInvalidPlaylistEntry) Error() string
type File ¶
type File struct { ID uint64 `json:"id" gorm:"primary_key"` CreatedAt time.Time `json:"created"` UpdatedAt time.Time `json:"updated"` ShowID uint64 `json:"showId" gorm:"not null;index"` Show Show `json:"-" gorm:"association_foreignkey:ID"` Source FileSource `json:"source" gorm:"embedded;embedded_prefix:source__"` Metadata FileMetadata `json:"metadata" gorm:"embedded;embedded_prefix:metadata__"` Size uint64 `json:"size"` Duration float64 `json:"duration"` }
type FileMetadata ¶
type FileMetadata struct { // actually a full-text index would be nice here... Artist string `json:"artist,omitempty" gorm:"index"` Title string `json:"title,omitempty" gorm:"index"` Album string `json:"album,omitempty" gorm:"index"` Organization string `json:"organization,omitempty" gorm:"index"` ISRC string `json:"isrc,omitempty" gorm:"index"` }
type FileSource ¶
type Import ¶
type Import struct { State ImportState `json:"state" swaggertype:"string"` Error string `json:"error,omitempty"` }
type ImportLog ¶
type ImportLog struct { ID uint64 `gorm:"primary_key"` File File `gorm:"association_autoupdate:false;association_autocreate:false"` FileID uint64 `gorm:"not null;index;unique_index:unique_import_log_step"` ImportStep string `gorm:"not null;index;unique_index:unique_import_log_step"` Encoded []byte `gorm:"size:-1"` }
type ImportLogs ¶
Mind that ImportLogs is not []ImportLog but rather a map containing objects of type LOG
type ImportState ¶
type ImportState int
const ( ImportNew ImportState = iota ImportInitializing ImportPending ImportRunning ImportDone ImportAborted )
func (ImportState) MarshalText ¶
func (s ImportState) MarshalText() (data []byte, err error)
func (ImportState) String ¶
func (s ImportState) String() string
func (*ImportState) UnmarshalText ¶
func (s *ImportState) UnmarshalText(data []byte) (err error)
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
This implements json.Marshaler and therefore doesn't need `lines` to be public.
func (*Log) MarshalJSON ¶
type LogReader ¶
type LogReader struct {
// contains filtered or unexported fields
}
LogReader is not a perfect io.Reader:
- lines longer than len(p) will be truncated !!!
- it will only return one line on each invocation even if len(p) would allow us to return more than one line
type Playlist ¶
type Playlist struct { ID uint64 `json:"id" gorm:"primary_key"` CreatedAt time.Time `json:"created"` UpdatedAt time.Time `json:"updated"` Description string `json:"description"` PlayoutMode string `json:"playoutMode" gorm:"not null;default:'linear'"` ShowID uint64 `json:"showId" gorm:"not null;index"` Show Show `json:"-" gorm:"association_foreignkey:ID"` Entries []PlaylistEntry `json:"entries"` }
type PlaylistEntry ¶
type PlaylistEntry struct { ID uint64 `json:"-" gorm:"primary_key"` PlaylistID uint64 `json:"-" gorm:"not null;index;unique_index:unique_playlist_line_numbers"` LineNum uint `json:"-" gorm:"not null;unique_index:unique_playlist_line_numbers"` URI string `json:"uri" gorm:"size:1024"` Duration *float64 `json:"duration,omitempty"` File *File `json:"file,omitempty" gorm:"association_autoupdate:false;association_autocreate:false"` FileID *uint64 `json:"-" gorm:"index"` }
type Show ¶
type Store ¶
type Store struct { Audio AudioConfig // contains filtered or unexported fields }
func (*Store) AddImportLog ¶
func (*Store) CreatePlaylist ¶
func (*Store) CreateShow ¶
this will not fail if the show already exists
func (*Store) DeletePlaylist ¶
func (*Store) DeleteShow ¶
this will also remove all files and playlists belonging to the show!
func (*Store) GetFileUsage ¶
func (*Store) GetImportLogs ¶
func (st *Store) GetImportLogs(showID uint64, id uint64) (logs ImportLogs, err error)
func (*Store) GetPlaylist ¶
func (*Store) GetPlaylistAllShows ¶
func (*Store) GetRevision ¶
func (*Store) ListPlaylists ¶
func (*Store) ListPlaylistsAllShows ¶
func (*Store) ResetState ¶
func (st *Store) ResetState() (deleteCounter DeleteCounter, err error)
func (*Store) SetFileImportStateAborted ¶
func (*Store) SetFileImportStateDone ¶
func (*Store) SetFileImportStateInitializing ¶
func (*Store) SetFileImportStatePending ¶
func (*Store) SetFileImportStateRunning ¶
func (*Store) UpdateFile ¶
func (*Store) UpdateFileMetadata ¶
func (*Store) UpdateFileSourceHash ¶
Click to show internal directories.
Click to hide internal directories.