Documentation ¶
Index ¶
- Variables
- func CategoryDelete(cat *Category) error
- func CategoryIdExists(id string) bool
- func CategoryIsEmpty(id string) bool
- func CategoryNameExists(name string) bool
- func CategoryReindex(cat *Category, index int64) error
- func CategoryUpdate(cat *Category, name string, media_type string) error
- func InputFileCreate(inp *InputFile) error
- func InputFileDelete(inp *InputFile) error
- func InputFileExistsForSource(source_location string) bool
- func JwtKeyGet() ([]byte, error)
- func LibraryReady() error
- func LibraryShutdown()
- func LibraryStartup(database_path string) error
- func MediaPathGet() (string, error)
- func MediaPathSet(new_path string) error
- func MediaPathValid() bool
- func MetadataCreate(md *Metadata) error
- func MetadataDelete(md *Metadata, delete_children bool) error
- func MetadataIdExists(id string) bool
- func MetadataIsEmpty(id string) bool
- func MigrateTo(level_target uint32) (err error)
- func MigrateToLatest() (err error)
- func MigrationLevelGet() (level uint32)
- func PropertyDelete(key string) error
- func PropertyGet(key string) (string, error)
- func PropertyList() (map[string]string, error)
- func PropertySet(key string, value string) error
- type Category
- func (cat *Category) Copy() *Category
- func (cat *Category) DiskPath() string
- func (cat_a *Category) FieldsDifference(other dbRecord) (diff map[string]any, err error)
- func (cat *Category) FieldsPatch(fields map[string]any) (err error)
- func (cat *Category) FieldsRead() (fields map[string]any, err error)
- func (cat *Category) FieldsReplace(fields map[string]any) (err error)
- func (cat *Category) GetId() string
- func (cat *Category) RecordCopy() (dbRecord, error)
- func (cat *Category) RecordCreate(fields map[string]any) (instance dbRecord, err error)
- func (cat *Category) SetId(id string)
- func (cat *Category) TableName() string
- type CategoryMediaType
- type FileStream
- type FileStreamType
- type InputFile
- func (inp *InputFile) Copy() *InputFile
- func (inp_a *InputFile) FieldsDifference(other dbRecord) (diff map[string]any, err error)
- func (inp *InputFile) FieldsPatch(fields map[string]any) (err error)
- func (inp *InputFile) FieldsRead() (fields map[string]any, err error)
- func (inp *InputFile) FieldsReplace(fields map[string]any) (err error)
- func (inp *InputFile) GetId() string
- func (inp *InputFile) OutputNames() (name_display string, name_sort string, path string)
- func (inp *InputFile) OutputType() FileStreamType
- func (inp *InputFile) RecordCopy() (dbRecord, error)
- func (inp *InputFile) RecordCreate(fields map[string]any) (instance dbRecord, err error)
- func (inp *InputFile) Remap(source_stream_map []int64) error
- func (inp *InputFile) SetId(id string)
- func (inp *InputFile) StatusDidSucceed() bool
- func (inp *InputFile) StatusReset() error
- func (inp *InputFile) StatusSetFailed(time int64, error string) error
- func (inp *InputFile) StatusSetStarted(time int64, command string) error
- func (inp *InputFile) StatusSetSucceeded(time int64) error
- func (inp *InputFile) TableName() string
- type Metadata
- func (md *Metadata) Copy() *Metadata
- func (md *Metadata) DiskPath(path_type MetadataPathType) (string, error)
- func (md_a *Metadata) FieldsDifference(other dbRecord) (diff map[string]any, err error)
- func (md *Metadata) FieldsPatch(fields map[string]any) (err error)
- func (md *Metadata) FieldsRead() (fields map[string]any, err error)
- func (md *Metadata) FieldsReplace(fields map[string]any) (err error)
- func (md *Metadata) GetId() string
- func (md *Metadata) RecordCopy() (dbRecord, error)
- func (md *Metadata) RecordCreate(fields map[string]any) (instance dbRecord, err error)
- func (md *Metadata) Rename(new_name_display string, new_name_sort string) error
- func (md *Metadata) Reparent(new_parent_id string) error
- func (md *Metadata) SetId(id string)
- func (md *Metadata) SetPoster(img image.Image) error
- func (md *Metadata) TableName() string
- type MetadataMediaType
- type MetadataPathType
- type MetadataTreeNode
- type Migration
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDbNotOpened = fmt.Errorf("database not opened")
View Source
var ErrDbPathNotSet = fmt.Errorf("database path not set")
View Source
var ErrInvalidMediaType = fmt.Errorf("invalid media type")
View Source
var ErrInvalidName = fmt.Errorf("invalid name")
View Source
var ErrInvalidProperty = fmt.Errorf("invalid property")
View Source
var ErrInvalidStreamIndex = fmt.Errorf("invalid stream index")
View Source
var ErrInvalidType = fmt.Errorf("invalid type")
View Source
var ErrMediaPathNotDir = fmt.Errorf("media path not a valid directory")
View Source
var ErrMediaPathNotSet = fmt.Errorf("media path not set")
View Source
var ErrMissingAudioStream = fmt.Errorf("missing audio stream")
View Source
var ErrMissingVideoStream = fmt.Errorf("missing video stream")
View Source
var ErrNotFound = fmt.Errorf("not found")
View Source
var ErrPathExists = fmt.Errorf("path already exists")
View Source
var ErrQueryFailed = fmt.Errorf("database query failed")
View Source
var InvalidDiskCharacters *regexp.Regexp = regexp.MustCompile(`[<>:"/\\|?*$!%\'` + "`" + `~]`)
characters not allowed in Category.Name, or Metadata.NameSort fields (characters disallowed by exfat, plus some extras)
View Source
var Migrations []Migration = []Migration{
&migration0000{},
&migration0001{},
&migration0002{},
}
Functions ¶
func CategoryDelete ¶
func CategoryIdExists ¶
func CategoryIsEmpty ¶
func CategoryNameExists ¶
func CategoryReindex ¶
func InputFileCreate ¶
func InputFileDelete ¶
func LibraryReady ¶
func LibraryReady() error
func LibraryShutdown ¶
func LibraryShutdown()
func LibraryStartup ¶
func MediaPathGet ¶
func MediaPathSet ¶
Set the media path. This involves moving the media directory, and may take a while. This call should not be allowed from a web interface.
func MediaPathValid ¶
func MediaPathValid() bool
func MetadataCreate ¶
func MetadataDelete ¶
func MetadataIdExists ¶
func MetadataIsEmpty ¶
func MigrateTo ¶
Migrate to specified level. NOTE: Creates a backup of db before starting, and rolls back if migration fails. NOTE: This will overwrite the current backup file.
func PropertyDelete ¶
func PropertyGet ¶
func PropertyList ¶
List all properties that can be freely edited.
func PropertySet ¶
Types ¶
type Category ¶
type Category struct { Id string `json:"id"` MediaType CategoryMediaType `json:"media_type"` Name string `json:"name"` SortIndex int64 `json:"sort_index"` }
func CategoryCreate ¶
func CategoryCreate(name string, media_type CategoryMediaType) (*Category, error)
func CategoryList ¶
func CategoryRead ¶
func (*Category) FieldsDifference ¶
func (*Category) FieldsReplace ¶
func (*Category) RecordCopy ¶
func (*Category) RecordCreate ¶
type CategoryMediaType ¶
type CategoryMediaType string
const ( CategoryMediaTypeMovie CategoryMediaType = "movie" CategoryMediaTypeSeries CategoryMediaType = "series" CategoryMediaTypeMusic CategoryMediaType = "music" )
type FileStream ¶
type FileStream struct { StreamType FileStreamType `json:"stream_type"` Index int64 `json:"index"` Codec string `json:"codec"` Width int64 `json:"width"` Height int64 `json:"height"` Fps int64 `json:"fps"` Channels int64 `json:"channels"` Language string `json:"language"` }
func FileStreamsList ¶
func FileStreamsList(path string) (file_streams []FileStream, duration int64, err error)
func (*FileStream) Copy ¶
func (stream *FileStream) Copy() *FileStream
type FileStreamType ¶
type FileStreamType string
const ( FileStreamTypeVideo FileStreamType = "video" FileStreamTypeAudio FileStreamType = "audio" FileStreamTypeSubtitle FileStreamType = "subtitle" )
type InputFile ¶
type InputFile struct { Id string `json:"id"` // Metadata.Id == InputFile.Id SourceLocation string `json:"source_location"` // path to source file SourceStreams []FileStream `json:"source_streams"` StreamMap []int64 `json:"stream_map"` // empty == needs_map SourceDuration int64 `json:"source_duration"` // length of media in seconds TimeScanned int64 `json:"time_scanned"` TranscodingCommand string `json:"transcoding_command"` // ffmpeg command line TranscodingTimeStarted int64 `json:"transcoding_time_started"` // time transcoding was started TranscodingTimeElapsed int64 `json:"transcoding_time_elapsed"` // seconds elapsed during transcoding TranscodingError string `json:"transcoding_error"` // error message from transcoding process }
func InputFileList ¶
func InputFileRead ¶
func (*InputFile) FieldsDifference ¶
func (*InputFile) FieldsPatch ¶
func (*InputFile) FieldsRead ¶
func (*InputFile) FieldsReplace ¶
func (*InputFile) OutputNames ¶
func (*InputFile) OutputType ¶
func (inp *InputFile) OutputType() FileStreamType
func (*InputFile) RecordCopy ¶
func (*InputFile) RecordCreate ¶
func (*InputFile) StatusDidSucceed ¶
func (*InputFile) StatusReset ¶
func (*InputFile) StatusSetFailed ¶
func (*InputFile) StatusSetStarted ¶
func (*InputFile) StatusSetSucceeded ¶
type Metadata ¶
type Metadata struct { Id string `json:"id"` ParentId string `json:"parent_id"` MediaType MetadataMediaType `json:"media_type"` NameDisplay string `json:"name_display"` NameSort string `json:"name_sort"` Streams []FileStream `json:"streams"` Duration int64 `json:"duration"` Size int64 `json:"size"` }
func MetadataForParent ¶
func MetadataRead ¶
func (*Metadata) DiskPath ¶
func (md *Metadata) DiskPath(path_type MetadataPathType) (string, error)
func (*Metadata) FieldsDifference ¶
func (*Metadata) FieldsReplace ¶
func (*Metadata) RecordCopy ¶
func (*Metadata) RecordCreate ¶
type MetadataMediaType ¶
type MetadataMediaType string
const ( MetadataMediaTypeFileVideo MetadataMediaType = "file-video" MetadataMediaTypeFileAudio MetadataMediaType = "file-audio" MetadataMediaTypeSeries MetadataMediaType = "series" MetadataMediaTypeSeason MetadataMediaType = "season" MetadataMediaTypeArtist MetadataMediaType = "artist" MetadataMediaTypeAlbum MetadataMediaType = "album" )
type MetadataPathType ¶
type MetadataPathType string
const ( MetadataPathTypeBase MetadataPathType = "base" MetadataPathTypeMedia MetadataPathType = "media" MetadataPathTypePosterLarge MetadataPathType = "poster_large" MetadataPathTypePosterSmall MetadataPathType = "poster_small" )
type MetadataTreeNode ¶
type MetadataTreeNode struct { Id string `json:"id"` Name string `json:"name"` MediaType string `json:"media_type"` Children []MetadataTreeNode `json:"children"` // not a map because want this ordered }
func MetadataParentTree ¶
func MetadataParentTree(parent_id string) ([]MetadataTreeNode, error)
Click to show internal directories.
Click to hide internal directories.