scanner

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAllMetadata

func ExtractAllMetadata(inputs []string) (map[string]*Metadata, error)

func LoadAllAudioFiles added in v0.8.0

func LoadAllAudioFiles(dirPath string) (map[string]os.FileInfo, error)

Types

type ChangeDetector

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

func NewChangeDetector

func NewChangeDetector(rootFolder string) *ChangeDetector

func (*ChangeDetector) Scan

func (s *ChangeDetector) Scan(lastModifiedSince time.Time) (changed []string, deleted []string, err error)

type FolderScanner

type FolderScanner interface {
	Scan(ctx context.Context, lastModifiedSince time.Time) error
}

type Metadata

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

func (*Metadata) Album

func (m *Metadata) Album() string

func (*Metadata) AlbumArtist

func (m *Metadata) AlbumArtist() string

func (*Metadata) Artist

func (m *Metadata) Artist() string

func (*Metadata) BitRate

func (m *Metadata) BitRate() int

func (*Metadata) Comment

func (m *Metadata) Comment() string

func (*Metadata) Compilation

func (m *Metadata) Compilation() bool

func (*Metadata) Composer

func (m *Metadata) Composer() string

func (*Metadata) DiscNumber

func (m *Metadata) DiscNumber() (int, int)

func (*Metadata) Duration

func (m *Metadata) Duration() float32

func (*Metadata) FilePath

func (m *Metadata) FilePath() string

func (*Metadata) Genre

func (m *Metadata) Genre() string

func (*Metadata) HasPicture

func (m *Metadata) HasPicture() bool

func (*Metadata) ModificationTime

func (m *Metadata) ModificationTime() time.Time

func (*Metadata) Size

func (m *Metadata) Size() int

func (*Metadata) Suffix

func (m *Metadata) Suffix() string

func (*Metadata) Title

func (m *Metadata) Title() string

func (*Metadata) TrackNumber

func (m *Metadata) TrackNumber() (int, int)

func (*Metadata) Year

func (m *Metadata) Year() int

type Scanner

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

func New

func New(ds model.DataStore) *Scanner

func (*Scanner) Rescan

func (s *Scanner) Rescan(mediaFolder string, fullRescan bool) error

func (*Scanner) RescanAll

func (s *Scanner) RescanAll(fullRescan bool) error

func (*Scanner) Status

func (s *Scanner) Status() []StatusInfo

type Status

type Status int
const (
	StatusComplete Status = iota
	StatusInProgress
	StatusError
)

type StatusInfo

type StatusInfo struct {
	MediaFolder string
	Status      Status
}

type TagScanner

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

func NewTagScanner

func NewTagScanner(rootFolder string, ds model.DataStore) *TagScanner

func (*TagScanner) Scan

func (s *TagScanner) Scan(ctx context.Context, lastModifiedSince time.Time) error

Scan algorithm overview: For each changed: Get all files from DB that starts with the folder, scan each file:

	    if file in folder is newer, update the one in DB
     if file in folder does not exists in DB, add
	    for each file in the DB that is not found in the folder, delete from DB

For each deleted folder: delete all files from DB that starts with the folder path Create new albums/artists, update counters:

     collect all albumIDs and artistIDs from previous steps
	    refresh the collected albums and artists with the metadata from the mediafiles

Delete all empty albums, delete all empty Artists

Jump to

Keyboard shortcuts

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