aboutsummaryrefslogtreecommitdiff
path: root/lib/App/MediaControl.rakumod
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/MediaControl.rakumod')
-rw-r--r--lib/App/MediaControl.rakumod17
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/App/MediaControl.rakumod b/lib/App/MediaControl.rakumod
index 12ed948..641754a 100644
--- a/lib/App/MediaControl.rakumod
+++ b/lib/App/MediaControl.rakumod
@@ -41,15 +41,10 @@ class App::MediaControl {
method !start-scan() {
my $root = $.config<media><root>;
$!db.clear-seen();
- my Supplier $to-add .= new;
start react {
whenever scan-dir($root) -> $item {
when $item ~~ $root {}
- when $item ~~ ScanDir::End {
- $!db.remove-unseen();
- $to-add.done();
- $to-add = Nil;
- }
+ when $item ~~ ScanDir::End { $!db.remove-unseen() }
my $path = $item.parent.relative($root);
$path = '' if $path eq '.';
@@ -60,17 +55,9 @@ class App::MediaControl {
}
else {
my $is-dir = $item.d;
- with $to-add {
- .emit(%(:$path,:$name,:$is-dir));
- }
- else {
- $!db.add-entries([%(:$path,:$name,:$is-dir)]);
- }
+ $!db.add-entry(:$path,:$name,:$is-dir);
}
}
- whenever $to-add.Supply.batch(:100elems,:2seconds) -> $items {
- $!db.add-entries($items);
- }
}
}