scanner

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: GPL-3.0 Imports: 23 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)

Types

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) DiscSubtitle added in v0.19.0

func (m *Metadata) DiscSubtitle() string

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() int64

func (*Metadata) SortAlbum added in v0.16.0

func (m *Metadata) SortAlbum() string

func (*Metadata) SortAlbumArtist added in v0.16.0

func (m *Metadata) SortAlbumArtist() string

func (*Metadata) SortArtist added in v0.16.0

func (m *Metadata) SortArtist() string

func (*Metadata) SortTitle added in v0.16.0

func (m *Metadata) SortTitle() string

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

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

Scanner algorithm overview: Load all directories under the music folder, with their ModTime (self or any non-dir children, whichever is newer) Load all directories from the DB Compare both collections to find changed folders (based on lastModifiedSince) and deleted folders For each deleted folder: delete all files from DB whose path starts with the delete folder path (non-recursively) For each changed folder: get all files from DB whose path starts with the changed folder (non-recursively), check each file:

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

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

For each changed folder, process playlists:

If the playlist is not in the DB, import it, setting sync = true
If the playlist is in the DB and sync == true, import it, or else skip it

Delete all empty albums, delete all empty artists, clean-up playlists

Jump to

Keyboard shortcuts

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