Commit Graph

897 Commits

Author SHA1 Message Date
Anna Schumaker b62c7f1554 Emmental 2.8
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-19 10:29:59 -05:00
Anna Schumaker bc4c3588e6 ui: Convert Window code into a class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker b05ef737f2 ui: Convert Pane code into a class
This lets us create a new instance for each test we do, so we don't need
to keep resetting a single static instance.

Implements: #21 (Convert ui.pane.Pane into a class)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker 7979cb1a4a ui: Switch to the new audio.Header()
And delete the old ui/header.py code

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker 880f0a686b audio: Replace load_track() with change_track()
To mark tracks played and then emit the track-changed signal to start
the next track.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker 97a05efe7e audio: Give the Player a play_track() function
To load and play a different track

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker 96956c730d audio: Give the AutoPauseScale a keep_playing property
And a function to find out if we are about to pause or not.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker 049eeec38a audio: Implement a Header bar
This moves the code out of ui/ and turns it into a class for easier
testing.

Implements: Issue #22 (Move Gtk.HeaderBar code into audio/)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 03b3c4a806 audio: Fix GstOutputSelector pad negotiation
All sinks need to post the EOS message before the pipeline can pass it
on to our application. Using pad negotiation mode 2 means that the
message is only sent to the active path in the output selector, leaving
our application hanging waiting for the inactive path to post EOS as
well.

Fixes: #33 (Fix Autopause not resetting)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 20e4ab4ba5 db: Update icons for the Previous and QueuedTracks playlists
So they match the next and previous button icons

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker cc88dcab0a db: Give QueuedTracks a custom next_track() function
So we can remove tracks from the queue as they are played.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 2e57e1fe0a db: Preserve the current track when removing tracks
Again, we have to be careful not to check positions against playlists
where current == -1 for performance reasons.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 2f747ccaa6 db: Preserve the current track when adding tracks
We have to be careful not to check track positions against playlists
where current == -1, because this could drastically slow down adding new
tracks because SQLite would need to find the position for every track

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker e94a737718 db: Provide a passthrough for playlist_state.rowid
So the audio layer can easily access it when saving the current
playlist.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker ee6bf059c1 db: Replace years.year with albums.release in the default sort order
And remove the INNER JOIN with the years table since it is no longer
needed.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 0b818bc067 db: Attach release information to albums
This lets us sort albums by original release date, so if an artist
releases multiple albums in a year we can sort by month too.
Additionally, this helps us better handle albums with the same name that
were released in different years.

Implements: #40 (Store the full date in the year table)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 050a930376 db: Give the Previous playlist special next and previous functions
previous_track() moves deeper into the previous tracks list while
next_track() moves us closer to the start. I also make sure we reset
current track when new tracks are added to the playlist.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 7a46ffdf47 db: Give playlists a next_track() function
For picking the next track (with or without random enabled)

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 8a4590f0ed db: Preserve the current track when sorting
Implements: #39 (Preserve current track when sorting)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 23699a601d db: Have playlists clamp the current track value
And add a get_current_track() function to make it easier to get the
currently selected track. Clamping behaves differently if random or loop
are enabled to ensure a track is still picked.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker c658e873a6 db: Create a function to find playlists based on state id
So we can write the current playlist stateid to the settings file and
look it up later.

Implements: #36 (Find playlists based on playlist state id)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 6b5b2a745e db: Create a function for checking if this is a new database
So the tagdb can attempt to import tracks if none have been added to the
sql database yet.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker f82e299736 db: Add tracks.trackid ASC as a fallback sort option
This keeps us from ever completely clearing the sort field in the
playlist state, since that would lead to an incomplete SQL query error.

Fixes: #38 (PlaylistStates should not allow completely clearing sort)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker d8dbba0960 db: Commit after deleting a User playlist
Fixes: Issue #35 (Commit when creating or deleting new User playlists)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker adfbf8fdbc db: Give Discs a "number" property
So we can access the disc number when displaying tracks in the tracklist

Implements: Issue #34 (Give Discs a "number" property)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker ea31e1539a scanner: Adjust timing for the DirectoryChooserWidget test
Adding a brief sleep when checking main_context iterations gives the
widget a chance to update the path so the test can pass more reliably.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 472280ca9b sidebar: Don't pop up the dir chooser popover during testing
This can cause a segfault for some reason, but the test works perfectly
fine without it.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 3d77e8cd2a scanner: Give ImportTasks a "playlists" argument
So users don't need to re-create their playlists when switching over to
the sqlite database.

Implements: #10 (Import user playlists)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 2ab67258e9 scanner: Create an EnableSwitch
For changing a library path's "enabled" property

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 8f98dfdde7 scanner: Create an EnableLibraryTask
For enabling or disabling library paths through an idle task

Implements: Issue #37 (Create an Idle Task to enable / disable library paths)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker b8da049be9 scanner: Create a commit() shortcut function
For scheduling a commit task

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 3afaea664b scanner: Set initial ProgressBar visibility based on queue length
ProgressBars might be created after tasks have been pushed onto the
queue. Instead of setting initial visibility to False unconditionally,
we can check if queue length is greater than 1

Fixes: Issue #9 (Fix ProgressBar initial visibility)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 53c61160bc scanner: Add release date to the track metadata parser
This gives us a datetime.date() structure filled in with the release
date of the track.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:23 -05:00
Anna Schumaker 2753480052 lib: Create a custom filter Popover
For displaying errors in the regex that the user has entered

Implements: Issue #4 (Create common filtering widgets)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-03 16:11:30 -04:00
Anna Schumaker 3ae543b8e7 lib: Create a custom filter Entry
We check for an exception coming from Regex.set_pattern(), and use it to
set or clear the "warning" css class to let the user know something is
wrong.

Implements: Issue #4 (Create common filtering widgets)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-01 13:52:38 -04:00
Anna Schumaker aae99218e0 lib: Create a new Filter class
The intention is to have some common code that can be shared by both the
sidebar and the tracklist so they don't need to re-implement the same
things.

Implements: #4 (Create common filtering widgets)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-01 13:52:38 -04:00
Anna Schumaker 64a6fdca2d lib: Import and configure the gi module
lib needs Gtk for some of its widgets, so do the import here to make
sure everything is configured properly. This prevents some warnings at
the very beginning of testing as well.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-01 13:52:38 -04:00
Anna Schumaker 584e8ecc05 Emmental 2.7 AUR commi
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-01 13:50:12 -04:00
Anna Schumaker c9d4441256 Emmental 2.7
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-01 13:33:06 -04:00
Anna Schumaker 14724aa81e db: Give Playlists a passthrough for PlaylistState properties
This lets us handle changes easier, since we'll catch them as they
happen. This lets us emit the "refreshed" signal when sorting changes,
for example.

Implements: Issue #32 (Passthrough PlaylistState properties)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 13:29:09 -04:00
Anna Schumaker edb6857292 db: Give playlists a get_tracks() function
So the UI's Gio.ListModel can get the list of tracks when it is created,
instead of needing to look up individual tracks by index through a sql
query.

Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:25:08 -04:00
Anna Schumaker 01de88f474 db: Give playlists a refresh() function
The Collection playlist uses this to emit the "refreshed" signal to
notify higher layers that the contents of the playlist has changed.
Eventually, this will also be used to update playlists when sorting.

Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:25:05 -04:00
Anna Schumaker 0c3afb9d56 db: Give playlists a remove_track() function
And emit a "track-removed" signal to notify the higher layers.

Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:25:04 -04:00
Anna Schumaker 9b4153737b db: Give playlists an add_track() function
And emit a "track-added" signal to notify higher layers

Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:25:02 -04:00
Anna Schumaker 32dcd83865 db: Give Tracks a Decade property and genres() function
For accessing a Track's Decade playlist or list of genres

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:25:02 -04:00
Anna Schumaker f6c72ed081 db: Remove the now unused objects.py file
Implements: Issue #18 (Remove the db.objects.Map class)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:25:02 -04:00
Anna Schumaker 932663f872 db: Remove the PlaylistMap objects
We can now do everything it did and more through the various user
playlist objects.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:25:02 -04:00
Anna Schumaker bba00b3d27 db: Remove the GenreMap object
We can now do everything it did and more through the Genre playlist
object.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:25:02 -04:00
Anna Schumaker 847f182173 db: Give playlists a get_track_index() function
So we can send an "items-changed" signal once Playlists have been
converted to a Gio.ListModel

Implements: Issue #3 (Sort playlists through SQLite)
Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:24:59 -04:00
Anna Schumaker 1d5f88f080 db: Give playlists a get_track() function
For finding a single track at a given index into the select query
results, ordered by the configured sort order.

Implements: Issue #3 (Sort playlists through SQLite)
Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:24:56 -04:00