Skip to content

Commit

Permalink
Shallow scanning of specific paths
Browse files Browse the repository at this point in the history
Signed-off-by: Steffen Clemens <info@steffenclemens.de>
  • Loading branch information
steffenclemens committed May 12, 2023
1 parent f81e3f6 commit 7af6b96
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion lib/Command/Scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ protected function configure() {
null,
InputOption::VALUE_NONE,
'Scan all the group folders.'
)
->addOption(
'path',
'p',
InputArgument::OPTIONAL,
'limit rescan to this path, eg. --path="/shared/media/Music"'
)->addOption(
'shallow',
null,
InputOption::VALUE_NONE,
'do not scan folders recursively'
);
parent::configure();
}
Expand Down Expand Up @@ -74,6 +85,14 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$folders = [$folder['id'] => $folder];
}

$inputPath = $input->getOption('path');
if ($inputPath) {
$inputPath = '/' . trim($inputPath, '/');
} else {
$inputPath = '';
}
$recursive = !$input->getOption('shallow');

$duration = 0;
$stats = [];
foreach ($folders as $folder) {
Expand Down Expand Up @@ -110,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$start = microtime(true);

$scanner->setUseTransactions(false);
$scanner->scan('');
$scanner->scan($inputPath, $recursive);

$end = microtime(true);
$statsRow[3] = date('H:i:s', (int)($end - $start));
Expand Down

0 comments on commit 7af6b96

Please sign in to comment.