It takes an additional user= parameter to indicate if the user is asking
for the next track or if it is coming from the audio player (such as an
EOS / about-to-finish signal). This lets us handle the next_track() call
slightly differently for the user case.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And also a can-go-previous property to set the correct sensitivity on
the "Previous" button and for notifying MPRIS.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And add some special handling so a previous.Previous() playlist type is
created for the db_previous playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And add some special handling for setting the active playlist and
visible playlist to the same db playlist. I also add active-loop and
active-shuffle properties that are wired up to the MPRIS2 "Shuffle" and
"LoopStatus" player properties.
Implements: #7 (Add MPRIS2 Support)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I either create or reuse an existing Playlist object when the
db-visible property changes to a new value.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This Playlist implements some special handling for the Previous
Playlist. This includes adding a previous_tracks() function and
properties to indicate if the Playlist has a previous or next track.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We need to do some bookkeeping inside the Playlist before notifying the
Factory that a track has been requested.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This property is updated whenever the items in the Playlist change or if
the current-track property is changed. It can be used to know in advance
if calling next_track() can be expected to return a valid Track
instance.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And add a "shuffle" property to the Playlist class. I use a TrackidSet
instance to keep track of which trackids have already been picked, and
to select a random trackid from the remaining options.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I add a "loop" property to the Playlist class that can be set to "None",
"Playlist", or "Track" (to match the MPRIS2 loop property). I can then
tune the behavior of next_track() based on how loop is configured.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This sets the current_trackid field on the database playlist object to
the trackid of the provided track.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The move_track_up() and move_track_down() functions are used to manually
arrange the tracks in a playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This model builds on the TrackidModel to make it more Playlist and Track
focused instead of trackid centric.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The TrackidModel takes a TrackidSet and presents it as a Gio.ListModel
that maps trackids into Track objects. Tracks can be found by value
using the bisect() function, which sorts the trackids by number by
default (this can be changed by overriding the do_get_sort_key()
function).
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The playlist factory has properties for the currently selected,
currently active, and previous playlists. It will eventually create
Gio.ListModel instances representing the tracks in each of these playlists,
in sorted order.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>