trackdb: Register the save functions after loading

We replace each object after unpickling, so we need to make sure we
listen to the new ones when they tell us they've changed.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-07-07 09:17:25 -04:00
parent 72a4c4fa95
commit 0e0ab0c3be
2 changed files with 5 additions and 0 deletions

View File

@ -130,6 +130,10 @@ class TestTrackDB(unittest.TestCase):
self.assertEqual(len(trackdb.tags.Decade), 2)
self.assertEqual(len(trackdb.tags.Year), 2)
self.assertIn(trackdb.save, trackdb.Library.Added.subscribers)
self.assertIn(trackdb.save, trackdb.Tracks.Added.subscribers)
self.assertIn(trackdb.save, trackdb.tags.User.Added.subscribers)
def test_trackdb_stress(self):
lib = trackdb.Library.add(pathlib.Path("./trier/Test Library/"))
lib.scan().join()

View File

@ -81,6 +81,7 @@ def load():
tags.set_state(*tagstate)
Tracks.load_tags()
Library.fix_tracks()
__register_callbacks()
def __register_callbacks():
for store in [ Library, tags.User, Tracks ]: