🎉 Begin setting up mpd
This commit is contained in:
parent
3c59c64966
commit
d3a2695302
5 changed files with 80 additions and 3 deletions
24
mpd/conn.go
Normal file
24
mpd/conn.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package mpd
|
||||
|
||||
import (
|
||||
"github.com/fhs/gompd/v2/mpd"
|
||||
)
|
||||
|
||||
var conn *mpd.Client
|
||||
var connerror error
|
||||
|
||||
func init() {
|
||||
conn, connerror = mpd.Dial("tcp", "localhost:6600")
|
||||
}
|
||||
|
||||
func GetConn() (*mpd.Client, error) {
|
||||
return conn, connerror
|
||||
}
|
||||
|
||||
func CloseConn() error {
|
||||
if connerror != nil {
|
||||
return connerror
|
||||
|
||||
}
|
||||
return conn.Close()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue