config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 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 IsValidPlaylistFile added in v0.3.0

func IsValidPlaylistFile(path string) bool

IsValidPlaylistFile returns true if path is a playlist that is relevant for muserv as per the configuration, otherwise false is returned

func IsValidTrackFile added in v0.3.0

func IsValidTrackFile(path string) bool

IsValidTrackFile returns true if path is a music track 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