scanner: Create a commit() shortcut function

For scheduling a commit task

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-11-05 14:03:58 -04:00
parent 3afaea664b
commit b8da049be9
2 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,9 @@ def RemoveButton(library):
return widgets.RemoveButton(library, Queue)
def commit():
Queue.push(task.CommitTask())
def import_track(lib, track, playcount, lastplayed):
Queue.push(task.ImportTask(lib, track, playcount, lastplayed))

View File

@ -32,6 +32,10 @@ class TestScanner(unittest.TestCase):
self.assertIsInstance(scanner.Queue.tasks[0],
scanner.task.RemoveLibrarySchedulerTask)
def test_scanner_commit(self):
scanner.commit()
self.assertIsInstance(scanner.Queue.tasks[0], scanner.task.CommitTask)
def test_scanner_widgets(self):
lib = db.library.Table.find(test_album)