Commit Graph

3592 Commits

Author SHA1 Message Date
Anna Schumaker 50db0db06a core/date: Add functions for reading and writing date stamps
The date stamp is a single value that represents year, month, and day.
This should be slightly easier than working with three separate values.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 86d7fe43ed core/database: Add support for defragmenting databases
Removing items from the database leaves a NULL pointer "hole" that is
never filled in.  This doesn't affect correctness, but it could be
wasteful as items are added and removed.  This patch adds a function to
defragment the database without changing the order of items.

Implements #66: Add support for rebalancing databases
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 8d9139aea5 core/database: Add file versioning to databases
I plan to change the file format of some tags, so add versioning so we
can change things at different times.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 2f098a2af6 core/file: Set minimum version from passed arguments
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 939ebeac13 core/audio: Expose the audio_save() function
This will be used to re-save the current track after defragmenting the
track database.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker f726b6994c core/playlist: Add a function to force save playlists
This is needed to handle track database defragmentation, but could also
be expanded on later to save playlists from a generic place.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 54bb0ffe2b core/playlists/library: Save playlist flags between sessions
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker a4692c0fe0 core/playlists/artist: Save playlist flags between sessions
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker d33245f604 core/playlists/system: Clean up saving playlists
This prevents double-saves in both the playlist entrance function and in
the overridden function.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 6fc965e80d core/playlists/system: Remove legacy saving code
And delete files as they are upgraded.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 33894d7068 core/playlists/system: Add a new function for loading playlists
This function loads playlist information from a single file, falling
back to multi-file loading if playlist.system doesn't exist yet.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 87f0847f91 core/playlists/system: Add a new function for saving playlists
This saves playlists to a single file, rather than splitting them across
several.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 28e5045975 core/queue: Give queues the option to save and load iterator positions
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 84661c4797 gui/playlist: Hide empty playlists
I need to disable filtering when adding artist playlists to avoid some
weird memory corruption issues.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 278a54f7ec gui/playlist: Add a GtkTreeFilter to the playlist treeview
I intend to use this to hide empty playlists, but it could potentially
also be used to search for a specific playlist.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker c6e9c176d8 gui/playlist: Select playlists by double clicking
I make the current playlist bold so the user has an easier time finding
it.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 7a79ac26b0 core/playlists/system: Make sure Favorites and Hidden repeat
Otherwise playing tracks from these playlists will cause the tracks to
get removed.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 64ceca84c5 core/playlists: Pick the next track from the currently selected playlist
Unless the user has queued tracks, of course.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 8985e70439 core/playlists: Add a playlist_select() function
I query the underlying playlist to see if it is selectable, and then
update the settings file if it is.

Implements #10: Select default playlist
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker bfcfaae977 core/playlists: Add functions for converting between names and ids
I need to have integer playlist ids to store into the settings database
once I allow changing the default playlist.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker da19ddd388 gui/playlist: Set playlist size when cleared
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker 5232217eeb core/playlists/system: Overload playlist_delete() function
Instead of deleting a playlist, we can use this to clear
user-configurable playlists.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:34 -04:00
Anna Schumaker e4cd59b895 core/tempq: Remove tempq.c
Multiple temporary queues has been replaced with a single Queued Tracks
playlist.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-26 08:07:34 -04:00
Anna Schumaker 69e628f505 gui/tempq: Remove tempq.c
Temporary queues are being replaced by the Queued Tracks playlist.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-26 08:07:34 -04:00
Anna Schumaker 69b39ea717 gui/sidebar: Remove unused sidebar liststore
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-26 08:07:34 -04:00
Anna Schumaker 017da02827 gui/playlist: Add Queued Tracks playlist
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-26 08:07:34 -04:00
Anna Schumaker eb1361248d core/playlists/system: Add queued tracks playlist
Right now tracks are picked from this playlist whenever possible.  A
system for selecting the default playlist will be added shortly.

Implements #20: Only one queue for "Up Next"
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-26 08:07:20 -04:00
Anna Schumaker a775eeb761 core/playlists: Add a pl_next() playlist operation
This is mostly needed so the queued tracks playlist can be saved after
picking a track.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-23 16:11:08 -04:00
Anna Schumaker 903357395b core/audio: Save current track in settings database
The settings code is designed to map strings to unsigned integers, which
is exactly what we do here.  This lets us cut out an extra file access,
which is always a plus.  We remove the audio file after upgrading to
prevent reading it multiple times.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:08 -04:00
Anna Schumaker 7e00c8ed10 core/settings: Move settings into core/
Implements issue #9: Move settings into core/
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:08 -04:00
Anna Schumaker 524d1886f9 tests: Remove scons-based testing code
Completes issue #4: Investigate CTest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:08 -04:00
Anna Schumaker a8abbdfdcc Remove scons build files
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:08 -04:00
Anna Schumaker 19ca9d932b tests: Build gui audio test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 59839547e2 tests: Build gui playlist test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker dd268a24fe tests: Build sidebar test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 0470c6efa6 tests: Build gui idle test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 4e9c5e0a00 tests: Build window test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 6a1c27e9a4 tests: Build gui queue test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker b2dbbbaae6 tests: Build treeview test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker c671c7aefc tests: Build model test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 3e2ed7761c tests: Build settings test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 1710c8076a tests: Build gtk builder test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 8f8e4a4459 tests: Build audio test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 926ca09275 tests: Build tempq test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 7e09375325 tests: Remove core/playlist.c test
The playlist code is heavily tested by unit tests for the files in
core/playlists/, so we no longer need to have a separate playlist test.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 9b7c45634c tests: Build core/playlists/library test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 487274ff00 tests: Build core/playlists/artist test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker c67d09740c tests: Build core/playlists/system test with ctest
I initially tried making several helper functions to reuse code and make
it easier to add new playlists.  This didn't work all that well, mostly
because glib wasn't able to expand variable values or find the line
number that errors occured on.  Macros don't have this problem, since
they are expanded at compile time.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker f9dd51170d tests: Build queue test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker 8327d77ddd tests: Build tags/track test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00