cfangmeier / tuijam

A fancy TUI client for Google Play Music
MIT License
129 stars 9 forks source link

Code readability and queue management improvements #31

Closed AriosJentu closed 5 years ago

AriosJentu commented 5 years ago

1) Improve code readability. 2) Fix calculations in function "sec_to_min_sec". 3) In method 'keypress' of SearchPanel class I've merged two conditions to single. 4) In method 'update_search_results' of same class I've added arguments for title of LineBox and for boolean value 'viewing_previous_songs' to make method 'view_previous_songs' without repeating code. 5) For subfunction 'filter_none' I've added argument for list size. It can be used for creating constants for user config. 6) Same as (2) created for method 'get_prog_tot' of class PlayBar. 7) In method 'get_text' of this class in returning arguments I've replaced ternary operator with list with argument, and added calculations of progress and total as function "sec_to_min_sec". 8) Main - I've added function to moving tracks in queue to top and to bottom of queue. 9) I've added more easier hotkeys for swapping tracks in queue and moving to next track. 10) Same as (7) changed operation for changing reverse scrolling for 'mouse_event' method.

cfangmeier commented 5 years ago

Hi @AriosJentu. Thanks for putting in the work to clean up the style of the code. I'll look through the changes and merge unless I spot some issue.

cfangmeier commented 5 years ago

Testing out the changes, I found an issue with the new get_prog_tot implementation. Rounding the progress and remaining times before adding them to get total results in the total time fluctuating up and down by 1 second. It's more noticible on some songs than others. For testing, I noticed it happening very regularly on 'The Grey Havens' from the Return of the King soundtrack.

If you can fix this, I'll merge the PR.

AriosJentu commented 5 years ago

I've fixed this bug with removing converting values to int because this function makes values without saving float part for calculation in 'update' method.