Commit Graph
100 Commits
Author SHA1 Message Date
aditya-K2 4c7378e77c Added Default Key To Navigate to Search View with the 4 Button 2021-11-16 20:01:02 +05:30
aditya-K2 ab9f2c55f5 the order was causing a major bug which lead to addition of all the songs to the playlist as empty map was returned 2021-11-16 20:00:04 +05:30
aditya-K2 46fed215b9 minor change to previous commit 2021-11-16 18:03:36 +05:30
aditya-K2 942aea1b7b Making Separators Unselectable 2021-11-16 17:57:05 +05:30
aditya-K2 c1140e23ef Add To Playlist Function has been added.
AddToPlaylist adds the album, artist, track to the playlist.

Some Minor changes to UpdateSearchView have been done:
    Added Colors.

AddAlbum Function also has been changed.
2021-11-16 17:39:44 +05:30
aditya-K2 654212086f Added Update Function to Update the Expanded View for search
Following Functions have been added:

    1. GenerateContentSlice :
	This Function Generates a slice of interfaces which are mostly
	string slices or strings. The Reason for this is the random
	nature of the maps. and also this makes adding songs to playlist
	a breeze as we only need the row number to add the
	song/album/artist to the playlist.
    2. UpdateSearchView :
	this is the Update function for the search view which just
	iterates over the interface slice and draws their content to the
	expanded view
    3. AddAlbum :
	As the Name Suggests adds all the contents of the Album to the
	Playlist
    4. AddTitle :
	As the Name Suggests adds the track to the Playlist
    5. QueryArtistTreeForAlbums :
	This Functions finds all the albums named album in the Artist
	tree and returns an album map. This is because two artists can
	have same album names too.
	Album Map is basically a [2]string{artist, album} -> path to all the songs in the album

Following Functions Have been changed:

    1. AddArtist :
	It now sends notifications.

Following Functions Have been removed:

    1. GetAlbumTree
    2. PrintAlbumTree

    Album Trees are no longer needed
2021-11-16 15:17:50 +05:30
aditya-K2 3c12b7905d Utility Functions to Interact with the Search View
The Following Utility Functions have been added:

    1. AddAlbum : Adds Album to the Playlist
    2. AddArtist : Adds all the Track of the Artist to Playlist
    3. QueryArtistTree : Searches the Artist Tree for the track name
	and returns a map of [ artist, album, track ] -> path
2021-11-16 00:16:15 +05:30
aditya-K2 41c77722e9 Change in Formatting 2021-11-16 00:14:00 +05:30
aditya-K2 fd2a4af4c7 minor changes: using default color for searchbar 2021-11-15 22:18:27 +05:30
aditya-K2 0fc7c61dfb Changing the Color of the Autocomplete Menu 2021-11-15 21:49:42 +05:30
aditya-K2 b1199e9b1c Using My Fork Of tview
Things that I needed are not included in rivo's tview version
and waiting for them to be merged will take time. So using My Fork.
2021-11-15 21:48:17 +05:30
aditya-K2 a5268a6754 Simple Implementation of Search 2021-11-15 16:32:59 +05:30
aditya-K2 0d945a3b23 Converting SearchBar Table -> Input Field
Change in Layout Now the SearchBar is at the top and everything is below
it.
2021-11-15 16:31:46 +05:30
aditya-K2 db9b4603c8 GO MOD TIDY 2021-11-15 15:35:29 +05:30
aditya-K2 afddf95cac Added Function to Default Key Map For Focusing Search Box 2021-11-15 15:34:41 +05:30
aditya-K2 5aed3d0604 Simple Implementation for calculating Distance.
The Distance is calculated with the help of the levensthein algorithm.
and the Results are stored in the pair form to make them easy to sort
2021-11-14 22:07:39 +05:30
aditya-K2 228f69ef75 Merge branch 'master' into search 2021-11-14 16:45:33 +05:30
aditya-K2 f529fd556c Generating Album and Artist Tree
Artist tree is a map that maps the artist names to a map of albums
Similarly the Album tree is a map that maps album names to their
content.

Album trees are generated from artist trees.
the content of the album is a map of title to the destinationFile.
2021-11-14 14:36:24 +05:30
aditya-K2 84535b2901 Minor changes 2021-11-14 14:21:16 +05:30
aditya-K2 5623551b61 Now a notification is sent when Image is downloaded from lastfm 2021-11-14 12:04:54 +05:30
aditya-K2 a6a65d0e1d Merge branch 'master' of github.com:aditya-K2/goMP 2021-11-14 12:03:19 +05:30
aditya-K2 eca4cc47f9 Rename notificationServer -> NOTIFICATION_SERVER
making notificationServer global as other services might need access to
it.
2021-11-14 12:02:36 +05:30
aditya-K2 8f995c2357 Minor changes 2021-11-14 01:31:17 +05:30
aditya-K2 b01deba484 Utilising the Notification Server
Following Changes have been made:

1. UI is now global
2. Simple Notifications are sent when some events are called.
2021-11-13 23:53:59 +05:30
aditya-K2 29439fa0de Simple Implementation of notification Mechanism.
Using a Notification Server that will keep listening for notifications
and will render the notification upon receiving read notification.go for
more information
2021-11-13 23:52:16 +05:30
aditya-K2 dbfc617037 Rename Application Fields 2021-11-13 16:57:54 +05:30
aditya-K2 e2fd4c117e Using Pages so that Notifications can be displayed
Pages allow overlaying of primitives.
2021-11-13 16:40:33 +05:30
aditya-K2 dafb4b7199 RENAME functions for module 2021-11-13 14:47:26 +05:30
aditya-K2 459b6b2f02 Added Caching Module
The Caching Module Caches the images that have been extracted and for
persistence writes the images to a cache file.

In the cache file the data is stored by tab separated values

        `%s\t%s\t%s`

the cache is first loaded in the memory ( CACHE_LIST ) during the start of application
and then extracted images are added to the map CACHE_LIST which is
writtern to the cache file before exiting the program.
2021-11-13 14:37:07 +05:30
aditya-K2 ee7cc71879 Update to Rendering Routine.
Following changes have been made:

     1. The OpenImage() function now checks if the image returned by the
	mp3 and flac parsers is the default image if it is true then it
	will query the lastfm api for cover image if no error is
	received then the path to that downloaded image is passed else
	the path is unchanged ( that is it will be the default image )
2021-11-13 11:44:49 +05:30
aditya-K2 049fe9c10b Updated go Modules 2021-11-13 11:34:56 +05:30
aditya-K2 e4ed3bbab7 Rename conn -> CONN ( Also made it Global )
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.
2021-11-13 11:32:00 +05:30
aditya-K2 c19a053126 Connecting LastFm Api to get Image Urls which is then rendered 2021-11-13 01:34:24 +05:30
aditya-K2 cd2acb8a7c Update README 2021-11-13 00:37:37 +05:30
aditya-K2 ed3ae37259 Update README 2021-11-13 00:36:09 +05:30
aditya-K2 7991985423 UPDATE README 2021-11-12 14:58:05 +05:30
aditya-K2 6a5155efed minor changes 2021-11-12 14:32:06 +05:30
aditya-K2 c943b936b9 More Test Cases 2021-11-12 14:26:06 +05:30
aditya-K2 4623f0d63c RENAME kMap -> FUNC_MAP
this naming makes more sense
2021-11-12 14:06:51 +05:30
aditya-K2 211911342e Added More Special Keys and now check for single letters in first part too 2021-11-12 14:03:57 +05:30
aditya-K2 836e67a24d More informing error 2021-11-12 01:25:40 +05:30
aditya-K2 0fa68fe7b0 GenerateKeyMap() now changes KEY_MAP according to the config file 2021-11-11 23:58:57 +05:30
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
`https://github.com/aditya-K2/goMP/pull/5/commits/1572a460b042c25c93d4d5ed27b1a75432a53464`

    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-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-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-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-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-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-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
aditya-K2 4231228703 Minor changes to README 2021-10-18 13:29:23 +05:30
aditya-K2 3ded1e6431 Update README 2021-10-18 13:28:53 +05:30
aditya-K2 ac6cf03765 UPDATE README & Minor changes to App.go 2021-10-18 13:21:09 +05:30
aditya-K2 fb3a70a1ee color changes 2021-10-18 13:18:56 +05:30
aditya-K2 e137dc6c1e added Draw Function for expanded View
The Draw function is decided with the help of the InsidePlaylist boolean
value.
2021-10-18 12:18:51 +05:30
aditya-K2 1fa411fb1d Layout for Playlist/ Song View
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()`
2021-10-18 12:12:10 +05:30
aditya-K2 e84e317079 Refactored the Startup Setup into A new Struct
- 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
2021-10-18 08:13:21 +05:30
aditya-K2 c6d2e8d8af Added Playlist Functionality
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
2021-10-18 07:51:57 +05:30
aditya-K2 db9887c041 Added UpdatePlaylist Function
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.
2021-10-18 01:27:30 +05:30
aditya-K2 11eb7c35b6 Working Prototype for the Files Navigation
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.
2021-10-17 22:30:57 +05:30
aditya-K2 9e69ed9f1e Minor Changes to ProgressBar
Some Information from the ProgressBar has been removed.
2021-10-17 22:29:56 +05:30
aditya-K2 c3ede5403e minor changes in formatting
fixed the blinking text issue
2021-10-17 22:28:06 +05:30
aditya-K2 24f94fc4e5 Minor Changes : Rename totalPath -> absolutePath 2021-10-17 21:53:39 +05:30
aditya-K2 680b41cb6e Updated FileNode Struct
Added New Field `absolutePath` to FileNode struct. This helps in adding
the song to the playlist through the Add Button.
2021-10-17 21:51:01 +05:30
aditya-K2 eecb86ed8f Updated the Client Functions
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.
2021-10-17 21:42:02 +05:30