Commit Graph

46 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 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
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 b3750aa31c core/playlists/system: Compare playlist names in a loop
This is easier to maintain than a giant switch statement, and should
make it easier to add new playlist types in the future.

Implements #61: Clean up system playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-08-29 07:32:44 -04:00
Anna Schumaker d3e2f069fd core/playlists/system: Load collection in a separate idle task
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-08-29 07:31:29 -04:00
Anna Schumaker 81aea3017e core/playlists/system: Trigger an update during playlist init
This is a bit cleaner, and helps to simplify the system playlist
initialization process.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-08-29 07:31:29 -04:00
Anna Schumaker f4b12c5a83 core/playlists/system: Define each playlist near it's associated functions
I think this is a bit cleaner, and helps to keep similar things
together.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-08-29 07:31:20 -04:00
Anna Schumaker 532d55ba4f core/playlists/system: Clean up collection save and load function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-28 10:13:03 -04:00
Anna Schumaker 019137e4ed core/playlists/generic: Add a playlist_generic_update() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-28 10:13:03 -04:00
Anna Schumaker dddb098354 core/playlists/generic: Add a playlist_generic_init() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-28 10:13:03 -04:00
Anna Schumaker 1a29458d7c core/playlists/generic: Add a playlist_generic_remove() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-28 10:13:03 -04:00
Anna Schumaker c2a7d0289f core/playlists/generic: Add a playlist_generic_add_track() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-28 10:13:02 -04:00
Anna Schumaker 8f7e8be39d core/playlists/generic: Add a playlist_generic_set_flag() function
The history playlist uses a noop function, since changing random or
repeat settings doesn't make sense for this playlist.  The collection
playlist uses a custom function to save changes after setting a flag.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-28 10:13:02 -04:00
Anna Schumaker a80a84a955 core/playlists/generic: Add a playlist_generic_sort() function
I set the history playlist to use a noop function, since changing the
history doesn't really make sense.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-28 10:13:02 -04:00
Anna Schumaker d460bcaee8 core/playlists/system: Add struct sys_playlist
This will contain the playlist and operations for each secific type.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-28 10:13:02 -04:00
Anna Schumaker c448db2665 core/playlists: Add playlist_{new, delete}() functions
System playlists cannot be created or deleted, so these functions simply
return false in this case.  Library playlists will use this to add new
library paths to Ocarina.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-13 08:31:30 -04:00
Anna Schumaker e4930704a2 core/playlists/system: Add pl_system_delete_track()
Called to remove a track from all system playlists.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-13 08:31:30 -04:00
Anna Schumaker 03ed7c4b84 core/playlists/system: Add pl_system_new_track()
Called to tell system playlists that a new track has been added to the
database.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-13 08:31:30 -04:00
Anna Schumaker cfeca9ae4b core/playlist: Add playlist_type enum
I'm going to use this to distinguish between various playlist types that
are about to be added.  Let's update the playlist functions first, and
then add more types in a future patch.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-13 08:31:30 -04:00
Anna Schumaker 5a54fb69b6 core/collection: Remove unused queue
And remove collection_ops from the core initdata

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:09:33 -04:00
Anna Schumaker efae58c356 core/playlists/system: Add history playlist
Implements #8: Convert history queue into a playlist
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:06:04 -04:00
Anna Schumaker 6265b937c7 core/playlists/system: Add collection playlist
Implements #7: Convert collection queue into a playlist
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:06:03 -04:00
Anna Schumaker 5d4de9c5b0 core/playlist: Add playlist_sort() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:06:03 -04:00
Anna Schumaker c7bc2062d2 core/playlist: Add playlist_{get,set}_random()
I'll need this to toggle the random flag for the Collection playlist to
avoid cycling through the GUI in order to save.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:06:03 -04:00
Anna Schumaker 62123eb025 core/playlists: Add struct playlist
Containing the playlist name and queue.  I pass this to the gui through
the queue_init() function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:06:03 -04:00
Anna Schumaker 44a57ed863 core/queue: Add extra paramater to queue_init()
This is used to pass through a value to the GUI during queue
initialization.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:06:03 -04:00
Anna Schumaker 1d1e41916a core/playlists/system: Check that we read a valid playlist name
Otherwise we could crash when we try to access an out of bounds area of
the playlist array.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-07-28 08:55:53 -04:00
Anna Schumaker 2ff7113668 core/playlists/system: Move the least played playlist into system.c
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-19 16:03:10 -04:00
Anna Schumaker 9d3cc2e5ab core/playlists/system: Move the most played playlist into system.c
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-19 16:03:09 -04:00
Anna Schumaker 5ab2e63734 core/playlists/system: Move the unplayed tracks playlist into system.c
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-19 16:03:06 -04:00
Anna Schumaker 1527ee0e6d core/playlist: Add playlist_update() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-19 16:03:06 -04:00
Anna Schumaker a465577c86 core/playlists/system: Move system playlists into a new file
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-19 16:03:06 -04:00