Image is now resized according to the font size and also a new
globals.go files is added which contains all the globals.
the Image width can also be changed according to use by adding or
substracting pixels to it by changing the globals
IMAGE_WIDTH_EXTRA_X, IMAGE_WIDTH_EXTRA_Y
Also, now there is no need to specify where the music directory is
the mpd.conf file in `~/.config/mpd/` is automatically parsed for music
directory
As specified in #2 the image gets out of the preview box, the previous
commit solves the problem but the image placement in the box differs
from terminal to terminal it might need some extra padding so user can
define some extra padding in the render.go
the position is now calculated with the help of font_pixel_width and
font_pixel_height
font_pixel_width = Total X Pixels / Total Columns
font_pixel_height = Total Y Pixels / Total Rows
which is then multiplied to row and column co-ordinates of preview box to get it's
pixel position.
render.go : This File Contains the implementation for the Renderer which
is a channel that will receive strings to the path of decoded images)
the path is sent with the help of Send() method. The Start() method
starts the go routine OpenImage() this function blocks the image as it
keeps listening over the channel. which helps in not drawing the image
again and again.
imageUtils.go: This file contains the helper function for decoding
images.
`https://gitlab.com/diamondburned/ueberzug-go` is a go implementation of
ueberzug. Also The Cover Art is being retrived through the metadata
parser from `dhowden` called `tag`.
There are two ways the information is shown if the Node is a directory
then the relativePath is shown else the attributes of the song are
shown.
For this Layout ( song attributes ) We can divide the Screen three Part
| Title | Artist | Album |
| | | |
| | | |
| | | |
| | | |
~~~~~~~~~~~~~ Screen Width ~~~~~~~~~~~~~~~~~~~~~~
if the length of each of the attribute is less than ( Screen Width / 3 )
then we can add spaces to the end else we can shorten the string to
fit into the screen width
this functionality is done with the help of `getFormattedString()`
- Added A new Struct Application which has all the other components as
its fields
-- the `newApplication()` Function returns a pointer to the newly
created Application from which other fields can be accessed. The
fields are as follows
| App *tview.Application
| expandedView *tview.Table
| Navbar *tview.Table
| searchBar *tview.Table
| pBar *progressBar
- Minor changes to main.go
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 )