#Playlists
In Dev Diary 6, I had the following goals related to playlist functionality:- Implementation of a playlist-metadata signal for KotoPlaylist so we can notify when a playlist has been modified.
- Updating our logic for going to the previous and next tracks to leverage our currently selected model (or default based on the type we set during creation) and base the tracks on that instead.
- Implement the track rendering in the GtkListView.
- Implement the selection handling and GtkActionBar rendering, events, etc. when clicking on one or more tracks.
- Implement playlist-removed handling in the KotoNav to delete the button.
- We create two different GQueue objects and one GListStore of KOTO_TYPE_INDEXED_TRACK. One of the GQueue is basically for the unmodified version of tracks, so no matter the sorting it is the same. The other GQueue is our sorted tracks, which is used to determine what the previous and next tracks are based on the current UUID of the current track playing (if any). Our GListStore is used for any models which leverage it via GListModel for a GtkListView, such as the Playlist page.
- Whenever we add a track, whether during the initial loading of the Playlist or otherwise, we add the UUID of the track to the tracks and sorted tracks GQueues and append the KotoIndexedTrack to the GListStore.
- If we have marked the playlist as finalized (this is done so we can track whether we should do a sort or wait until a mass addition of tracks are added to a playlist, e.g. during first load of Koto), we will re-sort the sorted GQueue and GListStore. This updates our data model and the graphical model instantly!
- Our "apply model" for changing the sorting model no longer rebuilds the GQueue and GListStore in their entirety. Instead, we apply a re-sort of the GQueue via
koto_playlist_model_sort_by_uuid
, which gets the two KotoIndexedTracks by the UUIDs provided in the GQueue and passes it tokoto_playlist_model_sort_by_track
, which is also used by our GListStore. This allows us to keep the data model and the graphical model in sync.
- If you only have one track selected, the per-playlist checkboxes will be checked if that track is already in the playlist.
- If you have more than one track selected, the per-playlist checkboxes will only be checked if all of the tracks are in the playlist.
#Other Items
Work over the last couple weeks has almost exclusively been related to Playlist functionality, however I did get around to a few other items I really wanted to take care of:- Implement helper functions as part of our KotoButton for "click" and touch gesture setup to avoid repetitive GtkEventController / Gesture code.
- Refactoring the album artwork image used in the KotoAlbumView into a generic widget that can be leveraged in our KotoPlaylistPage.
- Finish necessary VS Code bits so I can hopefully launch Koto in various modes and stop using GNOME Builder (too buggy for me).
koto_button_add_click_handler
function. This will use our predefined GTK gestures and event controllers, allowing us to just pass in a GLib Callback and the desired primary or secondary button enumerated value and it sets up the signal connection for us. This transforms 5-6 repetitive lines used pretty much everywhere into a single line, which is nice.
Our album artwork image has been refactored into a KotoCoverArtButton component, allowing us to reuse it across the playlist page and the KotoAlbumView for playing either a playlist or an album.
I finished my move from GNOME Builder to Visual Studio Code. This was achievable thanks to a mix of their task system and a bit of shoehorning and trickery of their "launch" system as well, which is typically used for debugging purposes but just pass a "miDebuggerPath" of nothing (empty string) for it to not launch the app with gdb.
My uncrustify config is mostly done, aside from some minor issues with pointer positions being inconsistent between variables and return types for functions. Simple enough to fix up, just been focused on actually implementing code.
I did some polishing of the theming. The track information in the playerbar looks halfway decent now and some parts of the UI is using what is likely going to be the primary color of Koto (a lime-ish green). Pretty happy with it so far, but feedback is always appreciated.
#Upcoming
Playlist functionality is starting to get wrapped up and I expect it to be done over the next couple weeks. At that point, I can actively dogfood Koto and it brings it one step closer to being available for testing as alpha builds. Here is what is coming up over the next couple weeks:- Implementation of a playlist-metadata signal for KotoPlaylist so we can notify when a playlist has been modified.
- Implement the selection handling and GtkActionBar rendering, events, etc. when clicking on one or more tracks. This will be done in the album view and the playlist page.
- Implement playlist modification UX.
- Finish the uncrustify config so I can have a standardized code styling.
- Implement song-specific playback
- Implement notifications for track switching.
- Rename "indexed" classes like KotoIndexedArtist to just KotoArtist
- Start cleanup of indexer and library code for multiple library "types" in preparation multi-library support leading into audiobooks.
#Streams
All development streams happen on my Twitch every Tuesday and Thursday from 12pm-5pm GMT+3 / EEST (Eastern European Time). If you miss these streams, I upload all of them to Odysee so be sure to check them out! I am part of Odysee's Viewer Rewards Program, so if you have an Odysee account, you can now get a daily watch reward of a bit of LBRY Credits (LBC) when you watch my videos, and I get some too!