In this case, the call to get_track_index() returns None which can't be
used for the comparisons we're doing. Make sure we handle the None
result explicitely.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We need to limit the OVER () clause to just pick tracks that are
actually on the requested playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Again, we have to be careful not to check positions against playlists
where current == -1 for performance reasons.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We have to be careful not to check track positions against playlists
where current == -1, because this could drastically slow down adding new
tracks because SQLite would need to find the position for every track
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And add a get_current_track() function to make it easier to get the
currently selected track. Clamping behaves differently if random or loop
are enabled to ensure a track is still picked.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lets us handle changes easier, since we'll catch them as they
happen. This lets us emit the "refreshed" signal when sorting changes,
for example.
Implements: Issue #32 (Passthrough PlaylistState properties)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
So the UI's Gio.ListModel can get the list of tracks when it is created,
instead of needing to look up individual tracks by index through a sql
query.
Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The Collection playlist uses this to emit the "refreshed" signal to
notify higher layers that the contents of the playlist has changed.
Eventually, this will also be used to update playlists when sorting.
Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And emit a "track-removed" signal to notify the higher layers.
Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And emit a "track-added" signal to notify higher layers
Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
So we can send an "items-changed" signal once Playlists have been
converted to a Gio.ListModel
Implements: Issue #3 (Sort playlists through SQLite)
Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
For finding a single track at a given index into the select query
results, ordered by the configured sort order.
Implements: Issue #3 (Sort playlists through SQLite)
Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Otherwise we end up with a bunch of (playlistid, trackid) pairs in the
map table that don't refer to a valid playlist anymore.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
For finding the number of tracks in the specific playlist.
Implements: Issue #15 (Convert Playlists into Gio.ListModels)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
For genre and most user playlists that rely on an extra map table to
figure out which tracks they have.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Most playlists sort by artist -> album -> year -> discno -> trackno, but
the Previous playlist sorts by rowid with the most recently added
tracks first, and the Up Next playlist sorts by rowid with the most
recently added tracks last.
Implements: Issue #13 (Give most playlists a default sort order)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
So we can remove playlists from the database when needed.
Implemets: Issue #29 (Give playlists a delete() function)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This will be used by the sidebar to display playlist rows
Implements: Issue #20 (Give Playlist database items a icon-name property)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
These are the base classes that will be used by all our Playlist-like
objects.
Implements: Issue #11 (Cache database items fields)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And clean up how the default playlists are created so the test doesn't
fall over with the new column.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And create both permanent and temporary maps for tracks. The temporary
map is intended to be used for the New Tracks and Previous playlists,
since we don't store the state across restarts.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>