From 74ad1bf86dc7b788a7df25dba514501511a4b34c Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 17 Mar 2024 21:52:47 +0000 Subject: [PATCH] [s3] sync by query (which might be an ID range) rather than by ID range --- ext/s3/main.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ext/s3/main.php b/ext/s3/main.php index 6668a61b..72a237c4 100644 --- a/ext/s3/main.php +++ b/ext/s3/main.php @@ -99,14 +99,11 @@ class S3 extends Extension return Command::SUCCESS; }); $event->app->register('s3:sync') - ->addArgument('start', InputArgument::REQUIRED) - ->addArgument('end', InputArgument::REQUIRED) - ->setDescription('Sync a range of images to S3') + ->addArgument('query', InputArgument::REQUIRED) + ->setDescription('Search for some images, and sync them to s3') ->setCode(function (InputInterface $input, OutputInterface $output): int { - $start = (int)$input->getArgument('start'); - $end = (int)$input->getArgument('end'); - $output->writeln("Syncing range: $start - $end"); - foreach(Search::find_images_iterable(tags: ["order=id", "id>=$start", "id<=$end"]) as $image) { + $query = Tag::explode($input->getArgument('query')); + foreach(Search::find_images_iterable(tags: $query) as $image) { if($this->sync_post($image)) { print("{$image->id}: {$image->hash}\n"); } else {