Commit Graph

74 Commits

Author SHA1 Message Date
Anna Schumaker 7b6b4051ee lib: Add locking around TagStore add() and remove()
But make sure we don't call the publishers while holding the lock to
avoid deadlocks.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:29 -04:00
Anna Schumaker d03a0ff422 lib: Give TagStores Added and Removed publishers
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:28 -04:00
Anna Schumaker 9196908ccc lib: Allow passing None for the TagStore add and remove track
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:27 -04:00
Anna Schumaker 37282505a7 lib: Create a TagStore with add and remove functions
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:26 -04:00
Anna Schumaker c7ce2b9871 lib: Give Tags TrackAdded and TrackRemoved publishers
So we can respond quickly when individual tags are changed

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:25 -04:00
Anna Schumaker e0c8f6dac6 lib: Return trackids in Tag.__getstate__()
And provide a function for replacing the trackid with an actual track
during startup.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:24 -04:00
Anna Schumaker 51fff44746 lib: Give Tags support for the str() function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:23 -04:00
Anna Schumaker a6a35f37e7 lib: Add locking to the Tag class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:21 -04:00
Anna Schumaker 5cdf01ddea lib: Give Tags functions for saving and restoring state
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:20 -04:00
Anna Schumaker c342d906e3 lib: Create a Tag class
This will help to avoid some code duplication across multiple tags

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:19 -04:00
Anna Schumaker cd424af848 lib: Implement a bus
My intention is to use this instead of the idle queue so things get
processed on a regular interval instead of waiting for the user to be
idle. It also supports a "running()" function so we know if busses still
have work to do.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:18 -04:00
Anna Schumaker 493c4e5c33 lib: Give settigs a initialize() function
For setting a value only if it doesn't already exist

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-07-17 12:33:14 -04:00
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 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 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 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 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