Documentation
¶
Index ¶
- func GetVideoFilesFromDir(dirToSearch string) ([]string, error)
- type Cache
- type CommandDecider
- type Manager
- func (m *Manager) ImportCompletedJobs(jobs []controller.CompletedJob)
- func (m *Manager) LibrarySettings() ([]controller.Library, error)
- func (m *Manager) PopNewJob() (controller.Job, error)
- func (m *Manager) Start(ctx *context.Context, wg *sync.WaitGroup)
- func (m *Manager) UpdateLibrarySettings(libSettings map[int]controller.Library)
- type MetadataReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetVideoFilesFromDir ¶
GetVideoFilesFromDir returns a string slice of video files, found recursively from dirToSearch.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache sits in front of a MetadataReader and only calls it for a Read call when the file has updated(based on the modtime)
func NewCache ¶
func NewCache(m MetadataReader, f controller.FileCacheDataStorer, l controller.Logger) Cache
NewCache returns a new Cache.
func (*Cache) Read ¶
func (c *Cache) Read(path string) (controller.FileMetadata, error)
Read uses the data storer and file.Stat to determine whether or not to call the MetadataReader or return from the cache.
type CommandDecider ¶
type CommandDecider interface {
Decide(m controller.FileMetadata, cmdDeciderSettings string) (cmd []string, err error)
DefaultSettings() string
}
The CommandDecider interface defines how a CommandDecider should behave.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager satisfies the conroller.LibraryManager interface.
func NewManager ¶
func NewManager(logger controller.Logger, ds controller.LibraryManagerDataStorer, metadataReader MetadataReader, commandDecider CommandDecider) Manager
NewManager return a new Manager.
func (*Manager) ImportCompletedJobs ¶
func (m *Manager) ImportCompletedJobs(jobs []controller.CompletedJob)
ImportCompletedJobs takes a list of completed jobs and imports them and their files into the system.
func (*Manager) LibrarySettings ¶
func (m *Manager) LibrarySettings() ([]controller.Library, error)
LibrarySettings returns the current settings of each library in the data store.
func (*Manager) PopNewJob ¶
func (m *Manager) PopNewJob() (controller.Job, error)
PopNewJob returns and deletes a job from the library queues in order of priority.
func (*Manager) UpdateLibrarySettings ¶
func (m *Manager) UpdateLibrarySettings(libSettings map[int]controller.Library)
UpdateLibrarySettings loops through each entry in the provided map and applies the new settings if the key matches a valid library. However, it will not update the ID and Queue fields. If the key doesn't match a valid library, a brand new one with the provided settings is created.
type MetadataReader ¶
type MetadataReader interface {
Read(path string) (controller.FileMetadata, error)
}
The MetadataReader interface defines how a MetadataReader should behave.