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.
Previously During Searching the Connection with mpd client was utilised
to get the title for the files this was slowing the search with large
number of files. Now after adding the Title field to the struct the
Field is accessed instead of querying the server this has lead to faster
searches.
[[ Please Note the Title of a Folder would be the last accessed
track from the FileMap. ]]
Searching the Global Database although is enough but I have felt a need to have a
quick and fast search option to search the current buffer.
Buffer Search is also one of the views It can be only turned on if the File Browser
has focus. ( Thinking of making it global ). The Searching is done
through the fuzzy module. FileNode now implements the Source Interface.
The Changed Function of the Search Bar checks for text changes and then
modifies the Matches Variable which is used by the Update Function to
Draw the Results. The Results have the Matching Characters Highlighted
Differently. Maximum of 15 results are displayed to avoid lag. Upon
Selecting the Result through the Search Bar navigation is possible and
selection of the item is done the same way it works for file Browser.
After Selection the Focus is returned Back to the File Browser. For The
Tracks only the title is used for searching.
Globals are no longer needed instead I am connecting each part with (
what were previously ) globals. Also Renaming SetRenderer to
ConnectRenderer which describes the name more precisely
Previously I was using the InsidePlaylist and InsideSearchView boolean
values which was a very hacky and unscalable way. Instead I am using a
focus map which can be queried to check which view has focus. Also the
Pages Implementation is kind of on hold because it has a lot of problems
for e.g resizing doesn't seem to work as I imagined. I am keeping that
Idea on hold right now.
This is a very simple Implementation of searching like playlist view
and file view there is an boolean value that is checked in the draw
function to check if whether or not to draw the Search view
Later on I am thinking of rewriting this whole mechanism with pages
which will make this more modular.
The Boolean values are set and unset by the navigation menu and the done
functions.
Following Changes have been made:
1. conn -> CONN
2. CONN is now a global as a lot of functions were requiring it and
passing them as a parameter didn't seem intuitive.
3. In progressBar.go now we are sending only the short path instead of
absolute path.
Following Changes have been made:
1. Using GenerateMappings() function
2. Using the KEY_MAP map to handle events which shortens the code
and adds modularity.
Following changes have been made:
1. Moving the getMusicDirectory() to config package
2. Moving the config.go to config package
3. Generating a Function Map that will be used for Generating keymappings in main.go
4. Using the config packge in main.go
5. First we are reading the user configuration values with
config.ReadConfig() and then we are reading the mappings with
config.ReadMappings() with the help of Function Map that is
generated.