diff --git a/lib/Command/Scan.php b/lib/Command/Scan.php index 8f5cda35f..f554c8134 100644 --- a/lib/Command/Scan.php +++ b/lib/Command/Scan.php @@ -31,6 +31,17 @@ protected function configure() { null, InputOption::VALUE_NONE, 'Scan all the group folders.' + ) + ->addOption( + 'path', + 'p', + InputOption::VALUE_REQUIRED, + 'Limit rescan to this path, eg. --path="/shared/media/Music".' + )->addOption( + 'shallow', + null, + InputOption::VALUE_NONE, + 'Do not scan folders recursively.' ); parent::configure(); } @@ -59,6 +70,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) { @@ -95,7 +114,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));