config

package
v0.0.0-...-fddd194 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MTAttrArtist = iota
	MTAttrArtistSort
	MTAttrAlbum
	MTAttrAlbumSort
	MTAttrAlbumArtist
	MTAttrAlbumArtistSort
	MTAttrDisc
	MTAttrTrack
	MTAttrNumber
	MTAttrLength
	MTAttrPath
	MTAttrDirectory
	MTAttrFile
	MTAttrYear
	MTAttrGenre
	MTAttrName
	MTAttrComposer
	MTAttrPerformer
	MTAttrConductor
	MTAttrWork
	MTAttrGrouping
	MTAttrComment
	MTAttrLabel
	MTAttrPos
	// List store's "artificial" columns used for rendering
	QueueColumnIcon
	QueueColumnFontWeight
	QueueColumnBgColor
	QueueColumnVisible
)

MPD's track attribute identifiers. These must precisely match the QueueListStore's columns declared in player.glade

Variables

View Source
var AppMetadata = &struct {
	Version   string
	BuildDate string
	Name      string
	Icon      string
	Copyright string
	URL       string
	URLLabel  string
	ID        string
	License   string
}{
	Name:      "Ymuse",
	Icon:      "com.yktoo.ymuse",
	Copyright: "Written by Dmitry Kann",
	URL:       "https://yktoo.com",
	URLLabel:  "yktoo.com",
	ID:        "com.yktoo.ymuse",
	License: "Licensed under the Apache License, Version 2.0 (the \"License\");\n" +
		"you may not use this file except in compliance with the License.\n" +
		"You may obtain a copy of the License at\n" +
		"    http://www.apache.org/licenses/LICENSE-2.0\n" +
		"\n" +
		"Unless required by applicable law or agreed to in writing, software\n" +
		"distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
		"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
		"See the License for the specific language governing permissions and\n" +
		"limitations under the License.\n",
}

AppMetadata stores application-wide metadata such as version, license etc.

View Source
var MpdTrackAttributeIds []int

MpdTrackAttributeIds stores attribute IDs sorted in desired display order

View Source
var MpdTrackAttributes = map[int]MpdTrackAttribute{
	MTAttrArtist:          {"Artist", "Artist", "Artist", false, true, 200, 0, nil, nil},
	MTAttrArtistSort:      {"Artist", "Artist (for sorting)", "Artistsort", false, false, 200, 0, nil, nil},
	MTAttrAlbum:           {"Album", "Album", "Album", false, true, 200, 0, nil, nil},
	MTAttrAlbumSort:       {"Album", "Album (for sorting)", "Albumsort", false, false, 200, 0, nil, nil},
	MTAttrAlbumArtist:     {"Album artist", "Album artist", "Albumartist", false, true, 200, 0, nil, nil},
	MTAttrAlbumArtistSort: {"Album artist", "Album artist (for sorting)", "Albumartistsort", false, false, 200, 0, nil, nil},
	MTAttrDisc:            {"Disc", "Disc", "Disc", false, true, 50, 1, nil, nil},
	MTAttrTrack:           {"Track", "Track title", "Title", false, true, 200, 0, nil, []int{MTAttrName, MTAttrPath}},
	MTAttrNumber:          {"#", "Track number", "Track", true, true, 50, 1, nil, nil},
	MTAttrLength:          {"Length", "Track length", "duration", true, false, 60, 1, util.FormatSecondsStr, nil},
	MTAttrPath:            {"Path", "Directory and file name", "file", false, true, 200, 0, nil, nil},
	MTAttrDirectory:       {"Directory", "File path", "file", false, false, 200, 0, path.Dir, nil},
	MTAttrFile:            {"File", "File name", "file", false, false, 200, 0, path.Base, nil},
	MTAttrYear:            {"Year", "Year", "Date", true, true, 50, 1, nil, nil},
	MTAttrGenre:           {"Genre", "Genre", "Genre", false, true, 200, 0, nil, nil},
	MTAttrName:            {"Name", "Stream name", "Name", false, true, 200, 0, nil, nil},
	MTAttrComposer:        {"Composer", "Composer", "Composer", false, true, 200, 0, nil, nil},
	MTAttrPerformer:       {"Performer", "Performer", "Performer", false, true, 200, 0, nil, nil},
	MTAttrConductor:       {"Conductor", "Conductor", "Conductor", false, false, 200, 0, nil, nil},
	MTAttrWork:            {"Work", "Work", "Work", false, false, 200, 0, nil, nil},
	MTAttrGrouping:        {"Grouping", "Grouping", "Grouping", false, false, 200, 0, nil, nil},
	MTAttrComment:         {"Comment", "Comment", "Comment", false, true, 200, 0, nil, nil},
	MTAttrLabel:           {"Label", "Label", "Label", false, true, 200, 0, nil, nil},
	MTAttrPos:             {"Pos", "Position", "Pos", true, false, 0, 1, nil, nil},
}

MpdTrackAttributes contains all known MPD's track attributes

Functions

This section is empty.

Types

type ColumnSpec

type ColumnSpec struct {
	ID    int // Column ID
	Width int // Column width, if differs from the default, otherwise 0
}

ColumnSpec describes settings for a queue column

type Config

type Config struct {
	MpdNetwork             string       // Network to use to connect to MPD, either 'tcp' or 'unix'
	MpdSocketPath          string       // Path to the MPD's Unix socket (only if MpdNetwork == 'unix')
	MpdHost                string       // MPD's IP address or hostname (only if MpdNetwork == 'tcp')
	MpdPort                int          // MPD's port number (only if MpdNetwork == 'tcp')
	MpdPassword            string       // MPD's password (optional)
	MpdAutoConnect         bool         // Whether to automatically connect to MPD on startup
	MpdAutoReconnect       bool         // Whether to automatically reconnect to MPD after connection is lost
	QueueColumns           []ColumnSpec // Displayed queue columns
	QueueToolbar           bool         // Whether the queue toolbar is visible
	DefaultSortAttrID      int          // ID of MPD attribute used as a default for queue sorting
	TrackDefaultReplace    bool         // Whether the default action for double-clicking a track is replace rather than append
	PlaylistDefaultReplace bool         // Whether the default action for double-clicking a playlist is replace rather than append
	StreamDefaultReplace   bool         // Whether the default action for double-clicking a stream is replace rather than append
	PlayerSeekDuration     int          // Number of seconds to seek back/forward at a time, while playing
	PlayerTitleTemplate    string       // Track's title formatting template for the player
	PlayerAlbumArtTracks   bool         // Whether to display the current track's album art in the player
	PlayerAlbumArtStreams  bool         // Whether to display the current stream's album art in the player
	PlayerAlbumArtSize     int          // Size of the album art image in the player, in pixels
	SwitchToOnQueueReplace bool         // Whether to switch to the Queue tab after the queue has been replaced
	PlayOnQueueReplace     bool         // Whether to start playback after the queue has been replaced
	MaxSearchResults       int          // Maximum number of displayed search results
	Streams                []StreamSpec // Registered stream specifications
	LibraryPath            string       // Last selected library path

	MainWindowDimensions Dimensions // Main window dimensions
}

Config represents (storable) application configuration

func GetConfig

func GetConfig() *Config

GetConfig returns a global Config instance

func (*Config) Load

func (c *Config) Load()

Load reads the config from the default file

func (*Config) MpdNetworkAddress

func (c *Config) MpdNetworkAddress() (string, string)

MpdNetworkAddress returns the MPD network and the address string

func (*Config) Save

func (c *Config) Save()

Save writes out the config to the default file

type Dimensions

type Dimensions struct {
	X, Y, Width, Height int
}

Dimensions represents window dimensions

type MpdTrackAttribute

type MpdTrackAttribute struct {
	Name            string                // Short display label for the attribute
	LongName        string                // Display label for the attribute
	AttrName        string                // Internal name of the corresponding MPD attribute
	Numeric         bool                  // Whether the attribute's value is numeric
	Searchable      bool                  // Whether the attribute is searchable
	Width           int                   // Default width of the column displaying this attribute
	XAlign          float64               // X alignment of the column displaying this attribute (0...1)
	Formatter       func(v string) string // Optional function for formatting the value
	FallbackAttrIDs []int                 // Optional references to the fallback attributes to use when there's no value, in the order of preference
}

MpdTrackAttribute describes an MPD's track attribute

type StreamSpec

type StreamSpec struct {
	Name string // Stream name
	URI  string // Stream URI
}

StreamSpec describes settings for an Internet stream

Jump to

Keyboard shortcuts

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