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>
This is more straightforward than using my custom index code without
adding too much work.
Implements #43: Filter code can use a GHashTable directly
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 want to manage this container on my own, rather than relying on the
generic index code. This will eventually make it easier to store a
playlist as a queue, instead of a set.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This flag is used for bulk inserts to cut down on the number of gui
operations during startup. Let's just make it standard that unsetting
the flag causes the queue to resort itself.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
- Allocate CaaCoverArt as needed, rather than sharing one object
- Use MusicBrainz fuzzy search to match more albums
- Escape most special characters in filenames
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Reusing the Mb5Query can have undesireable side effects, such as the
error code not getting reset between queries. Fix this by allocating a
new Mb5Query before evey request.
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 think this results in a slightly better search, although there are
still a few wrong images fetched.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
If searching for artist and album fails, then fall back on album and
year or even just album name.
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>
I want to be able to print any message as an error message without
relying on errno. Let's handle this by introducing REPORT_ERRNO() to
look up the right error message for a given errno.
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>
There are enough differences in the read and write paths that
__file_open_common() was still trying to account for. Let's make a
simpler wrapper around g_fopen() and move differing code into
__file_open_read() and __file_open_write().
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>
The track database now tallys total play count and unplayed track count,
so we can use this information for calculating averages. I also changed
the least played tracks playlist to allow tracks with play count equal
to the average.
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>
Using somebody else's library is probably better than relying on my own
random number function.
Implements #32: Remove custom RNG code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Load all tag databases with the new load function.
Implements #15: Load track database through an idle task
Implements #16: Load library database through an idle task
Implements #17: Load genre database through an idle task
Implements #18: Load artist database through an idle task
Implements #19: Load album database through an idle task
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Scan over all tracks in the database first, and then schedule a
collection update.
Implements #13: Load collection queue through an idle task
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This will help reduce disk accesses during thet main startup sequence.
Implements #12: Load temporary queues through an idle task
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Let's save this disk access for when we're idle.
Implements #11: Load initial track through an idle task
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>
Enabling all queues by default, even ones read from disk, is incorrect
as it leads to all queues getting reenabled when restarting Ocarina.
Fixes#56: Enabled status of temporary queues not saving
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>