Commit Graph

283 Commits

Author SHA1 Message Date
aditya-K2 3492ec9349 Using the KEY_MAP map for handling events
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.
2021-11-11 23:30:40 +05:30
aditya-K2 482978897d Added Default Mappings
Following Changes Have been made:

    1.  Rename KMAP -> SPECIAL_KEYS
    2.  Added Default Mappings through KEY_MAPPINGS
	so when the config is read it will change the KEY_MAPPINGS map
	which will be then used by the handler function for events.
2021-11-11 23:24:58 +05:30
aditya-K2 3c5835dba1 RENAME ReadMappings -> GenerateKeyMap 2021-11-11 23:24:04 +05:30
aditya-K2 602fc193fc minor changes 2021-11-11 22:30:14 +05:30
aditya-K2 9c039a8681 Reading Mappings from config file
Following Changes have been made in addition to
`1572a460b0`

    1. config.go :

	ReadMappings Reads Array for each function
	Basically we are going to define mappings like this :

	```yml

	    Function :
		- first mapping
		- second mapping
		- third mapping

	`````

    2. kMap.go :

	GetAsciiValues will help us to get e.Rune() for the event for
	the handler function. So basically we will have a keymappings map
	generated which will help us to handle events.

	    for e.g

		if an user has defined following mappings

	````yml

	    togglePlayBack :
		- P
		- p
		- B

	````

		then the keymappings map will look like this

	    []keymappings = {
		GetAsciiValues("P") : togglePlayBack(),
		GetAsciiValues("p") : togglePlayBack(),
		GetAsciiValues("B") : togglePlayBack(),
	    }

	    so when the handler function will get an event e
	    we will just pass it to this keymappings map i.e

		keymappings[e] which will return the function
2021-11-11 22:03:35 +05:30
aditya-K2 1572a460b0 Making a config package for Generating keymappings
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.
2021-11-11 21:57:01 +05:30
Aditya Kurdunkar 2ecee3678a
Merge pull request #4 from aditya-K2/imageRenderingRewrite
Image rendering rewrite
2021-11-11 21:29:27 +05:30
aditya-K2 cad01293c8 Rewriting image Rendering
Now individual parsing of mp3, flac files is done.
and then they are rendered
2021-11-08 11:48:49 +05:30
aditya-K2 5e4e6fabbe Using different metadata parsing libraries instead of dhowden/tag
dhowden/tag all of sudden stopped working so using different metadata
parsing library.
2021-11-08 11:47:38 +05:30
aditya-K2 af9b9a1c0a Delete selected song from Playlist.
Now, Pressing d deletes the selected song.
2021-11-06 19:25:23 +05:30
aditya-K2 0dca038dbb Update README 2021-11-06 18:19:45 +05:30
Aditya Kurdunkar 794720f132
Merge pull request #3 from aditya-K2/config
Simple Implementation of config parser
2021-11-06 18:16:38 +05:30
aditya-K2 0f3d1aeb1e minor changes 2021-11-05 15:06:42 +05:30
aditya-K2 aba0dae95e Default path for music_directory is now parsed from mpd.conf 2021-11-05 15:04:22 +05:30
aditya-K2 63725145c5 minor changes 2021-11-05 14:48:22 +05:30
aditya-K2 a365ca8c08 minor changes 2021-11-05 14:47:27 +05:30
aditya-K2 6a529f4b5e Added functionality to set image paths 2021-11-05 14:11:14 +05:30
aditya-K2 8e5b675cc4 minor changes 2021-11-05 14:00:21 +05:30
aditya-K2 346410d638 minor changes 2021-11-05 13:58:25 +05:30
Aditya Kurdunkar 80d3807e41
Update README.md 2021-11-05 13:38:38 +05:30
aditya-K2 81ea35a40f UPDATE README 2021-11-05 13:13:01 +05:30
aditya-K2 699c5ccb9a UPDATE README and add config parser 2021-11-05 13:06:34 +05:30
aditya-K2 5ad7b90844 Added a config parser
Add a config.yml/config.toml file to $HOME/.config/goMP/ so that user
configurations are read.
2021-11-05 12:40:46 +05:30
aditya-K2 8e05e1a865 DELETED globals.go 2021-11-05 12:40:20 +05:30
aditya-K2 e5e2cd9345 Using Viper to Read Config File 2021-11-05 12:34:16 +05:30
aditya-K2 7c771e20ae minor updates 2021-10-29 14:03:53 +05:30
aditya-K2 4bca4fb0ff UPDATE README 2021-10-29 14:02:44 +05:30
aditya-K2 bae972f697 Now the Image is resized according to font Size
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
2021-10-29 13:54:06 +05:30
aditya-K2 190564abd1 UPDATE README 2021-10-29 10:24:29 +05:30
aditya-K2 93e6885ae9 Additional Padding for Cover art to fit correctly
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
2021-10-29 10:14:57 +05:30
aditya-K2 97b2e4c4bc Hopefully this fixes #2
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.
2021-10-29 10:08:09 +05:30
aditya-K2 f1aab8fb36 Merge branch 'master' of github.com:aditya-K2/goMP 2021-10-29 09:45:15 +05:30
aditya-K2 452d6913f2 minor changes: Rename t -> inputTable 2021-10-29 09:44:55 +05:30
Aditya Kurdunkar d1374f8c99
Update README.md 2021-10-28 14:50:16 +05:30
aditya-K2 1df874fb6a UPDATE README 2021-10-28 14:42:13 +05:30
aditya-K2 e7843cedf1 Information for #1 added to README 2021-10-28 14:32:58 +05:30
Aditya Kurdunkar eb1fcda1af
Update README.md 2021-10-28 11:45:14 +05:30
Aditya Kurdunkar c5086126ec
Update README.md 2021-10-24 13:43:06 +05:30
aditya-K2 758fd710fe UPDATE README 2021-10-24 13:32:07 +05:30
aditya-K2 52d8009396 UPDATE README 2021-10-24 13:30:50 +05:30
aditya-K2 3ad3e58019 Image Previews Implementation 2021-10-24 13:26:10 +05:30
aditya-K2 9b1e8fd4f7 Image Preview Utilities
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.
2021-10-24 13:15:45 +05:30
aditya-K2 daaf99a1a7 Added a new Preview Box which will render album covers 2021-10-24 01:38:55 +05:30
aditya-K2 98a6b0717a minor Changes 2021-10-24 01:34:28 +05:30
aditya-K2 46d721ffb4 pressing q now quits out of the application 2021-10-24 01:33:20 +05:30
aditya-K2 930cc2b83f Merge branch 'master' of github.com:aditya-K2/goMP 2021-10-24 01:31:13 +05:30
aditya-K2 62bf15ea27 Ueberzug Integration
`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`.
2021-10-24 01:28:11 +05:30
Aditya Kurdunkar 5275ac497f
Update README.md 2021-10-19 18:58:11 +05:30
aditya-K2 e5e0dad16c Added Padding Between the name and progressBar
Also added color to the title
2021-10-19 11:59:40 +05:30
aditya-K2 c60a780358 Fixed the Resizing Problem of ProgressBar
the progressBar previously when resized could not sustain the artist
name and title now the progressBar size is fixed.
2021-10-19 11:58:01 +05:30