This replaces the "reset" field that had been passed to sort. I think
this makes things a little more straightforward, and gives us a function
we can call when freeing playlists.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This function uses the playlist save flags enum to determine what
exactly to save, including support for backwards compatibility with
6.4.x playlists.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This function uses the playlist save flags enum to determine what
exactly to load, including support for backwards compatibility with
6.4.x playlists.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I renamed "type.h" to "playlist.h" to better match what it does.
Additionally, I moved generic playlist functions into a new header file.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lets us call playlist_played() whenever we change tracks to send UI
updates once, rather than using multiple updates to change playcount and
now-playing status.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
It isn't needed now that playlist differences are handled in the upper
layer. This also lets me create a shared set of operations for dynamic
playlists.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This was only used by system playlists to keep the unplayed, most played,
and least played playlist up to date. We can handle this internally
through the playlist_played() handler.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This is used to notify when tracks have been played so dynamic playlists
can be updated, and so the model can display the correct playcount.
The old system playlist tests are mostly unnecessary at this point, so I
remove them as part of this patch.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Allowing us to access the playlist directly, rather than going through
the playlist-type interface.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And stores it for future reference, so we don't have to keep looking up
current and previous playlists.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This is much more straightforward than converting an id to a name and
then looking up playlists from there. This patch removes the now-unused
playlist_get_name() function.
This patch also lets me simplify the system playlist unit test, since I
can now check several similar operations using a loop. Additionally, I
change calls to pl_system_lookup() into pl_system_get() for efficiency.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I think "lookup" is a better name for this function, since it's similar
to performing a dictionary lookup.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Additionally, it also uses a playlist-level function pointer to decide
what to do. In most cases this calls the generic sort function, but the
history playlist should never be sorted.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Additionally, playlist_set_random() uses a playlist-level function
pointer to decide what to do. In most cases this will simply toggle the
flag, but the history playlist does not support random playback.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Rather than going through playlist-type operations. Additionally, I
take this opportunity to change playlist_remove() to take a playlist
struct directly.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Rather than going through playlist-type operations. Additionally, I
take this opportunity to change playlist_add() to take a playlist struct
directly.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Rather than going through the playlist-type operations. Additionally, I
take this opportunity to change playlist_delete() to take a playlist
struct directly.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This is much more useful than a boolean status, since we can use the
playlist pointer right away.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
It's frequently useful to get the playlist directly, rather than looking
up type and name first. Let's add a function to do just that!
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This pointer can be used immediately by testing code instead of simply
looking at the return status.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This is useful for user playlists so they can store their playlist-id
directly, letting us remove the entire playlist_get_id() function.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This flag was only used by the History playlist, but we have a noop
function to handle this instead.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Otherwise we could end up changing the random setting on the previous
playlist when displaying a new one.
Fixes#106: Switching playlists clears random setting
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I cleaned up several of the functions and added tests for making sure
everything is set correctly.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This patch also adds a unit test checking that the image is initialized
properly. In addition, I simplify things by changing the image widget
to be a direct child of the GtkButton.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This keeps all the audio operations together, and matches how we define
operations structs throughout the rest of Ocarina.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>