config

package
v0.0.0-...-ecb31cf Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config handles configurations for go-music, it saves config files about color themes, libraries caches and so on in software's work dir(in user's home dir).

Index

Constants

View Source
const WorkDirName = "go-music"

Variables

This section is empty.

Functions

func GenerateFile

func GenerateFile(path string, c Configuration) error

func LoadConfigFromWorkDir

func LoadConfigFromWorkDir(c Configuration) error

LoadConfigFromWorkDir reads config file in software's work dir(in user's home dir) and fills given Configuration with unmarshal config.

func SaveConfigInWorkDir

func SaveConfigInWorkDir(c Configuration) error

Types

type Configuration

type Configuration interface {
	FileName() string
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

type Library

type Library struct {
	Name   string // NOTICE: it's a unique id, it's determined by users or default, not the basename of the dirpath
	Path   string // complete path
	Tracks []Track
}

type LibraryConfiguration

type LibraryConfiguration struct {
	Libraries []Library
}

func (*LibraryConfiguration) FileName

func (l *LibraryConfiguration) FileName() string

func (*LibraryConfiguration) Marshal

func (l *LibraryConfiguration) Marshal() ([]byte, error)

func (*LibraryConfiguration) RemoveInvalid

func (l *LibraryConfiguration) RemoveInvalid() (foundInvalid bool)

RemoveInvalid removes tracks not actually existing and reports if anything invalid was found.

func (*LibraryConfiguration) Unmarshal

func (l *LibraryConfiguration) Unmarshal(data []byte) error

type Track

type Track struct {
	BaseFile file
	Format   string
	Title    string // unlike filename, title comes from encoded tag info
	Album    string
	Artist   string // or artist list
	Genre    string // or genre list
	Year     string
	Sum      string // sha256 sum of the track, serving as the unique id
}

Jump to

Keyboard shortcuts

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