config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: GPL-3.0 Imports: 12 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 (
	// TagAlbum is the album tag
	TagAlbum = "album"
	// TagAlbumArtist is the album artist tag
	TagAlbumArtist = "albumartist"
	// TagArtist is the artist tag
	TagArtist = "artist"
	// TagGenre is the genre tag
	TagGenre = "genre"
	// TagTrack represents the track in the definition of content hierarchies
	TagTrack = "track"
)
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"`
	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 Hierarchy

type Hierarchy struct {
	ID     string   `json:"id"`
	Name   string   `json:"name"`
	Levels []string `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 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