From 8e3ae0269e779650a9f07f7bc26e6b97a614518f Mon Sep 17 00:00:00 2001 From: Arne Hamann <git@arne.email> Date: Tue, 31 Dec 2024 12:36:55 +0100 Subject: [PATCH 1/3] RichObjectParameter should be strings fixes #1359 Signed-off-by: Arne Hamann <git@arne.email> --- src/components/Map.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Map.vue b/src/components/Map.vue index 7d840a787..4412edb67 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -510,8 +510,8 @@ export default { action.callback({ id: 'geo:' + e.latlng.lat + ',' + e.latlng.lng, name: t('maps', 'Shared location'), - latitude: e.latlng.lat, - longitude: e.latlng.lng, + latitude: e.latlng.lat.toString(), + longitude: e.latlng.lng.toString(), }) }, }) From d0a51523199f2da4d14afadffeb9d43d351e1142 Mon Sep 17 00:00:00 2001 From: Arne Hamann <git@arne.email> Date: Tue, 31 Dec 2024 12:50:00 +0100 Subject: [PATCH 2/3] cs:fix Signed-off-by: Arne Hamann <git@arne.email> --- lib/Command/RescanPhotos.php | 172 +++++++++++++++--------------- lib/Service/PhotofilesService.php | 2 +- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/lib/Command/RescanPhotos.php b/lib/Command/RescanPhotos.php index e7d70f842..61629a09d 100644 --- a/lib/Command/RescanPhotos.php +++ b/lib/Command/RescanPhotos.php @@ -26,94 +26,94 @@ class RescanPhotos extends Command { - protected IUserManager $userManager; - protected OutputInterface $output; - protected IManager $encryptionManager; - protected PhotofilesService $photofilesService; - protected IConfig $config; + protected IUserManager $userManager; + protected OutputInterface $output; + protected IManager $encryptionManager; + protected PhotofilesService $photofilesService; + protected IConfig $config; - public function __construct( - IUserManager $userManager, - IManager $encryptionManager, - PhotofilesService $photofilesService, - IConfig $config) { - parent::__construct(); - $this->userManager = $userManager; - $this->encryptionManager = $encryptionManager; - $this->photofilesService = $photofilesService; - $this->config = $config; - } + public function __construct( + IUserManager $userManager, + IManager $encryptionManager, + PhotofilesService $photofilesService, + IConfig $config) { + parent::__construct(); + $this->userManager = $userManager; + $this->encryptionManager = $encryptionManager; + $this->photofilesService = $photofilesService; + $this->config = $config; + } - /** - * @return void - */ - protected function configure() { - $this->setName('maps:scan-photos') - ->setDescription('Rescan photos GPS exif data') - ->addArgument( - 'user_id', - InputArgument::OPTIONAL, - 'Rescan photos GPS exif data for the given user' - ) - ->addArgument( - 'path', - InputArgument::OPTIONAL, - 'Scan photos GPS exif data for the given path under user\'s files without wiping the database.' - ) - ->addOption( - 'now', - null, - InputOption::VALUE_NONE, - 'Dot the rescan now and not as background jobs. Doing it now might run out of memory.' - ); - } + /** + * @return void + */ + protected function configure() { + $this->setName('maps:scan-photos') + ->setDescription('Rescan photos GPS exif data') + ->addArgument( + 'user_id', + InputArgument::OPTIONAL, + 'Rescan photos GPS exif data for the given user' + ) + ->addArgument( + 'path', + InputArgument::OPTIONAL, + 'Scan photos GPS exif data for the given path under user\'s files without wiping the database.' + ) + ->addOption( + 'now', + null, + InputOption::VALUE_NONE, + 'Dot the rescan now and not as background jobs. Doing it now might run out of memory.' + ); + } - /** - * @param InputInterface $input - * @param OutputInterface $output - * @return int - */ - protected function execute(InputInterface $input, OutputInterface $output): int { - if ($this->encryptionManager->isEnabled()) { - $output->writeln('Encryption is enabled. Aborted.'); - return 1; - } - $this->output = $output; - $userId = $input->getArgument('user_id'); - $pathToScan = $input->getArgument('path'); - $inBackground = !($input->getOption('now') ?? true); - if ($inBackground) { - echo "Extracting coordinates from photo is performed in a BackgroundJob \n"; - } - if ($userId === null) { - $this->userManager->callForSeenUsers(function (IUser $user, string $pathToScan) use ($inBackground) { - $this->rescanUserPhotos($user->getUID(), $inBackground, $pathToScan); - }); - } else { - $user = $this->userManager->get($userId); - if ($user !== null) { - $this->rescanUserPhotos($userId, $inBackground, $pathToScan); - } - } - return 0; - } + /** + * @param InputInterface $input + * @param OutputInterface $output + * @return int + */ + protected function execute(InputInterface $input, OutputInterface $output): int { + if ($this->encryptionManager->isEnabled()) { + $output->writeln('Encryption is enabled. Aborted.'); + return 1; + } + $this->output = $output; + $userId = $input->getArgument('user_id'); + $pathToScan = $input->getArgument('path'); + $inBackground = !($input->getOption('now') ?? true); + if ($inBackground) { + echo "Extracting coordinates from photo is performed in a BackgroundJob \n"; + } + if ($userId === null) { + $this->userManager->callForSeenUsers(function (IUser $user, string $pathToScan) use ($inBackground) { + $this->rescanUserPhotos($user->getUID(), $inBackground, $pathToScan); + }); + } else { + $user = $this->userManager->get($userId); + if ($user !== null) { + $this->rescanUserPhotos($userId, $inBackground, $pathToScan); + } + } + return 0; + } - /** - * @param string $userId - * @param bool $inBackground - * @param string $pathToScan - * @return void - * @throws \OCP\PreConditionNotMetException - */ - private function rescanUserPhotos(string $userId, bool $inBackground = true, string $pathToScan = null) { - echo '======== User ' . $userId . ' ========' . "\n"; - $c = 1; - foreach ($this->photofilesService->rescan($userId, $inBackground, $pathToScan) as $path) { - echo '[' . $c . '] Photo "' . $path . '" added' . "\n"; - $c++; - } - if ($pathToScan === null) { - $this->config->setUserValue($userId, 'maps', 'installScanDone', 'yes'); - } - } + /** + * @param string $userId + * @param bool $inBackground + * @param string $pathToScan + * @return void + * @throws \OCP\PreConditionNotMetException + */ + private function rescanUserPhotos(string $userId, bool $inBackground = true, ?string $pathToScan = null) { + echo '======== User ' . $userId . ' ========' . "\n"; + $c = 1; + foreach ($this->photofilesService->rescan($userId, $inBackground, $pathToScan) as $path) { + echo '[' . $c . '] Photo "' . $path . '" added' . "\n"; + $c++; + } + if ($pathToScan === null) { + $this->config->setUserValue($userId, 'maps', 'installScanDone', 'yes'); + } + } } diff --git a/lib/Service/PhotofilesService.php b/lib/Service/PhotofilesService.php index c87a2ee0d..4fd2bbb42 100644 --- a/lib/Service/PhotofilesService.php +++ b/lib/Service/PhotofilesService.php @@ -410,7 +410,7 @@ private function gatherPhotoFiles($folder, $recursive) { } try { $notes = array_merge($notes, $this->gatherPhotoFiles($node, $recursive)); - } catch (\OCP\Files\StorageNotAvailableException | \Exception $e) { + } catch (\OCP\Files\StorageNotAvailableException|\Exception $e) { $msg = 'WARNING: Could not access ' . $node->getName(); echo($msg . "\n"); $this->logger->error($msg); From a4535a04fc5c64ec5c93569c54e2fc97db06bcfe Mon Sep 17 00:00:00 2001 From: Arne Hamann <git@arne.email> Date: Tue, 31 Dec 2024 12:54:13 +0100 Subject: [PATCH 3/3] Bumped version to 1.6.0 Signed-off-by: Arne Hamann <git@arne.email> --- CHANGELOG.md | 4 ++++ appinfo/info.xml | 2 +- package.json | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de37803dc..c3d88dbc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.6.0 - 2024.12.31 Scan photos of specific directory +- Scan photos of specific directory [#1231](https://github.com/nextcloud/maps/pull/1231) @tetebueno + + ## 1.5.0 - 2024.11.16 Nextcloud Hub 9 - Update OSM tile service URL [#1295](https://github.com/nextcloud/maps/pull/1295) @StyXman - Support Nextcloud 30, update CSP header [1336](https://github.com/nextcloud/maps/pull/1336) @Ma27 diff --git a/appinfo/info.xml b/appinfo/info.xml index 4d5f68e85..884959ffe 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -14,7 +14,7 @@ - **📱 Devices:** Lost your phone? Check the map! - **〰 Tracks:** Load GPS tracks or past trips. Recording with [PhoneTrack](https://f-droid.org/en/packages/net.eneiluj.nextcloud.phonetrack/) or [OwnTracks](https://owntracks.org) is planned. ]]></description> - <version>1.5.0</version> + <version>1.6.0</version> <licence>agpl</licence> <author mail="eneiluj@posteo.net">Julien Veyssier</author> <author mail="kontakt+github@arne.email">Arne Hamann</author> diff --git a/package.json b/package.json index 7b771b0e5..a0f6d0982 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "maps", - "version": "1.5.0", + "version": "1.6.0", "description": "Maps app", "main": "main.js", "directories": {