Using Switch case for mappings and removed Cycling
The Feature of Cycling through all the windows now seems useless instead
I am assigning each of the windows a number and one can cycle through
them using the number keys.
Also now the default window is the playlist window instead of the files
tab. The mappings are separated with the help of the global boolean value
InPlaylist
the UpdatePlaylist function updates the table `t` that has been passed
to it and fills it with the current playlist. Also I have removed the
addsong function which felt unneccesary and unused.
Heavy Refactoring is needed for this. The Required Mappings have been
added and the Delay in keyboard input has been fixed. The Delay in
keyboard input was due to Queueing the events ( although it was a go
routine ). The Solution was to use just Draw() Method from tview.Application.
Before the Update Function needed the currentDirectoryMap ( the
Functionality was not confirmed ) as a parameter but now I have removed
the currentDirectoryMap. Instead I have added totalPath ( going to
rename this to `absolutePath` ) to the FileNode Struct which is added
during the generation of the directory Tree whenever the selected field
is called we can just pass the totalPath.
The ProgressBar is just a string which has a length equal to the
innerRect of the table. The length of the innerRect is considered to be
100% and the rest of the progress is tracked in relation to it.
The Progress is displayed with the help of the color formatting strings
in tview
link: https://pkg.go.dev/github.com/rivo/tview#hdr-Colors
the progress length which is calculated by finding the percentage of the
innerRect that matches with the given completion and then at that length
the "[-:-:-]" is inserted with the help of the insertAt function in
utils.go. "[-:-:-]" represents resetting of colors.
This function will be useful to update the expanded view whenever user
navigates the file browser. The expanded view is a table which shows the
directory content.
Decided to Go with tview package for building TUIs and
just added the basic layout of the app.
The Idea is to have a side menu to navigate between the other options.
Just like spotify-tui ( Which has taken inspiration from the orignal
spotify Client) and Having a progress bar at bottom ( Still figuring out
how to implement this )
This function which generates a Directory Tree
from a given path string
for e.g
if the String that is given is "home/what/dir" , "home/hello/foo"
then it will return a FileNode ( Struct )
which looks like this
head{
[{
[
{
[ { [] dir } ]
what
},
{
[ { [] foo } ]
hello
}
]
home
}]
"root"
}