Rename notificationServer -> NOTIFICATION_SERVER

making notificationServer global as other services might need access to
it.
This commit is contained in:
aditya-K2 2021-11-14 12:02:36 +05:30
parent 5012b2832b
commit eca4cc47f9

11
main.go
View File

@ -12,6 +12,7 @@ import (
var CONN *mpd.Client var CONN *mpd.Client
var UI *Application var UI *Application
var NOTIFICATION_SERVER *NotificationServer
var Volume int64 var Volume int64
var Random bool var Random bool
var Repeat bool var Repeat bool
@ -56,8 +57,8 @@ func main() {
return UI.ExpandedView.GetInnerRect() return UI.ExpandedView.GetInnerRect()
}) })
notificationServer := NewNotificationServer() NOTIFICATION_SERVER = NewNotificationServer()
notificationServer.Start() NOTIFICATION_SERVER.Start()
var FUNC_MAP = map[string]func(){ var FUNC_MAP = map[string]func(){
"showChildrenContent": func() { "showChildrenContent": func() {
@ -93,7 +94,7 @@ func main() {
if InsidePlaylist { if InsidePlaylist {
UpdatePlaylist(UI.ExpandedView) UpdatePlaylist(UI.ExpandedView)
} }
notificationServer.Send("PlayList Cleared") NOTIFICATION_SERVER.Send("PlayList Cleared")
}, },
"previousSong": func() { "previousSong": func() {
CONN.Previous() CONN.Previous()
@ -151,14 +152,14 @@ func main() {
}, },
"stop": func() { "stop": func() {
CONN.Stop() CONN.Stop()
notificationServer.Send("Playback Stopped") NOTIFICATION_SERVER.Send("Playback Stopped")
}, },
"updateDB": func() { "updateDB": func() {
_, err = CONN.Update("") _, err = CONN.Update("")
if err != nil { if err != nil {
panic(err) panic(err)
} }
notificationServer.Send("Database Updated") NOTIFICATION_SERVER.Send("Database Updated")
}, },
"deleteSongFromPlaylist": func() { "deleteSongFromPlaylist": func() {
if InsidePlaylist { if InsidePlaylist {