Commit Graph

462 Commits

Author SHA1 Message Date
Anna Schumaker b9195e8319 curds: Use stable hashing for tags
The builtin hash() function adds salt to strings, making them unstable
across different python sessions. Switch to using hashlib sha256 hashes
that should retain the same value across multiple runs.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-21 10:38:53 -04:00
Anna Schumaker 59a10181a5 rind: Store the largest known node height
If our filter text has no results, then backing out could lead to
partially cutting off node text.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-20 09:30:22 -04:00
Anna Schumaker 24dcd2c263 rind: Have the playlist view respond to the show-more signal
And use it to show the track search entry and separator

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-16 19:42:07 -04:00
Anna Schumaker f642f17836 rind: Update the treeview when queued tracks are played
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-16 19:42:07 -04:00
Anna Schumaker 70b7757c0a curds: Send track with track-added and track-removed notifications
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-16 19:42:07 -04:00
Anna Schumaker 5f0c77e86d rind: Add tracks to the Up Next playlist through a column click
Similar to how we add tracks to the starred playlist. I was having
trouble getting the treeview to update properly, so I take the
heavy-handed approach of redrawing the entire view.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-16 19:42:07 -04:00
Anna Schumaker daf7b6180c rind: Add an up-next column to the playlist model
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-15 11:22:06 -04:00
Anna Schumaker b52bce2c80 curds: Create a shortcut for the Up Next playlist
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-15 09:58:38 -04:00
Anna Schumaker 86e37a015e curds: Create an Up Next playlist
Tracks added to this playlist are removed as they get picked. The UI is
in charge of switching to this playlist when tracks are added.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-15 09:29:28 -04:00
Anna Schumaker 76f206c69f rind: Unselect selected rows when doing a scroll_to()
Otherwise we'll select an additional row with every track change, never
unselecting previous tracks.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-10 09:52:27 -04:00
Anna Schumaker 7aad72cd8a curds: Lookup playlist nodes using bisects
The root node isn't sorted, so we still have to visit every node while
doing the lookup.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-10 09:08:09 -04:00
Anna Schumaker e610a7a078 curds: Remove node.insert_child() function
This function is now unused, since we're using bisection insertion
instead. We switch remaining callers over to using node.append_child()
while we're at it.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-10 08:55:12 -04:00
Anna Schumaker fe181b72a4 curds: Use bisect to find playlist nodes
This lets us find nodes and insertion points all in the same step, so
it's way more efficient

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-03 11:54:08 -04:00
Anna Schumaker adca6f3813 curds: Return inserted playlist node from __insert_node__()
This is way more useful than returning the index of the node

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-03 11:08:50 -04:00
Anna Schumaker 7991ec44b2 curds: Remove old playlist node less-than operator
We're comparing sort keys directly now, and not nodes

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-03 10:22:47 -04:00
Anna Schumaker ea64bad17d curds: Remove old __normalize__() function from playlist nodes
It's purpose has been replaced with sort keys

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-03 10:22:37 -04:00
Anna Schumaker 42322e1a40 curds: Have playlists use the new sort.bisect() function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-03 10:22:30 -04:00
Anna Schumaker f4748e63f6 curds: Implement a bisect function in the sorting code
And give it the option to pass extra arguments to sort_key() functions

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-02 21:22:32 -04:00
Anna Schumaker ce7b7a4f67 curds: Allow passing values to node.sort_key()
So we can compare keys that have undergone the same transformation

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-02 20:51:27 -04:00
Anna Schumaker 53ae9ccb6c curds: Use sort keys for inserting playlist nodes
This is slower, but puts things in their right place. Implementing a
bisect search should help speed this up.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-02 20:36:41 -04:00
Anna Schumaker 48edd46446 curds: Give library playlists a custom sort_key() function
We should have special handling for filesystem paths for sorting

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-02 20:28:17 -04:00
Anna Schumaker 7455681202 curds: Switch library node to use the find / lookup allocate interface
And rescan paths when they're looked up again.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-02 20:17:59 -04:00
Anna Schumaker 84c77a25bc curds: Switch decade playlists to the new find / alloc interface
And clean up the unit test while we're at it

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-02 09:00:28 -04:00
Anna Schumaker 78fb399ed6 curds: Switch artist playlists to the new find / alloc interface
And clean up the unit test while we're at it.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-01 22:34:06 -04:00
Anna Schumaker 7998a734e4 curds: Switch genre node over to the find_node() / alloc_node() interface
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-01 21:38:05 -04:00
Anna Schumaker aef622d39b curds: Implement functions for finding and allocating nodes
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-01 21:18:07 -04:00
Anna Schumaker 27196c7069 curds: Replace playlist sort_key() with track_key()
Now we don't have to do an extra check for what key we're looking for.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-31 16:35:10 -04:00
Anna Schumaker 93098884b4 curds: Move common sort key functions into a new module
And add a convenience function for normalizing unicode text while we're
at it.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-31 15:01:40 -04:00
Anna Schumaker 5292a69a20 curds: Give playlist nodes a sort_key() function
And use it for doing less-than checks

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-31 13:34:01 -04:00
Anna Schumaker 054b9d05c2 curds: Give tracks their own sort_key() function
I'm about to give playlists a sort_key(), so clean up the existing
function first

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-31 11:23:48 -04:00
Anna Schumaker 4d5a347cc0 curds: Add check for adding a track multiple times to a playlist
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-29 14:50:50 -04:00
Anna Schumaker d5f03710e5 curds: Clean up genre node test
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-29 14:09:40 -04:00
Anna Schumaker 6ff1d34d0c curds: Clean up collection playlist test
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-29 09:53:33 -04:00
Anna Schumaker 3097e425a4 curds: Clean up previous playlist test
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-29 09:31:21 -04:00
Anna Schumaker 5920fa4d8a curds: Clean up user playlist test
Split this up into more focused tests

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-29 09:13:05 -04:00
Anna Schumaker c569e7baf9 curds: Create a playlist.contains() function
And clean up related code to use this rather than an index == None check

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-27 09:00:15 -04:00
Anna Schumaker 9fb3c45886 rind: Enable selecting multiple tracks
I needed to switch starring multiple tracks at once to happen during a
button press instead of release, since the selection changes between
these two events.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-27 08:13:07 -04:00
Anna Schumaker 3eef442ee6 rind: Implement the TreeDragDest interface in the PlaylistModel
Testing this runs into the same problem that the TreeDragSource patch
hit - we're not able to manually allocate a Gtk.SelectionData object. We
can still test the code that does the move but we can't verify that
we're using the interface correctly

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 16:22:47 -04:00
Anna Schumaker 20cbe5aca6 rind: Implement the TreeDragSource interface in the PlaylistModel
We're not able to completely test this implementation due to
Gtk.SelectionData() missing a constructor. Fingers crossed that it gets
added in a future release of python-gobject

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 16:22:47 -04:00
Anna Schumaker 7225c23f94 rind: Add a path_track() function to the PlaylistModel
There are a few places where we need to do this, so make a function that
is more straightforward than using an iterator

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 14:52:27 -04:00
Anna Schumaker ce4ac4848a rind: Handle the remove-track notification
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 11:25:55 -04:00
Anna Schumaker 71a8e9b140 rind: Remove tracks from starred playlist on second click
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 11:08:21 -04:00
Anna Schumaker 8acd119630 curds: Add a function for moving tracks in a playlist
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 11:08:21 -04:00
Anna Schumaker 214ffab2b7 curds: Add a playlist.remove() function
For removing tracks from playlists

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 11:08:21 -04:00
Anna Schumaker 1e422a1711 curds: Clean up playlist sorting test
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 10:02:35 -04:00
Anna Schumaker 213854f3fa curds: Remove playlist.show() function
Let's just set the visible state directly. Additionally, I add a test
for setting visibility back to false when showing a different playlist

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 09:04:50 -04:00
Anna Schumaker ce269d496d curds: Rewrite playlist loop and random tests
Split these up to make them simpler

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 08:54:20 -04:00
Anna Schumaker c42d73a902 curds: Rearrange playlist next and peek tests
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-24 08:44:43 -04:00
Anna Schumaker 3e8b69d605 curds: Clean up bisect() and add index() function
This lets us clean up add() so we only need to loop over the list once
and we can remove the buggy built-in iterator code.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-23 16:12:54 -04:00
Anna Schumaker 419e80d983 rind: Clean up playlist track add tests
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-05-23 15:52:41 -04:00