Fixing Slow down of Playlists mentioned @ #20

As mentioned at https://github.com/aditya-K2/gomp/issues/20#issuecomment-1142443829

The Slow Down was caused due to constant calls to the MPD Server for
playlist info. Using Watcher to handle playlist event changes.

Also when In SearchView upon adding Artist/Album due to constant change
in playlists there was a slow down. Hence using CommandList for that.
This commit is contained in:
aditya-K2
2022-09-13 22:04:39 +05:30
parent bf6939a554
commit fdd390a731
3 changed files with 66 additions and 17 deletions

View File

@@ -60,9 +60,6 @@ func main() {
// Generating the Directory Tree for File Navigation.
client.DirTree = client.GenerateDirectoryTree(fileMap)
// Default View upon Opening is of Playlist.
views.PView.Update(ui.Ui.ExpandedView)
var Volume int64
var Random, Repeat bool
var SeekOffset = viper.GetInt("SEEK_OFFSET")
@@ -120,6 +117,7 @@ func main() {
// This Function Is Responsible for Changing the Focus it uses the Focus Map and Based on it Chooses
// the Draw Function
views.PView.StartWatcher()
views.SetCurrentView(views.PView)
ui.Ui.ExpandedView.SetDrawFunc(func(s tcell.Screen, x, y, width, height int) (int, int, int, int) {
views.GetCurrentView().Update(ui.Ui.ExpandedView)