Commit Graph

711 Commits

Author SHA1 Message Date
Anna Schumaker 76338da8fe lib: Implement save and load functions for settings
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:32:41 -04:00
Anna Schumaker e119a6cf19 lib: Add locking to the settings context manager
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:29:47 -04:00
Anna Schumaker 47c688324c lib: Give settings a reset function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:29:44 -04:00
Anna Schumaker 126f03937b lib: Add get_int(), get_float(), and get_bool() functions to settings
The default returns as a string, so this lets callers avoid casting.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:28:40 -04:00
Anna Schumaker 96971317b5 lib: Begin a settings file
Right now I just have functions for set and get wrapped in a context
manager for splitting the setting string into section and key values.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-01 16:46:07 -04:00
Anna Schumaker e2bb85b854 lib: Enable reading and writing text DataFiles
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-01 16:46:07 -04:00
Anna Schumaker 7b901b8380 lib: Don't suppress errors from inside the DataFile context manager
And fix up the trackdb to check if the file exists before attempting to
unpickle.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-01 16:46:07 -04:00
Anna Schumaker 2083d00c23 Makefile: Disable testing curds/ and rind/ directories
I want to be able to test the new gtk4 code, but I can't do that with
the legacy code still enabled since gtk3 and gtk4 can't both be loaded
at the same time. The solution is to create a new "tests" target for
testing the new stuff.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-01 16:43:46 -04:00
Anna Schumaker 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
Anna Schumaker 2001639d93 curds: Remove unneeded curds/trak structures
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-15 18:05:47 -05:00
Anna Schumaker 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
Anna Schumaker 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
Anna Schumaker 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
Anna Schumaker a25a4eb62d rind: Replace some calls to trak.lookup() with trackdb.track.Track()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-14 16:56:28 -05:00
Anna Schumaker 31ba549c51 rind: Have the playbin load the absolute path of the uri
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-01 16:46:17 -05:00
Anna Schumaker 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
Anna Schumaker 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
Anna Schumaker 6fc3c451f4 curds: Remove unused TagFile class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-11-01 15:29:55 -05:00
Anna Schumaker 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
Anna Schumaker 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
Anna Schumaker 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
Anna Schumaker 027b89fadd trackdb: Pass library to TrackAdded and TrackRemoved
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-31 11:29:19 -04:00
Anna Schumaker a1d4d9e418 trackdb: Load saved files
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-26 17:39:15 -04:00
Anna Schumaker a63dc5586b trackdb: Implement saving through an idle task
And register with the various subscribers that modify anything in the
trackdb.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-26 17:39:13 -04:00
Anna Schumaker ebb39d0600 trackdb: Library scanning fixups
- Fixup locking order
- Release library locks after each track so saving can progress
- Pass the track to the TrackAdded observer instead of the filepath

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-26 17:32:43 -04:00
Anna Schumaker a1fcf032b5 lib: Create a library for idle callbacks
I use a fake idle queue for testing, but fall back on the main GLib idle
code for production. I made the fake idle queue threadsafe just to be
cautious.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-26 17:25:21 -04:00
Anna Schumaker 98d4709954 trackdb: Create an observer for when tracks are updated
And publish a notification after marking tracks as played.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-20 11:10:04 -04:00
Anna Schumaker a29bcabc6c trackdb: Give library paths a getstate and setstate functions
Pickle doesn't like pickling threads or locks, so we need to clear these
out of the state dictionary and then reinitialize them when loading.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-19 15:52:55 -04:00
Anna Schumaker cc2b74eaa3 lib: Convert DataFiles to using pathlib Paths
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-18 17:16:11 -04:00
Anna Schumaker 08a37fef87 lib: Copy over existing DataFile class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-18 16:25:49 -04:00
Anna Schumaker 7707f896b7 trackdb: Store Track objects in LibraryPaths
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-18 15:12:27 -04:00
Anna Schumaker c98cec1b28 trackdb: Calculate a track's decade
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-18 13:38:27 -04:00
Anna Schumaker 89b40ab905 tools: Add a script for finding what files are missing a tag
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-18 13:27:31 -04:00
Anna Schumaker 0fc49912ed trackdb: Add support for genre lists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-18 13:27:00 -04:00
Anna Schumaker 31d89d4729 trackdb: Pull out the tags we need from audio files
I have some fallbacks in place in case a tag is missing, and we can
always add more tags later if something interests us.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-18 12:53:57 -04:00
Anna Schumaker 4e4cac25e0 trackdb: Use mutagen to read track tags
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-12 17:02:13 -04:00
Anna Schumaker 7afa16b57d trackdb: Add Track class
I don't read tags yet, but I set up some other variables that will be
useful later.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-12 16:22:27 -04:00
Anna Schumaker c46f73cbc6 trackdb: Add lookup methods for track ids
Playlists will want to use this when reading saved state to figure out
what tracks they hold.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-11 10:03:16 -04:00
Anna Schumaker 977c89068e trackdb: Store tracks in a dictionary instead of a list
And assign unique ID values to each for future use by playlists.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-11 09:50:12 -04:00
Anna Schumaker 3f8ef5812e trackdb: Implement a library reset function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-10 20:23:28 -04:00
Anna Schumaker b3510f059a trackdb: Add library added and library removed notifications
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-10 20:07:53 -04:00
Anna Schumaker 66128e2144 trackdb: Send track added and track removed notifications
Note that these happen in the scanning thread, so callers may need to do
some work to put them in the main thread if needed.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-10 18:13:08 -04:00
Anna Schumaker eea6e0999a trackdb: Spin up a thread to scan library paths
This can be pretty slow, so we don't want to do it in the main thread.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-07 16:19:07 -04:00
Anna Schumaker 4327763af8 trackdb: Expand LibraryPath scan() to update the tracklist
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-07 15:52:56 -04:00
Anna Schumaker 27441b9b79 trackdb: Add a LibraryPath class for tracking multiple audio sources
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-04 15:28:30 -04:00
Anna Schumaker a9f0ff8f8d trackdb: Add scaffolding for handling library paths
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-04 12:58:15 -04:00
Anna Schumaker 54d7ba6556 lib: Add a class for doing the Publisher / Subscriber pattern
This will eventually replace my current notifications system. Hopefully
it'll be a little easier to work with and maintain

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-04 10:30:52 -04:00
Anna Schumaker f7318f0bc7 Tools: Add a script for finding common tags of music files
I want to know the bare minimum of what tags can be relied on in my
music, so this script can help me set default / fallback tags.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-03 09:33:44 -04:00
Anna Schumaker 3eb55713f2 Tools: Add a script for showing the metadata of a file
This seems generally useful for determining what we should save or try
to display in the track database.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2020-10-03 08:47:44 -04:00
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