folders2crates

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTrackNotFound = errors.New("track not found in MixxxDB")

Functions

func CountTracks

func CountTracks(crates []CrateFolder) int

Counts the total number of tracks in the given array of CrateFolders.

func FindTrackIDs

func FindTrackIDs(db mixxxdb.MixxxDB, tracks []TrackFile) ([]int, error)

FindTrackIDs searches the DB to find the track IDs corresponding to the given track files. Returns an error wrapping one or multiple `ErrTrackNotFound`s if there are tracks that cannot be found in Mixxx's DB.

func IsTrackFile

func IsTrackFile(filename string) bool

IsTrackFile detects if a file at the given path is indeed a track that can be played by Mixxx. Returns true iff the filename has an extension that is supported by Mixxx. See https://manual.mixxx.org/2.0/en/chapters/configuration.html#importing-your-audio-files for the list of supported files

func NameCrate

func NameCrate(relpath string) string

NameCrate creates a name for a crate based on its path relative to the music library. Replaces folder separators with - E.g. House/90's becomes House - 90's

func UpdateCrateInDB

func UpdateCrateInDB(db mixxxdb.MixxxDB, crate CrateFolder) error

UpdateCrateInDB ...

Types

type CrateFolder

type CrateFolder struct {
	Name   string
	Tracks []TrackFile
}

func FindCrateFolders

func FindCrateFolders(libfolder string, ignore *ignore.GitIgnore) ([]CrateFolder, error)

FindCrateFolders searches the given folder for music tracks that Mixxx can play. When it finds a folder with at least track in it, it will make a crate with the name of the path to that folder and the tracks that are directly inside the folder. Respects the ignore patterns specified with the github.com/sabhiram/go-gitignore library. Note: Tracks will not have any database IDs.

type TrackFile

type TrackFile string

TrackFile is a filepath to a music file that can be played by Mixxx. See `IsTrackFile` to see what types of files qualify.

func FindTrackFiles

func FindTrackFiles(folder string, ignore *ignore.GitIgnore) ([]TrackFile, error)

FindTrackFiles finds all tracks that can be played by Mixxx in a given folder. Respects the ignore patterns specified with the github.com/sabhiram/go-gitignore library. Note: Does *not* search recursively.

Jump to

Keyboard shortcuts

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