Commit Graph

462 Commits

Author SHA1 Message Date
Anna Schumaker cac252cc17 curds: Implement a track.decade() function
We could figure this out in the decade playlist code, but it's easier to
just do it inside the track itself.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-10 08:58:27 -05:00
Anna Schumaker 409ce6706c curds: Remove track.hash() function
It is no longer used with the new track DB system.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-09 14:39:54 -05:00
Anna Schumaker 1fc448996e curds: Switch over to the new track database system
It is way faster during scanning due to the db key changes, which I
wasn't expecting at the time.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-09 14:34:16 -05:00
Anna Schumaker 0db7058836 curds: Implement new track database code
Largely inspired by the code in trak.map.py, but moved up to the
__init__.py file so callers don't need to go down another level.
Additionally, I change hashing to work with the track path rather than
tags which should simplify lookups a lot. A side effect of this is that
if playlists save each track's path in their pickle state, then we
should be able to recover from crashes by looking up the filepath during
the next load.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-09 14:31:38 -05:00
Anna Schumaker 5f079d6a58 curds: Rename curds/tags/ -> curds/trak/
The "tags" name doesn't really fit anymore now that we removed the Album
class. Let's change the name to something more accurate.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-09 10:05:00 -05:00
Anna Schumaker 824e68dc94 curds: Remove unused Album class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-05 10:19:07 -05:00
Anna Schumaker acb1f43fa4 curds: Move remaining Album fields into Track
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-05 10:12:43 -05:00
Anna Schumaker 67b9422c31 curds: Replace TagFile.chain() with TagFile.album_artist()
This was the only use of the chain() function, so let's just make a more
direct way of getting the information we want.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-05 09:15:33 -05:00
Anna Schumaker 71d9974608 curds: Move genre and tracktotal into the Track class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-05 09:06:24 -05:00
Anna Schumaker 6db713a993 curds: Improvements to the notifications system
- Clean up the code
- Kick off a GLib idle handler when events are added
- If we are already running in the main thread, then we don't need to
  use the idle handler.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-12-04 10:42:31 -05:00
Anna Schumaker 7433154494 curds: Replace the next_child pointer with sibling
next_child becomes a thread-safe function that can be called to access
the next child.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-21 16:02:59 -04:00
Anna Schumaker 42f1c76f8f curds: Remove has_sibling() function
We can just use the parent's n_children() function to determine this
instead

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-21 13:08:54 -04:00
Anna Schumaker ae6627b2e5 curds: Remove find_node() from the PlaylistNode
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-16 10:07:52 -04:00
Anna Schumaker 584a8177fd curds: Replace alloc_node() with alloc_child()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-16 10:00:09 -04:00
Anna Schumaker 92e34ab107 curds: Remove the prev_child pointer
Nothing actually uses this, so it can be removed

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-14 14:23:08 -04:00
Anna Schumaker 0b0800ac56 curds: Use the lookup_path() function instead of get_node()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-14 14:23:08 -04:00
Anna Schumaker b319cdc3d7 curds: Switch over to the ETree() child walking function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-14 14:23:08 -04:00
Anna Schumaker a259202f4d curds: Have the PlaylistNode inherit from the ETree()
This is the first step in replacing the PlaylistNode. I can remove
common elements now, and future patches can continue the transition
between the two.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-14 14:23:08 -04:00
Anna Schumaker 8c9a71b2a7 curds: Implement a new tree structure
I keep it generic for now. Playlists can implement their own version
inherited from this.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-14 14:23:08 -04:00
Anna Schumaker 1b603ad567 curds: Move the track tag into a new file
And out of the __init__.py stuff

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-09 13:57:28 -04:00
Anna Schumaker f9c2540f49 curds: Move the album tag into its own file
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-08 11:15:22 -04:00
Anna Schumaker ac75bb3be1 curds: Move tag data file code into the map.py file
And give it some better locking so only one thread can access the map at
a time.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-08 09:46:36 -04:00
Anna Schumaker 0f90f27662 curds: Move the tag map into a new file
I leave the save and load code where it is for now, but I can split out
the rest of the code and add proper locking around the dictionary.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-07 17:03:44 -04:00
Anna Schumaker ff6c0d26a7 curds: Add discnumber detection to TagFiles
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-07 16:37:10 -04:00
Anna Schumaker 740c176de3 curds: Create a TagFile to hold the mutagen data
This gives us a wrapper to handle some tag extraction functions, rather
than implementing them in a Tag base class.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-07 16:37:06 -04:00
Anna Schumaker 9934b88b77 curds: Create a subdirectory for tags code
I'm going to be splitting this up into multiple files, and step one is
to create the directory.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-08-07 10:13:33 -04:00
Anna Schumaker bc01e95d0b curds: Convert track items to strings in __getitem__()
Rather than doing this in multiple places outside of the track class.
Callers who want the original values can still dereference the value
directly

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-08 11:03:37 -04:00
Anna Schumaker eb40293b04 rind: Filter tracks when typing in the entry
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-07 21:16:41 -04:00
Anna Schumaker dc561a2d30 rind: Create a filter model for playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-07 20:41:59 -04:00
Anna Schumaker 67cde118c5 rind: Track the next position where tracks are added to the model
We just append to the model rather than using the index information
passed to us.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-07 13:30:28 -04:00
Anna Schumaker 7630a1723d rind: Give playlist models a do_iter_children() function
Even though this is a ListModel the TreeModelFilter still tries to call
this function, so we need to define it to cut down on warnings printed
to the screen.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-07 13:15:34 -04:00
Anna Schumaker 57d77a5abd rind: Parse text entered in the track search entry
And set up a regex pattern that we can use to match tracks later.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-07 13:15:34 -04:00
Anna Schumaker 37d621e48d rind: Add extra newlines to the playlist view
The node view file has these extra newlines already, and I think it
makes everything easier to follow.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-07 13:15:34 -04:00
Anna Schumaker dfc8c049be curds: Implement a playlist for newly added tracks
This playlist is only to showe new tracks added during the current
session, so we need to clear the list when getting the playlist state
dictionary.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-07 13:15:34 -04:00
Anna Schumaker f8fc38ea4a curds: Don't save tracks on the Previous playlist
We only want to keep track of what has been played this session, so
clear out the list when we save

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-06 10:30:09 -04:00
Anna Schumaker c5bc5f3528 curds: Load saved playlists during startup
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-01 13:37:53 -04:00
Anna Schumaker dd39255323 curds: Remove an existing tags file before testing
That way we don't risk having any stale data

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-01 13:31:07 -04:00
Anna Schumaker 16bd2b462e curds: Give user nodes a __setstate__() function
This is needed to restore the starred playlist pointer

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-01 11:05:53 -04:00
Anna Schumaker 95f653e1d3 rind: Don't store a global pointer to the playlist root
The root could change during testing, so don't store this pointer

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-01 10:40:53 -04:00
Anna Schumaker 7e9fb54c9e curds: Save playlists as they are changed
I create a new notification for this so it can be queued without having
too many instances saving the same thing.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-07-01 08:39:54 -04:00
Anna Schumaker d572f8348b curds: Give the PlaylistRoot custom __getstate__() and __setstate__() functions
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-30 21:20:42 -04:00
Anna Schumaker 7d7d2fd113 curds: Add locking to the playlist root class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-30 20:15:40 -04:00
Anna Schumaker fd3e3c53dc curds: Add locking to the playlist class functions
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-30 20:15:40 -04:00
Anna Schumaker 1c40811130 curds: Add locking to playlist nodes
I use a reenterant lock so the same thread can use protected functions
in the class without a lot of code rewriting.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-30 20:15:40 -04:00
Anna Schumaker b08fbf41f8 curds: Rework playlist initialization
So that we can share some code when we go to reload playlists

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-30 20:15:40 -04:00
Anna Schumaker ac1402b862 curds: Give playlist nodes an __init_common__() function
This is called for playlist initialization, resets, and unpicklings, so
it's a good place to put any common code that needs to happen during all
of these steps.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-30 20:15:40 -04:00
Anna Schumaker 887fa4692f curds: Give playlists a custom __gestate__() and __setstate__()
We mostly need this to save tracks as hashes to prevent duplication of
track objects.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-30 20:15:40 -04:00
Anna Schumaker 9e36a83115 curds: Add a way to look up tags by hashes
We'll need this when we unpickle playlists

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-26 16:39:05 -04:00
Anna Schumaker df9ebc32eb curds: Give playlist nodes a custom __getstate__() and __setstate__()
This will be used by pickle to save and restore playlists

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-26 16:39:01 -04:00
Anna Schumaker 80826806cb curds: Save tag_map as tracks are scanned
We don't do the reload yet. Simply make sure it's written to disk first.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-06-21 10:40:25 -04:00