Commit Graph

292 Commits

Author SHA1 Message Date
6f0d092414 trackdb: Give LibraryPaths an add_track() function
To mimic how curds.trak.lookup() works, only in the library path itself.

We also take this time to delete the curds/trak directory as nothing
there is used anymore.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-15 19:57:59 -05:00
2001639d93 curds: Remove unneeded curds/trak structures
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-15 18:05:47 -05:00
e73416a2e1 curds: Replace new-track notification with TrackAdded publisher
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-15 17:43:07 -05:00
4ce1e33fe4 curds: Pass library to new-track callback and trak.lookup()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-15 17:32:48 -05:00
6e0df49528 curds: Store trackid in playlists instead of filepath
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-15 17:06:17 -05:00
f7b354be05 curds: Remove most code from curds.trak.__init__.py
Strip out all the unused stuff now that we're switching over to the
trackdb

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-01 16:08:51 -05:00
e6dd4113d4 curds: Scan library paths using the TrackDB code
Rather than implementing this as part of the LibraryPlaylist

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-01 15:57:03 -05:00
6fc3c451f4 curds: Remove unused TagFile class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-01 15:29:55 -05:00
e55894752b emmental: Replace curds.trak.Track class with trackdb.track.Track
We switch to our new track class as the first step in switching over to
the new trackdb.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-01 15:28:01 -05:00
fcbfa0af2e curds: Remove Track.sort_key() function
It has been reimplemented in the Playlist class

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-01 09:03:35 -05:00
8a2c817de0 curds: Pass key_func() to sort.bisect()
Rather than relying on giving objects their own sort_key() func. This is
needed to switch over to the new Track class.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-01 08:59:37 -05:00
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
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
7f2864ec07 curds: Move the PreviousPlaylist into special.py
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-17 11:55:06 -05:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
4586577cc5 curds: Remove unused PlaylistNode.get_root() function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-13 09:07:28 -05:00
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
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
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
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
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
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
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
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