From be3208aeed0619bc06db647f20f63ec02703ec3e Mon Sep 17 00:00:00 2001 From: Steffen Clemens Date: Sat, 13 May 2023 00:04:25 +0200 Subject: [PATCH 1/3] Shallow scanning of specific paths Signed-off-by: Steffen Clemens --- lib/Command/Scan.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/Command/Scan.php b/lib/Command/Scan.php index 8f5cda35f..0390e8ad6 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', + 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(); } @@ -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)); From d6bf0f752004bb2a9a08fb7b89026ebf38cb1800 Mon Sep 17 00:00:00 2001 From: Steffen Clemens Date: Sun, 19 May 2024 14:33:26 +0200 Subject: [PATCH 2/3] Fix option type Signed-off-by: Steffen Clemens --- lib/Command/Scan.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Command/Scan.php b/lib/Command/Scan.php index 0390e8ad6..0b54493af 100644 --- a/lib/Command/Scan.php +++ b/lib/Command/Scan.php @@ -35,7 +35,7 @@ protected function configure() { ->addOption( 'path', 'p', - InputArgument::OPTIONAL, + InputOption::VALUE_REQUIRED, 'limit rescan to this path, eg. --path="/shared/media/Music"' )->addOption( 'shallow', From 0424c8dd7dd06f419b6d0226c401dba99e50794b Mon Sep 17 00:00:00 2001 From: Steffen Clemens Date: Mon, 20 May 2024 13:08:42 +0200 Subject: [PATCH 3/3] Adjust descriptions Signed-off-by: Steffen Clemens --- lib/Command/Scan.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Command/Scan.php b/lib/Command/Scan.php index 0b54493af..f554c8134 100644 --- a/lib/Command/Scan.php +++ b/lib/Command/Scan.php @@ -36,12 +36,12 @@ protected function configure() { 'path', 'p', InputOption::VALUE_REQUIRED, - 'limit rescan to this path, eg. --path="/shared/media/Music"' + 'Limit rescan to this path, eg. --path="/shared/media/Music".' )->addOption( 'shallow', null, InputOption::VALUE_NONE, - 'do not scan folders recursively' + 'Do not scan folders recursively.' ); parent::configure(); }