Commit Graph

1016 Commits

Author SHA1 Message Date
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
Anna Schumaker 8917600970 db: Clear MappedPlaylists before deleting
Otherwise we end up with a bunch of (playlistid, trackid) pairs in the
map table that don't refer to a valid playlist anymore.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:24:56 -04:00
Anna Schumaker 729b1efc9a db: Give playlists a get_n_tracks() function
For finding the number of tracks in the specific playlist.

Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-27 11:24:22 -04:00
Anna Schumaker 5ff03cf33f db: Give MappedPlaylists add_track() and remove_track() functions
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-18 15:50:07 -04:00
Anna Schumaker 0688088318 db: Create a MappedPlaylist type
For genre and most user playlists that rely on an extra map table to
figure out which tracks they have.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-18 15:50:07 -04:00
Anna Schumaker 72f654508c initial sort squash
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-18 15:50:07 -04:00
Anna Schumaker 0851aeb0cf db: Give playlists a default sort order
Most playlists sort by artist -> album -> year -> discno -> trackno, but
the Previous playlist sorts by rowid with the most recently added
tracks first, and the Up Next playlist sorts by rowid with the most
recently added tracks last.

Implements: Issue #13 (Give most playlists a default sort order)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-18 15:50:07 -04:00
Anna Schumaker a52a815338 db: Give Playlists a "rowkey" property
Most playlists will use this to look up their tracks in the track table

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-18 15:50:07 -04:00
Anna Schumaker 371878a53a Emmental 2.6 AUR commit
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-18 13:40:29 -04:00
Anna Schumaker 7975988dcc Emmental 2.6
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-18 13:37:50 -04:00
Anna Schumaker 6f9fb34792 db: Give playlists a delete() function
So we can remove playlists from the database when needed.

Implemets: Issue #29 (Give playlists a delete() function)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-16 17:37:23 -04:00
Anna Schumaker 2aad28f708 db: Give Playlists an "icon-name" property
This will be used by the sidebar to display playlist rows

Implements: Issue #20 (Give Playlist database items a icon-name property)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-15 16:11:34 -04:00
Anna Schumaker 063b93b66f db: Convert the TrackTable into a table.Table
Implements: Issue #11 (Cache database items fields)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-15 16:09:59 -04:00
Anna Schumaker 4235e794bd db: Convert the UserTable to a playlist.Model
Implements: Issue #11 (Cache database items fields)
Implements: Issue #14 (Convert Tables into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-15 16:09:58 -04:00
Anna Schumaker 67238ed385 db: Give Albums a find_disc() function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 17:03:19 -04:00
Anna Schumaker 44a002ecac db: Convert the DiscTable into a playlist.ChildModel
Implements: Issue #11 (Cache database items fields)
Implements: Issue #14 (Convert Tables into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 17:02:04 -04:00
Anna Schumaker 737d135d41 db: Give Artists a find_album() function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker a1f54839bb db: Convert the AlbumTable into a playlist.ChildModel
Implements: Issue #11 (Cache database items fields)
Implements: Issue #14 (Convert Tables into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker 0728579cc4 db: Convert the ArtistTable into a playlist.Model
Implements: Issue #11 (Cache database items fields)
Implements: Issue #14 (Convert Tables into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker f7907e4142 db: Convert the GenreTable into a playlist.Model
Implements: Issue #11 (Cache database items fields)
Implements: Issue #14 (Convert Tables into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker 90c6593921 db: Give Decades a find_year() function
And adjust the Year table and Track table to take a Decade as an
argument.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker 4141ca211c db: Convert the YearTable into a playlist.ChildModel
Implements: Issue #11 (Cache database items fields)
Implements: Issue #14 (Convert Tables into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker 8365afc0e3 db: Convert the DecadeTable into a playlist.Model
Implements: Issue #11 (Cache database items fields)
Implements: Issue #14 (Convert Tables into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker e6a65f8fe3 db: Convert the LibraryTable into a table.Model
I actually turn it into a playlist.Model, which is a table.Model that
handles playlist states for us.

Implements: Issue #11 (Cache database items fields)
Implements: Issue #14 (Convert Tables into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker 84ad195716 db: Convert the PlaylistStateTable into a table.Table
This gives us access to the new functions and built-in caching. I also
change the PlaylistState object to cache its values rather than querying
the database for everything.

Implements: Issue #11 (Cache database items fields)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker ca3a88557f db: Create new playlist.Model and playlist.ChildModel classes
These take the table.Model and table.Child classes and add playlist
state management to them.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:57 -04:00
Anna Schumaker 6d796e0a89 db: Create new Playlist and ParentPlaylist classes
These are the base classes that will be used by all our Playlist-like
objects.

Implements: Issue #11 (Cache database items fields)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-14 13:22:56 -04:00
Anna Schumaker a4fbd5f2f3 db: Rename playlist.py -> user.py
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-11 11:58:43 -04:00
Anna Schumaker 658be5bef1 db: Create a new Child class
This inherites from the Table, but takes a parent instance for some
functions and calculates offsets for items that descend from this
parent.

Implements: Issue #1 (Have SQLite sort our sidebar tables)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-11 11:58:43 -04:00
Anna Schumaker feeee8809d db: Create a new Model class
This inherits from the Table, but also implements the Gio.ListModel
interface with sorting for use in the sidebar Gtk.ListView

Implements: Issue #1 (Have SQLite sort our sidebar tables)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-11 11:58:43 -04:00
Anna Schumaker 427b9fb925 db: Create a new Table class
This is a simlified Table that can be inherited from to implement a
Table-based Gio.ListModel. This gives us the chance to have some tables
that aren't ListModel's, since not everything will need that interface
and unnecessary position-finding slows everything down.

Implements: Issue #8 (Split up db/objects.py)
Implements: Issue #12 (Make database items unique)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-11 11:58:27 -04:00
Anna Schumaker 9cf1df7c33 db: Move SQLite Connection stuff into a new file
I find this cleaner than importing from the toplevel module

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-10-07 13:58:09 -04:00