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>
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>
Scanning new library paths should also add artist playlists, otherwise
they won't show up until Ocarina is restarted.
Fixes#79: Artist playlists not updated when tracks are added
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The pl_artist_init() function is used to allocate a playlist for each
artist already in the database, and pl_artist_deinit() is then used to
free up this memory during cleanup.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
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>
The pl_library_init() function is used to allocate a playlist for each
library path already in the database, and pl_library_deinit() is then
used to free this memory during cleanup.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Similar to the library tag, this is a void pointer that should only be
used by the playlist layer.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I decided to set this as a void pointer to keep other layers from using
the playlist without our knowledge. The only user of this variable
should be the playlist code.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
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>
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>
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>
It doesn't make sense to have a subdirectory with a single file. Let's
move it back to core/
Implements #45: Move database into core/
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I think this is cleaner than having an upper layer allocate the results
set manually. This also lets me return NULL in the case that there were
no results.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I was storing database indexes, but this assumes that database indexes
are constant. I intend to change this with database defragmentation.
Implements #46: Filter stores a track pointer
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This is used to remove tracks from the filtering index. We'll need this
once we switch over to storing pointers to keep the same track from
getting added multiple times.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
The thread pool is used to fetch album art in the background, but this
can slow down most tests that aren't interested in album art. Adding a
(testing-only) function for running without the thread pool speeds
things up a bit.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I intend to use this for creating playlists with different properties,
such as using the playlist interface to add library paths.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I plan to remove the containers/queue implementation, so we need a new
iterator for queue access.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I use this status indicator in the playlist code fairly often, so let's
return it directly rather than needing to code around it.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This is needed so the user can manually set album artwork in the cases
where either we don't fetch the right image or no image is found.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I want to reuse as much file code as I can for cache files, but I need a
new struct since data and cache files track different properties.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I don't think it makes sense that callers of file_open() are expected to
check the file version after opening. This should be something handled
by the file code so we can print a consistent error message.
Implements issue #5: Better file versioning
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
And then rename the temporary file when closed. This protects users
data in case Ocarina gets killed.
Implements issue #31: Make file writes seem atomic
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'm only setting this to a static string, so it doesn't make sense to
store this as a char array. Let's use a string pointer instead.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'm going to use this for saving album art to the right place. I moved
it into an include file to avoid duplicating code.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function returns the average count of tracks that have been played,
and not the average count of all tracks.
Implements #29: Efficiently calculate average play count of tracks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I no longer need these now that the queue is using the glib
g_random_int_range() function.
Implements #32: Remove custom RNG code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I need to do this for temporary queues in addition to the collection for
bolding to work properly.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function is similar to queue_remove(), except the remove can be
prevented if qop_erase() returns false.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
We don't need different operations for each queue. If we store this
then a higher layer doesn't need to keep passing the same structure over
and over again.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function is used to notify a higher layer that a queue is being
deinitialized. The higher layer should then clean up any state
associated with that queue.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function is used to notify a higher layer that a queue has been
initialized. That higher layer can return a pointer to be attached to
the "private data" field of the queue.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
6.4.8 changed how random tracks are selected, but never updated the unit
test. This patch fixes the unit test, and makes a few changes to make
sure the right tracks are getting selected.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>