Commit Graph

24 Commits

Author SHA1 Message Date
Anna Schumaker 448b4a16f4 Remove core/queue.c and associated files
Everything has been merged into the playlist layer to better match how
playlists are actually used.  This means we can remove the queue files.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-05-13 08:45:05 -04:00
Anna Schumaker bd8df2a169 core/playlist: Add playlist_selected() for selected tracks
In most cases this function just triggers a UI update, but system
playlists have a little extra bookkeeping to do to remove the track from
the Queued Tracks playlist.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-05-13 08:45:04 -04:00
Anna Schumaker a87373f335 core/playlist: Add playlist_callbacks struct
This will be used to gradually phase out the queue_ops struct over the
next several patches.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-05-13 08:45:04 -04:00
Anna Schumaker b17585237a core/playlist: Add a playlist_played() function
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>
2017-04-28 09:40:02 -04:00
Anna Schumaker 7655b0cae8 core/playlist: playlist_{next,prev}() uses a playlist function pointer
Allowing us to access the playlist directly, rather than going through
the playlist-type interface.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 1fa31c51a6 core/playlist: Remove playlist_get_queue()
We can just look up the playlist instead, and then access the queue
variable from there.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 72d0f9a248 core/playlist: Remove playlist_get_id() function
And replace its use with direct access of the playlist->pl_id variable.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker b5c1af263a core/playlist: Rename playlist_cur() -> playlist_current()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 5c215df0bf core/playlist: playlist_select() takes a playlist pointer
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>
2017-04-28 09:40:02 -04:00
Anna Schumaker 73825dd916 core/playlist: Add a function to look up playlists by id
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>
2017-04-28 09:40:02 -04:00
Anna Schumaker 09e358b96b core/playlist: Rename playlist_get() -> playlist_lookup()
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>
2017-04-28 09:40:02 -04:00
Anna Schumaker 0c1147513e core/playlist: playlist_size() takes a playlist pointer
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 3364d4733e core/playlist: playlist_remove() uses a playlist-level function pointer
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>
2017-04-28 09:40:02 -04:00
Anna Schumaker 1b9cdf5a5c core/playlist: playlist_add() uses a playlist-level function pointer
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>
2017-04-28 09:40:02 -04:00
Anna Schumaker 066027ecb6 core/playlist: playlist_delete() uses a playlist-level function pointer
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>
2017-04-28 09:40:02 -04:00
Anna Schumaker ca5f0701e9 core/playlist: playlist_new() returns a playlist pointer
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>
2017-04-28 09:40:02 -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 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 487274ff00 tests: Build core/playlists/artist test with ctest
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:02 -04:00
Anna Schumaker aead4939c3 core/filter: Remove filter.c
It is unused now that I have a token matching system in place.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-29 07:33:00 -04:00
Anna Schumaker f70b2b940f core/playlists/artist: Add basic artist operations
For now, hidden tracks are shown in artist queues.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-13 08:31:30 -04:00
Anna Schumaker 24448aefec core/playlists/artist: Add tracks to the artist playlists
I use a single idle task to scan the track database and add to the
appropriate playlist.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-13 08:31:30 -04:00
Anna Schumaker 12ae7cfee6 core/playlists/artist: Add pl_artist_{init, deinit}() functions
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>
2016-08-13 08:31:30 -04:00