Merge branch 'master' into refactor
This commit is contained in:
commit
5ff27748ae
@ -18,6 +18,8 @@ var (
|
||||
"ADDITIONAL_PADDING_Y": 16,
|
||||
"IMAGE_WIDTH_EXTRA_X": -1.5,
|
||||
"IMAGE_WIDTH_EXTRA_Y": -3.75,
|
||||
"NETWORK_TYPE": "tcp",
|
||||
"NETWORK_ADDRESS": "localhost",
|
||||
"MUSIC_DIRECTORY": utils.CheckDirectoryFmt(getMusicDirectory()),
|
||||
"PORT": "6600",
|
||||
"DEFAULT_IMAGE_PATH": "default.jpg",
|
||||
|
@ -26,6 +26,26 @@ This is the port where your Music Player Daemon Is Running
|
||||
```yml
|
||||
MPD_PORT : "6600"
|
||||
```
|
||||
## Network Type
|
||||
|
||||
By Default gomp assumes that you connect to MPD Server through tcp, But if your MPD Server is configured to expose a unix socket rather than a port, then you can specify network type to "unix"
|
||||
|
||||
```yml
|
||||
NETWORK_TYPE : "unix"
|
||||
```
|
||||
|
||||
Read More about it in the [sample_config](https://github.com/aditya-K2/gomp/blob/master/sample_config.yml)
|
||||
|
||||
## Network Address
|
||||
|
||||
The Address of the Host for e.g `"localhost"` or `"/path/to/unix/socket/"` if you are using unix sockets
|
||||
Defaults to `localhost`
|
||||
|
||||
```yml
|
||||
NETWORK_ADDRESS : "/home/$USER/.mpd/socket"
|
||||
```
|
||||
|
||||
Read More about it in the [sample_config](https://github.com/aditya-K2/gomp/blob/master/sample_config.yml)
|
||||
|
||||
## Music Directory
|
||||
|
||||
|
11
main.go
11
main.go
@ -22,7 +22,16 @@ import (
|
||||
func main() {
|
||||
config.ReadConfig()
|
||||
var mpdConnectionError error
|
||||
CONN, mpdConnectionError := mpd.Dial("tcp", "localhost:"+viper.GetString("MPD_PORT"))
|
||||
del := ""
|
||||
nt := viper.GetString("NETWORK_TYPE")
|
||||
port := viper.GetString("MPD_PORT")
|
||||
if nt == "tcp" {
|
||||
del = ":"
|
||||
} else if nt == "unix" && port != "" {
|
||||
port = ""
|
||||
}
|
||||
CONN, mpdConnectionError := mpd.Dial(nt,
|
||||
viper.GetString("NETWORK_ADDRESS")+del+port)
|
||||
if mpdConnectionError != nil {
|
||||
utils.Print("RED", "Could Not Connect to MPD Server\n")
|
||||
utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n")
|
||||
|
@ -49,7 +49,15 @@ IMAGE_WIDTH_EXTRA_Y : -3.75
|
||||
|
||||
MPD_PORT : "6600"
|
||||
# Port on which music player daemon is running
|
||||
# Do not provide this if you are connecting through a unix socket
|
||||
|
||||
NETWORK_TYPE : "tcp" # Defaults to tcp if not provided, use "unix" if MPD Server is configured to expose
|
||||
# a unix socket rather than a port
|
||||
# Known networks are "tcp", "tcp4" (IPv4-only), "tcp6" (IPv6-only), "udp", "udp4" (IPv4-only), "udp6" (IPv6-only),
|
||||
# "ip", "ip4" (IPv4-only), "ip6" (IPv6-only), "unix" and "unixpacket".
|
||||
|
||||
NETWORK_ADDRESS : "localhost" # Defaults to localhost if not provided,
|
||||
# This is the address of the host, for e.g "localhost"/ "127.0.0.1" / a Unix Socket "/home/$USER/.mpd/socket"
|
||||
|
||||
DEFAULT_IMAGE_PATH: "default.jpg"
|
||||
# Note It is neccessary to use /home/your_user_name instead of ~
|
||||
|
Loading…
Reference in New Issue
Block a user