Rename: CONN -> Conn
This commit is contained in:
parent
b2c5575c8b
commit
ba1c6a6898
32
main.go
32
main.go
@ -37,10 +37,10 @@ func main() {
|
|||||||
utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n")
|
utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n")
|
||||||
panic(mpdConnectionError)
|
panic(mpdConnectionError)
|
||||||
}
|
}
|
||||||
CONN := client.Conn
|
Conn := client.Conn
|
||||||
defer CONN.Close()
|
defer Conn.Close()
|
||||||
|
|
||||||
ui.SetConnection(CONN)
|
ui.SetConnection(Conn)
|
||||||
|
|
||||||
cache.SetCacheDir(viper.GetString("CACHE_DIR"))
|
cache.SetCacheDir(viper.GetString("CACHE_DIR"))
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ func main() {
|
|||||||
|
|
||||||
ui.Ui = ui.NewApplication()
|
ui.Ui = ui.NewApplication()
|
||||||
|
|
||||||
fileMap, err := CONN.ListAllInfo("/")
|
fileMap, err := Conn.ListAllInfo("/")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Print("RED", "Could Not Generate the File Map\n")
|
utils.Print("RED", "Could Not Generate the File Map\n")
|
||||||
utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n")
|
utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n")
|
||||||
@ -66,7 +66,7 @@ func main() {
|
|||||||
var Volume int64
|
var Volume int64
|
||||||
var Random, Repeat bool
|
var Random, Repeat bool
|
||||||
|
|
||||||
if _v, err := CONN.Status(); err != nil {
|
if _v, err := Conn.Status(); err != nil {
|
||||||
utils.Print("RED", "Could Not Get the MPD Status\n")
|
utils.Print("RED", "Could Not Get the MPD Status\n")
|
||||||
panic(err)
|
panic(err)
|
||||||
} else {
|
} else {
|
||||||
@ -89,7 +89,7 @@ func main() {
|
|||||||
notify.Notify = notify.NewNotificationServer()
|
notify.Notify = notify.NewNotificationServer()
|
||||||
notify.Notify.Start()
|
notify.Notify.Start()
|
||||||
|
|
||||||
if c, err := CONN.CurrentSong(); err != nil {
|
if c, err := Conn.CurrentSong(); err != nil {
|
||||||
utils.Print("RED", "Could Not Retrieve the Current Song\n")
|
utils.Print("RED", "Could Not Retrieve the Current Song\n")
|
||||||
panic(err)
|
panic(err)
|
||||||
} else {
|
} else {
|
||||||
@ -124,19 +124,19 @@ func main() {
|
|||||||
views.GetCurrentView().ShowParentContent()
|
views.GetCurrentView().ShowParentContent()
|
||||||
},
|
},
|
||||||
"nextSong": func() {
|
"nextSong": func() {
|
||||||
if err := CONN.Next(); err != nil {
|
if err := Conn.Next(); err != nil {
|
||||||
notify.Notify.Send("Could not Select the Next Song")
|
notify.Notify.Send("Could not Select the Next Song")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clearPlaylist": func() {
|
"clearPlaylist": func() {
|
||||||
if err := CONN.Clear(); err != nil {
|
if err := Conn.Clear(); err != nil {
|
||||||
notify.Notify.Send("Could not Clear the Playlist")
|
notify.Notify.Send("Could not Clear the Playlist")
|
||||||
} else {
|
} else {
|
||||||
notify.Notify.Send("Playlist Cleared")
|
notify.Notify.Send("Playlist Cleared")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"previousSong": func() {
|
"previousSong": func() {
|
||||||
if err := CONN.Previous(); err != nil {
|
if err := Conn.Previous(); err != nil {
|
||||||
notify.Notify.Send("Could Not Select the Previous Song")
|
notify.Notify.Send("Could Not Select the Previous Song")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -144,12 +144,12 @@ func main() {
|
|||||||
views.GetCurrentView().AddToPlaylist()
|
views.GetCurrentView().AddToPlaylist()
|
||||||
},
|
},
|
||||||
"toggleRandom": func() {
|
"toggleRandom": func() {
|
||||||
if err := CONN.Random(!Random); err == nil {
|
if err := Conn.Random(!Random); err == nil {
|
||||||
Random = !Random
|
Random = !Random
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"toggleRepeat": func() {
|
"toggleRepeat": func() {
|
||||||
if err := CONN.Repeat(!Repeat); err == nil {
|
if err := Conn.Repeat(!Repeat); err == nil {
|
||||||
Repeat = !Repeat
|
Repeat = !Repeat
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -159,7 +159,7 @@ func main() {
|
|||||||
} else {
|
} else {
|
||||||
Volume -= 10
|
Volume -= 10
|
||||||
}
|
}
|
||||||
if err := CONN.SetVolume(int(Volume)); err != nil {
|
if err := Conn.SetVolume(int(Volume)); err != nil {
|
||||||
notify.Notify.Send("Could Not Decrease the Volume")
|
notify.Notify.Send("Could Not Decrease the Volume")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -169,7 +169,7 @@ func main() {
|
|||||||
} else {
|
} else {
|
||||||
Volume += 10
|
Volume += 10
|
||||||
}
|
}
|
||||||
if err := CONN.SetVolume(int(Volume)); err != nil {
|
if err := Conn.SetVolume(int(Volume)); err != nil {
|
||||||
notify.Notify.Send("Could Not Increase the Volume")
|
notify.Notify.Send("Could Not Increase the Volume")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -195,14 +195,14 @@ func main() {
|
|||||||
views.GetCurrentView().Quit()
|
views.GetCurrentView().Quit()
|
||||||
},
|
},
|
||||||
"stop": func() {
|
"stop": func() {
|
||||||
if err := CONN.Stop(); err != nil {
|
if err := Conn.Stop(); err != nil {
|
||||||
notify.Notify.Send("Could not Stop the Playback")
|
notify.Notify.Send("Could not Stop the Playback")
|
||||||
} else {
|
} else {
|
||||||
notify.Notify.Send("Playback Stopped")
|
notify.Notify.Send("Playback Stopped")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"updateDB": func() {
|
"updateDB": func() {
|
||||||
_, err = CONN.Update("")
|
_, err = Conn.Update("")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
notify.Notify.Send("Could Not Update the Database")
|
notify.Notify.Send("Could Not Update the Database")
|
||||||
} else {
|
} else {
|
||||||
@ -254,7 +254,7 @@ func main() {
|
|||||||
} else {
|
} else {
|
||||||
if views.GetCurrentView().GetViewName() == "PlaylistView" {
|
if views.GetCurrentView().GetViewName() == "PlaylistView" {
|
||||||
if e.Rune() == 'j' || e.Rune() == 'k' {
|
if e.Rune() == 'j' || e.Rune() == 'k' {
|
||||||
if p, err := CONN.PlaylistInfo(-1, -1); err != nil {
|
if p, err := Conn.PlaylistInfo(-1, -1); err != nil {
|
||||||
notify.Notify.Send("Error Getting PlaylistInfo")
|
notify.Notify.Send("Error Getting PlaylistInfo")
|
||||||
} else {
|
} else {
|
||||||
if len(p) == 0 {
|
if len(p) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user