Commit Graph

623 Commits

Author SHA1 Message Date
Anna Schumaker 7fbef057bf core: Add a field to initdata for enabling async idle tasks
I'll use this when testing gui album art to enable fetching the artwork.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-14 13:58:05 -04:00
Anna Schumaker d373c55320 core/queue: Add a queue_erase_track() function
Used to trigger the erase callback on tracks, rather than indexes.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-14 13:58:05 -04:00
Anna Schumaker fd84222c2b core/playlist: Add a function for getting the current playlist
This is useful to keep playlist settings variables hidden to the GUI.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker 85bb67feed core/playlist: Add a private field to struct playlist
I intend to use this for playlist filtering to store filter text.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-10-31 07:44:34 -04:00
Anna Schumaker e7b4973a50 core/playlist: Add playlist_get() function
This is called to get the requested playlist.  I also reworked
playlist_get_queue() to call this function.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-10-31 07:44:34 -04:00
Anna Schumaker be3b788380 core/playlists/system: Don't read 6.4.x playlists in new idle tasks
Track database defragmenting can happen before the new tasks are ever
scheduled, causing a crash when we try to find tracks with changed IDs.
After the crash, the Favorites and Hidden playlist data appears to be
lost.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-10-21 11:31:11 -04:00
Anna Schumaker 50207c5b79 core/playlist: Don't reselect the current playlist
We want playback to continue after the queued tracks playlist has run
out.  Allowing us to select the same playlist multiple times can cause
us to get stuck picking the next track.

Fixes #100: Finishing "Queued Tracks" playlist shouldn't stop playback
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-10-19 07:58:10 -04:00
Anna Schumaker 4250757b83 core/playlists: Don't leak playlist names while loading
We need to free the playlist name after looking up in case we hit the
case where the playlist isn't found.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-29 14:50:36 -04:00
Anna Schumaker cb2af114c5 core/playlists/user: Free playlist name during deinit
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-29 12:44:17 -04:00
Anna Schumaker b4d78b0d3d core/playlists/library: Free scan path when we're done with it
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-29 12:44:17 -04:00
Anna Schumaker 6120366da3 core/tags/album: __album_query_artist() needs to initialize "found"
Otherwise we could end up checking this variable uninitialized.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-29 12:44:17 -04:00
Anna Schumaker eb8a23f2ff core/tags/track: Add support for re-keying the track database
This lets up update track keys to prevent duplicates showing up during a
library path update.

Fixes #93: Library sometimes has duplicated tracks
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 15:41:56 -04:00
Anna Schumaker 811509ff80 core/database: Add a db_rekey() function
Sometimes database entry keys change, so this gives us a way to update
them in the database keys hash table.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 14:58:30 -04:00
Anna Schumaker cf4eedb592 core/database: Autosave databases if the file version changes
To make sure the latest changes are recorded to disk.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 12:02:45 -04:00
Anna Schumaker 93d1550763 core/settings: Check for a NULL key
This fixes a problem with restoring treeview columns.  Sometimes
"Played" gets allocated way too much space, so I solve this by changing
it's setting key to NULL so the column always gets whatever space is
leftover.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 12:02:23 -04:00
Anna Schumaker 419d31d4c3 core/playlists/system: Drop support for looking up the "Banned" playlist
This playlist has been the same as the hidden playlist for several
releases now.  Let's make the change official!

Implements #28: Save hidden playlist as "hidden" instead of "banned"
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:36 -04:00
Anna Schumaker ef8a764780 core/playlists: Allocate artist and library playlists during startup
Rather than waiting for them to load with an idle task.  This speeds up
Ocarina startup dramatically, since playlists can be added to the UI
with the correct size instead of needing extra callbacks to update the
size each time a track is added.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:36 -04:00
Anna Schumaker 27436115c7 core/database: Remove dbe_setup()
This was added so tracks could bump the libary tag size.  Now that the
size field has been removed, we can remove this function.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:36 -04:00
Anna Schumaker 1b18177d0a core/database: Remove db_load_idle()
This was added to help show the window faster.  Recent changes have made
it unnecessary.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker b39c4c9ba4 core/file: File version is OCARINA_MINOR_VERSION
This makes file versioning way easier, since every file will have the
same version.  I'll still need to manage minimum-supported versions, but
that shouldn't be too difficult going forward.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker d8c3fb9ace core/audio: Add support for changing audio volume
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker ecebd20a0b core/playlists: Select queued tracks playlist when adding tracks
This lets me "pause" playing queued tracks in favor of other playlists.
I remember the previous playlist so we can resume track picking once the
queued tracks playlist is empty.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker dcbf2dff72 core/playlists/user: Add support for user created playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker d6e5e6c773 core: Defragment databases on startup
Databases can change either as part of an upgrade or through adding and
removing entries.  We can save a bit of memory by removing unallocated
entries during startup.

Implements #47: Automatic database defragment
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 85bfe717dd core/tags/library: Remove unused li_size variable
This was used to display the number of tracks in each library path.  We
can use playlist functions to get this information now.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 30cebb4a45 core/tags/library: Remove unused "enabled" field
This was used to enable and disable library paths in previous Ocarina
versions.  This isn't used anymore now that we have library-based
playlists.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 784cd3eb91 core/tags/track: Remove redundant artist and genre tags
The track tag doesn't need these tags now that they can be found in the
album tag.

Implements #64: Remove Artist and Genre pointers from Tracks
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 71ee59ae22 core/tags/track: Reduce amount of saved data
Artist and genre information are already saved by the album tag.  In
addition, we can save a single date stamp instead of (year, day, month)
triplets.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 0cefd158d9 core/tags/album: Add artist and genre information to saved data
And perform an upgrade when reading back in.  After track tags are read,
we can save the database in the new format and remove the old tags.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 0ea75ccb29 core/tags/album: Add artist and genre arguments to album_find()
And propegate these through the alloc steps to create an album with the
correct artist and genre tags set.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker ffd09d410c core/tags/album: Add Genre ID to album keys
This allows for representing albums with multiple genres.  I know this
doesn't happen too often, but it doesn't hurt to be covered.  At the
very least, now we have a genre id for constructing new albums!

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker a85a1df7de core/tags/album: Add Artist ID to album keys
I need a way to represent the same album with different artists to
account for multi-artist albums.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
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 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 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