config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CfgDir is the directory where the muserv configuration is stored
	CfgDir = "/etc/muserv"
	// IconDir is the directory where the muserv icons are stored
	IconDir = CfgDir + "/icons"
)
View Source
const UserName = "muserv"

UserName is the name of the muserv system user

Variables

This section is empty.

Functions

func IsValidAudioFile

func IsValidAudioFile(file string) bool

IsValidAudioFile returns true if file has a mime type that is relevant for muserv as per the configuration, otherwise false is returned

func SupportedMimeTypes

func SupportedMimeTypes() (s string)

SupportedMimeTypes assembles a string containing the audio and image mime types that muserv supports. The string is used to set the state variable SpurceProtocolInfo of the connection manager service

func Test

func Test() (err error)

Test reads the configuration file and checks the configuration for completeness and consistency

Types

type Cfg

type Cfg struct {
	Cnt      cnt    `json:"content"`
	UPnP     upnp   `json:"upnp"`
	CacheDir string `json:"cache_dir"`
	LogDir   string `json:"log_dir"`
	LogLevel string `json:"log_level"`
}

Cfg stores the data from the MuServ configuration file

func Load

func Load() (cfg Cfg, err error)

Load reads the configuration file and returns the muserv config as structure

func (*Cfg) Validate

func (me *Cfg) Validate() (err error)

Validate check if the configuration is complete and correct. If it's not, an error is returned

type Comparison added in v0.2.0

type Comparison func(string, string) bool

Comparison represents a "less" function for strings

type Hierarchy

type Hierarchy struct {
	Name   string  `json:"name"`
	Levels []level `json:"levels"`
}

Hierarchy contains the definition of one content hierarchy. Name must not be empty. Either ID or Levels must be filled, but not both. If ID is filled, it's a hierarchy that's defined muserv internally. Those hierarchies cannot be changed. They (can) occur in the config to configure where in the sequence of hierarchies they shall appear. Those hierarchies can be removed without problem. For the other hierarchies, Levels must be set.

type LevelType added in v0.2.0

type LevelType string

LevelType represents the type of a music hierarchy level

const (
	LvlAlbum       LevelType = "album"
	LvlAlbumArtist LevelType = "albumartist"
	LvlArtist      LevelType = "artist"
	LvlGenre       LevelType = "genre"
	LvlTrack       LevelType = "track"
)

possible types of hierarchy levels

func (LevelType) IsValid added in v0.2.0

func (me LevelType) IsValid() (err error)

IsValid checks if the level type has a valid value

type SortField added in v0.2.0

type SortField string

SortField represents an attribute that is used for sorting objects such as albums or tracks

const (
	SortNone       SortField = ""
	SortTitle      SortField = "title"
	SortTrackNo    SortField = "trackNo"
	SortDiscNo     SortField = "discNo"
	SortYear       SortField = "year"
	SortLastChange SortField = "lastChange"
)

sort field values

type SortOrd added in v0.2.0

type SortOrd string

SortOrd represents the sort order (ascending or descending)

const (
	OrdAsc  SortOrd = "+" // sort ascending
	OrdDesc SortOrd = "-" // sort descending
)

sort orders

type ValueKey

type ValueKey string

ValueKey represents value keys for contexts

const (
	// KeyCfg is the key for the muserv configuration
	KeyCfg ValueKey = "cfg"
	// KeyVersion is the key for the muserv version
	KeyVersion ValueKey = "version"
)

Jump to

Keyboard shortcuts

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