scanner

package
v0.0.0-...-4aa44aa Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package scanner is responsible for generating a tree-like structure of albums and tracks based on the contents of a directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	// Thumbnail is a path of an album cover. If the thumbnail is not
	// available then this field is set to an empty string.
	Thumbnail string

	// AccessFile is a path of an access file. If the access file is not
	// available then this field is set to an empty string.
	AccessFile string

	// Albums uses album titles as its keys.
	Albums map[string]*Album

	// Tracks uses track titles as its keys.
	Tracks map[string]Track
}

Album is a collection of songs and albums.

type Config

type Config struct {
	TrackExtensions     []string
	ThumbnailStems      []string
	ThumbnailExtensions []string
}

func (Config) Validate

func (c Config) Validate() error

type Scanner

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

Scanner watches a hard drive directory containing audio files and produces updates whenever its contents change.

func New

func New(directory string, config Config) (*Scanner, error)

New creates a new scanner which will watch the specified directory when started.

func (*Scanner) Start

func (s *Scanner) Start() (<-chan Album, error)

Start starts the watcher and returns a channel on which the updates are sent whenever available. At least one update will be sent on the channel immidiately after calling this method.

type Track

type Track struct {
	Path string
}

Track represents an audio track.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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