Utilising the Notification Server
Following Changes have been made: 1. UI is now global 2. Simple Notifications are sent when some events are called.
This commit is contained in:
parent
29439fa0de
commit
b01deba484
8
main.go
8
main.go
@ -11,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var CONN *mpd.Client
|
var CONN *mpd.Client
|
||||||
|
var UI *Application
|
||||||
var Volume int64
|
var Volume int64
|
||||||
var Random bool
|
var Random bool
|
||||||
var Repeat bool
|
var Repeat bool
|
||||||
@ -34,7 +35,7 @@ func main() {
|
|||||||
r.Start("stop")
|
r.Start("stop")
|
||||||
}
|
}
|
||||||
|
|
||||||
UI := newApplication(r)
|
UI = newApplication(r)
|
||||||
|
|
||||||
fileMap, err := CONN.GetFiles()
|
fileMap, err := CONN.GetFiles()
|
||||||
dirTree := generateDirectoryTree(fileMap)
|
dirTree := generateDirectoryTree(fileMap)
|
||||||
@ -55,6 +56,9 @@ func main() {
|
|||||||
return UI.ExpandedView.GetInnerRect()
|
return UI.ExpandedView.GetInnerRect()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
notificationServer := NewNotificationServer()
|
||||||
|
notificationServer.Start()
|
||||||
|
|
||||||
var FUNC_MAP = map[string]func(){
|
var FUNC_MAP = map[string]func(){
|
||||||
"showChildrenContent": func() {
|
"showChildrenContent": func() {
|
||||||
r, _ := UI.ExpandedView.GetSelection()
|
r, _ := UI.ExpandedView.GetSelection()
|
||||||
@ -85,6 +89,7 @@ func main() {
|
|||||||
CONN.Next()
|
CONN.Next()
|
||||||
},
|
},
|
||||||
"clearPlaylist": func() {
|
"clearPlaylist": func() {
|
||||||
|
notificationServer.Send("PlayList Cleared")
|
||||||
CONN.Clear()
|
CONN.Clear()
|
||||||
if InsidePlaylist {
|
if InsidePlaylist {
|
||||||
UpdatePlaylist(UI.ExpandedView)
|
UpdatePlaylist(UI.ExpandedView)
|
||||||
@ -145,6 +150,7 @@ func main() {
|
|||||||
UI.App.Stop()
|
UI.App.Stop()
|
||||||
},
|
},
|
||||||
"stop": func() {
|
"stop": func() {
|
||||||
|
notificationServer.Send("Playback Stopped")
|
||||||
CONN.Stop()
|
CONN.Stop()
|
||||||
},
|
},
|
||||||
"updateDB": func() {
|
"updateDB": func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user