Commit Graph

462 Commits

Author SHA1 Message Date
Anna Schumaker 4e1e2b0d0a rind: Set album artwork through an idle task
This lets us set the album art once per track, rather than up to three
times.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-01-02 17:25:11 -05:00
Anna Schumaker 1891bc8f61 rind: Calculate a fixed height for album art
And make sure we center the pixbuf in the GtkImage by allowing the image
to expand to its maximum width.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-01-02 16:40:49 -05:00
Anna Schumaker a7438b2be3 rind: Set a default image when there is no artwork
This acts as a placeholder, and keeps the sidebar from bouncing around
when tracks are changed.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-31 10:55:35 -05:00
Anna Schumaker 0b334ddbee rind: Scale artwork when the sidebar position is changed
I always scale from the original reference image, and never from the
displayed pixbuf. This avoids artifacts due to lossy scaling algorithms.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-31 10:27:54 -05:00
Anna Schumaker d2c71f83a8 rind: Add an artwork widget
And look for the "image" tag from the gstreamer pipeline when setting.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-31 08:41:55 -05:00
Anna Schumaker 37c2260ebc Add an application icon
I took inspiration from a few other icons I found online, but I hacked
up my own version in Inkscape.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-30 20:41:05 -05:00
Anna Schumaker 21c23cf944 curds: Remove unused tags/ directory
I'm honestly surprised that this is still here

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-19 13:42:29 -05:00
Anna Schumaker b728137588 curds: Remove icon argument from lookup() and alloc_child()
We were ignoring this argument and setting whatever is appropriate in
alloc_child(), so let's just remove it entirely.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 12:22:52 -05:00
Anna Schumaker 7f2864ec07 curds: Move the PreviousPlaylist into special.py
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 11:55:06 -05:00
Anna Schumaker 9fdf837046 curds: Move the UpNext playlist into special.py
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 10:49:21 -05:00
Anna Schumaker e4709a80e2 curds: Collection playlist cleanups
- Use constants for icon and sort fields
- Move into a new special.py file

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 10:49:11 -05:00
Anna Schumaker ebd330098a curds: Move the NewPlaylist() into user.py
This could exist as its own file, but it is only ever used from user.py.
Merging helps to simplify the code a little.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 10:01:53 -05:00
Anna Schumaker 65af043778 curds: User node cleanups
- Use constants for the starred playlist icon and sort fields list
- Don't keep a reference to the new and starred playlists, and allocate
  new instances after a reset()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 10:00:15 -05:00
Anna Schumaker 1291adb48b curds: Library node cleanups
- Use constants for the sort fields list
- Have alloc_child() set the icon directly, rather than using the one
  passed in by lookup()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 09:32:16 -05:00
Anna Schumaker 09ee71e616 curds: Decade node cleanups
- Use constants for the sort fields list
- Have alloc_child() set the icon directly, rather than using the one
  passed in by lookup()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 09:22:48 -05:00
Anna Schumaker d380a6f329 curds: Genre node cleanups
- Use constants for the sort fields list
- Have alloc_child() set the icon directly, rather than using the one
  passed in by lookup()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 08:56:17 -05:00
Anna Schumaker e7e1838b13 curds: Artist node cleanups
- Use constants for the sort list
- Have alloc_child() set the icon directly, rather than using the one
  passed in

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 08:52:11 -05:00
Anna Schumaker 803cb6f186 curds: Replace find_child() with lookup()
We use the allocate version everywhere already, so let's just rename it
to lookup and have a less confusing name.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-16 16:37:12 -05:00
Anna Schumaker d7ad6c5894 curds: Remove the PlaylistNode class
It is now unused

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-16 13:43:40 -05:00
Anna Schumaker 88b45a3fee curds: Remove append_child() from the PlaylistNode
And work it into the PlaylistRoot's __init__() function

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-16 13:25:34 -05:00
Anna Schumaker 8f9657ce8b curds: Remove the node_lock from the PlaylistNode
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-16 13:21:48 -05:00
Anna Schumaker 1b88795d17 curds: Pop empty playlists earlier during playlist.next()
Rather than waiting until the next next() call, we can detect and remove
them right away.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-16 10:26:08 -05:00
Anna Schumaker 99de9c0f7d curds: Move Current playlist handling out of the Root node
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-16 10:18:25 -05:00
Anna Schumaker 75a8c8d169 curds: Move playlist selection out of the Root node
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-16 09:56:19 -05:00
Anna Schumaker d25a026282 curds: Move playlist.peek() out of the Root node
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-16 09:04:12 -05:00
Anna Schumaker 1943a7bb08 curds: Move playlist.next() implementation into the __init__.py file
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-15 14:17:31 -05:00
Anna Schumaker eb507d96d1 curds: Move playlist previous() function out of Root
And into the package init file

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-15 09:18:39 -05:00
Anna Schumaker 1088bb16ce curds: Move Root's self.track function into __init__.py
And keep it as a global variable. This reduces the amount of work in the
root node, and makes things a little easier to follow

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-15 09:10:40 -05:00
Anna Schumaker 52c68eb3e2 curds: Rename previous.py to prev.py
I want to create a previous() function in the __init__.py file, but this
is causing import errors. We need to rename this file so everything
works as expected.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-15 08:38:06 -05:00
Anna Schumaker 38c6e9d35f curds: Remove extra Root lookup step from these function calls
We still do this internally in the playlist/__init__.py file, so we can
skip it here and make the lines a little shorter.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-14 08:19:30 -05:00
Anna Schumaker f5262278df curds: Remove the __init_common__() function
And fix up the user node so it still works as expected

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 16:09:27 -05:00
Anna Schumaker 708ae8ede2 curds: Auto-register new_track() functions for tree nodes
It's pretty easy to detect this in the base class, so let's save
the child classes some work.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 15:52:43 -05:00
Anna Schumaker 21f6bd62a8 curds: Give playlists their own plist_lock
Rather than continuing to use the tree lock. This lets us be a little
more focused in what the locks protect, while also allowing tree
operations to happen in parallel with playlist operations.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 15:52:42 -05:00
Anna Schumaker c2034b16a2 curds: Split out the body of the playlist __next__() function
This lets us have peek() advance a counter without actually changing the
state of the playlist and avoids a potential deadlock from calling
next() with the lock held.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 14:50:15 -05:00
Anna Schumaker 01a7cc3c74 curds: Give playlists a common __find_track__() function
This cuts down on code duplication, and lets us use bisection searches
to find tracks in more places.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 14:42:16 -05:00
Anna Schumaker 3dd2e428f1 curds: Rename PlaylistNode.lock -> PlaylistNode.node_lock
I want to have a separate playlist lock named "lock", so this frees up
the name.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 10:38:45 -05:00
Anna Schumaker 4586577cc5 curds: Remove unused PlaylistNode.get_root() function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 09:07:28 -05:00
Anna Schumaker 426eeb0c97 curds: Fix a deadlock with ETree.lookup_path()
Most functions lock the tree from the leaves up, but this was locking
the tree from the root down. This was leading to frequent deadlocks.
Let's fix this by only holding the tree_lock to look up each node, and
release it ASAP instead of locking the entire tree.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 09:06:34 -05:00
Anna Schumaker 53a1e085d4 curds: Move child ID lookups into the ETree
Using the new system keeps us from needing to maintain an external
dictionary of nodes.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 09:06:04 -05:00
Anna Schumaker 030e470f95 curds: Keep a mapping of all descendant node IDs
We're going to use this to be able to look up by ID from any anscestor
of the node in question.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 16:02:01 -05:00
Anna Schumaker d020f4163b curds: Remove the node-inserted notification
Nobody is listening for this anymore, so it can be safely removed.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 14:44:44 -05:00
Anna Schumaker 440f0901f4 rind: Have the node view look for the child-inserted notification
The child-inserted notification is more specific than node-inserted, and
carries the child's path with it as an argument. This saves some work on
the UI side, and avoids potential deadlocks.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 14:38:21 -05:00
Anna Schumaker a8cd9a84f3 rind: Node model cleanups
- Listen for the "first-child" notification rather than "node-inserted"
- Use the walrus operator in more places to tidy up the code
- Use the playlist_iter() function to get iterators directly

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 14:32:16 -05:00
Anna Schumaker 0f03891225 curds: Give nodes a first-child notification
The UI has been guessing this during scanning, but we can easily figure
this out and tell them when a tree node is given their first child.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 14:29:07 -05:00
Anna Schumaker 735f2bba6e curds: Rename notification "main" parameter to "idle"
And always run tasks marked for the idle queue in the idle queue, even
if we're in the main thread.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 12:06:37 -05:00
Anna Schumaker 3a939f92e1 curds: Replace str(node) with node.get_markup()
This lets us save str(node) to be used for something else, and it gives
playlists a chance to escape their names before returning to the UI

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 10:57:54 -05:00
Anna Schumaker 0e018473f7 curds: Have the PlaylistNode use the ETree.__insert__() function
And remove some duplicated code

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 10:30:19 -05:00
Anna Schumaker f200d4171a curds: ETree cleanups
- Use the walrus operator (:=) in __insert__
- Simplify child_index()
- Don't use any passed in arguments to sort_key()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 10:07:57 -05:00
Anna Schumaker 3fa56facde curds: Remove unnecessary calls to append_child()
I really want to remove this function, so let's start by swapping out
calls to append_child() with insert_child()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-12 09:04:20 -05:00
Anna Schumaker f72c3596e7 curds: Add path detection to sort.key()
This lets us remove some special casing in the library playlist, and
simplify node inserting.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-11 11:59:35 -05:00