Commit Graph

34 Commits

Author SHA1 Message Date
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 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 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 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 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 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
Anna Schumaker e94346fdd9 db: Give Playlists a PlaylistState property
And clean up how the default playlists are created so the test doesn't
fall over with the new column.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:48:20 -04:00
Anna Schumaker 38861bbabf db: Create a PlaylistStateTable and PlaylistState object
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:18:24 -04:00
Anna Schumaker 0fd1069484 db: Add a PlaylistMap
And create both permanent and temporary maps for tracks. The temporary
map is intended to be used for the New Tracks and Previous playlists,
since we don't store the state across restarts.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:17:45 -04:00
Anna Schumaker 2b87707f16 db: Create a PlaylistTable and Playlist object
And populate the table with some default playlist values.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:17:17 -04:00
Anna Schumaker 5746b2a81f db: Add a GenreMap
For mapping tracks into a list of genres, or a genre into a list of
tracks.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:16:50 -04:00
Anna Schumaker ea555a428c db: Create a TrackTable and Track object
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:15:44 -04:00
Anna Schumaker f519830095 db: Create a LibraryTable and Library object
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:15:20 -04:00
Anna Schumaker 2af61f8787 db: Create a YearTable and Year object
I do lookups and inserts based only on the year field. Decades are
created automatically on insert.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:14:56 -04:00
Anna Schumaker cc65db6d79 db: Create a DecadeTable and Decade object
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:14:31 -04:00
Anna Schumaker feca3c7a19 db: Create a GenreTable and Genre object
I'll eventually need to add a mapping between tracks and their genre
list, but I still need to build up to having Track objects first

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:14:09 -04:00
Anna Schumaker bbb248f665 db: Create a DiscTable and Disc object
To represent each disc of an album. Discs may have different subtitles
that we want to display (or there may not be a subtitle at all). Casting
a Disc to a string either appends the subtitle to the album name or
returns the album name directly. This is intended to be used by the
ColumnView to display album names

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:13:48 -04:00
Anna Schumaker 6a1713630b db: Create an AlbumTable and Album tag
Similar to Artists, only holding information about each album instead.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:13:24 -04:00
Anna Schumaker 2d125546dd db: Add an ArtistTable and Artist tag
Also create an index on artist name in the sqlite table for faster
lookups.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-23 13:12:56 -04:00
Anna Schumaker 2822a9ac35 db: Add initial SQL connection object
And set the row_factory to use the built-in sqlite3.Row so we can access
columns by name in search results

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-08-22 07:33:43 -04:00