diff --git a/lib/Command/Scan.php b/lib/Command/Scan.php index 5e6972086..5d50a60b6 100644 --- a/lib/Command/Scan.php +++ b/lib/Command/Scan.php @@ -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(); } @@ -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) { @@ -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));