Skip to content

Commit 586784d

Browse files
authored
Merge pull request #1362 from nextcloud/v1.6.0
v1.6.0
2 parents a35398d + b590c04 commit 586784d

File tree

6 files changed

+95
-91
lines changed

6 files changed

+95
-91
lines changed

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 1.6.0 - 2024.12.31 Scan photos of specific directory
8+
- Scan photos of specific directory [#1231](https://github.com/nextcloud/maps/pull/1231) @tetebueno
9+
10+
711
## 1.5.0 - 2024.11.16 Nextcloud Hub 9
812
- Update OSM tile service URL [#1295](https://github.com/nextcloud/maps/pull/1295) @StyXman
913
- Support Nextcloud 30, update CSP header [1336](https://github.com/nextcloud/maps/pull/1336) @Ma27

β€Žappinfo/info.xmlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- **πŸ“± Devices:** Lost your phone? Check the map!
1515
- **γ€° 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.
1616
]]></description>
17-
<version>1.5.0</version>
17+
<version>1.6.0</version>
1818
<licence>agpl</licence>
1919
<author mail="[email protected]">Julien Veyssier</author>
2020
<author mail="[email protected]">Arne Hamann</author>

β€Žlib/Command/RescanPhotos.phpβ€Ž

Lines changed: 86 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -26,94 +26,94 @@
2626

2727
class RescanPhotos extends Command {
2828

29-
protected IUserManager $userManager;
30-
protected OutputInterface $output;
31-
protected IManager $encryptionManager;
32-
protected PhotofilesService $photofilesService;
33-
protected IConfig $config;
29+
protected IUserManager $userManager;
30+
protected OutputInterface $output;
31+
protected IManager $encryptionManager;
32+
protected PhotofilesService $photofilesService;
33+
protected IConfig $config;
3434

35-
public function __construct(
36-
IUserManager $userManager,
37-
IManager $encryptionManager,
38-
PhotofilesService $photofilesService,
39-
IConfig $config) {
40-
parent::__construct();
41-
$this->userManager = $userManager;
42-
$this->encryptionManager = $encryptionManager;
43-
$this->photofilesService = $photofilesService;
44-
$this->config = $config;
45-
}
35+
public function __construct(
36+
IUserManager $userManager,
37+
IManager $encryptionManager,
38+
PhotofilesService $photofilesService,
39+
IConfig $config) {
40+
parent::__construct();
41+
$this->userManager = $userManager;
42+
$this->encryptionManager = $encryptionManager;
43+
$this->photofilesService = $photofilesService;
44+
$this->config = $config;
45+
}
4646

47-
/**
48-
* @return void
49-
*/
50-
protected function configure() {
51-
$this->setName('maps:scan-photos')
52-
->setDescription('Rescan photos GPS exif data')
53-
->addArgument(
54-
'user_id',
55-
InputArgument::OPTIONAL,
56-
'Rescan photos GPS exif data for the given user'
57-
)
58-
->addArgument(
59-
'path',
60-
InputArgument::OPTIONAL,
61-
'Scan photos GPS exif data for the given path under user\'s files without wiping the database.'
62-
)
63-
->addOption(
64-
'now',
65-
null,
66-
InputOption::VALUE_NONE,
67-
'Dot the rescan now and not as background jobs. Doing it now might run out of memory.'
68-
);
69-
}
47+
/**
48+
* @return void
49+
*/
50+
protected function configure() {
51+
$this->setName('maps:scan-photos')
52+
->setDescription('Rescan photos GPS exif data')
53+
->addArgument(
54+
'user_id',
55+
InputArgument::OPTIONAL,
56+
'Rescan photos GPS exif data for the given user'
57+
)
58+
->addArgument(
59+
'path',
60+
InputArgument::OPTIONAL,
61+
'Scan photos GPS exif data for the given path under user\'s files without wiping the database.'
62+
)
63+
->addOption(
64+
'now',
65+
null,
66+
InputOption::VALUE_NONE,
67+
'Dot the rescan now and not as background jobs. Doing it now might run out of memory.'
68+
);
69+
}
7070

71-
/**
72-
* @param InputInterface $input
73-
* @param OutputInterface $output
74-
* @return int
75-
*/
76-
protected function execute(InputInterface $input, OutputInterface $output): int {
77-
if ($this->encryptionManager->isEnabled()) {
78-
$output->writeln('Encryption is enabled. Aborted.');
79-
return 1;
80-
}
81-
$this->output = $output;
82-
$userId = $input->getArgument('user_id');
83-
$pathToScan = $input->getArgument('path');
84-
$inBackground = !($input->getOption('now') ?? true);
85-
if ($inBackground) {
86-
echo "Extracting coordinates from photo is performed in a BackgroundJob \n";
87-
}
88-
if ($userId === null) {
89-
$this->userManager->callForSeenUsers(function (IUser $user, string $pathToScan) use ($inBackground) {
90-
$this->rescanUserPhotos($user->getUID(), $inBackground, $pathToScan);
91-
});
92-
} else {
93-
$user = $this->userManager->get($userId);
94-
if ($user !== null) {
95-
$this->rescanUserPhotos($userId, $inBackground, $pathToScan);
96-
}
97-
}
98-
return 0;
99-
}
71+
/**
72+
* @param InputInterface $input
73+
* @param OutputInterface $output
74+
* @return int
75+
*/
76+
protected function execute(InputInterface $input, OutputInterface $output): int {
77+
if ($this->encryptionManager->isEnabled()) {
78+
$output->writeln('Encryption is enabled. Aborted.');
79+
return 1;
80+
}
81+
$this->output = $output;
82+
$userId = $input->getArgument('user_id');
83+
$pathToScan = $input->getArgument('path');
84+
$inBackground = !($input->getOption('now') ?? true);
85+
if ($inBackground) {
86+
echo "Extracting coordinates from photo is performed in a BackgroundJob \n";
87+
}
88+
if ($userId === null) {
89+
$this->userManager->callForSeenUsers(function (IUser $user, string $pathToScan) use ($inBackground) {
90+
$this->rescanUserPhotos($user->getUID(), $inBackground, $pathToScan);
91+
});
92+
} else {
93+
$user = $this->userManager->get($userId);
94+
if ($user !== null) {
95+
$this->rescanUserPhotos($userId, $inBackground, $pathToScan);
96+
}
97+
}
98+
return 0;
99+
}
100100

101-
/**
102-
* @param string $userId
103-
* @param bool $inBackground
104-
* @param string $pathToScan
105-
* @return void
106-
* @throws \OCP\PreConditionNotMetException
107-
*/
108-
private function rescanUserPhotos(string $userId, bool $inBackground = true, string $pathToScan = null) {
109-
echo '======== User ' . $userId . ' ========' . "\n";
110-
$c = 1;
111-
foreach ($this->photofilesService->rescan($userId, $inBackground, $pathToScan) as $path) {
112-
echo '[' . $c . '] Photo "' . $path . '" added' . "\n";
113-
$c++;
114-
}
115-
if ($pathToScan === null) {
116-
$this->config->setUserValue($userId, 'maps', 'installScanDone', 'yes');
117-
}
118-
}
101+
/**
102+
* @param string $userId
103+
* @param bool $inBackground
104+
* @param string $pathToScan
105+
* @return void
106+
* @throws \OCP\PreConditionNotMetException
107+
*/
108+
private function rescanUserPhotos(string $userId, bool $inBackground = true, ?string $pathToScan = null) {
109+
echo '======== User ' . $userId . ' ========' . "\n";
110+
$c = 1;
111+
foreach ($this->photofilesService->rescan($userId, $inBackground, $pathToScan) as $path) {
112+
echo '[' . $c . '] Photo "' . $path . '" added' . "\n";
113+
$c++;
114+
}
115+
if ($pathToScan === null) {
116+
$this->config->setUserValue($userId, 'maps', 'installScanDone', 'yes');
117+
}
118+
}
119119
}

β€Žlib/Service/PhotofilesService.phpβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ private function gatherPhotoFiles($folder, $recursive) {
410410
}
411411
try {
412412
$notes = array_merge($notes, $this->gatherPhotoFiles($node, $recursive));
413-
} catch (\OCP\Files\StorageNotAvailableException | \Exception $e) {
413+
} catch (\OCP\Files\StorageNotAvailableException|\Exception $e) {
414414
$msg = 'WARNING: Could not access ' . $node->getName();
415415
echo($msg . "\n");
416416
$this->logger->error($msg);

β€Žpackage.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "maps",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"description": "Maps app",
55
"main": "main.js",
66
"directories": {

β€Žsrc/components/Map.vueβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ export default {
510510
action.callback({
511511
id: 'geo:' + e.latlng.lat + ',' + e.latlng.lng,
512512
name: t('maps', 'Shared location'),
513-
latitude: e.latlng.lat,
514-
longitude: e.latlng.lng,
513+
latitude: e.latlng.lat.toString(),
514+
longitude: e.latlng.lng.toString(),
515515
})
516516
},
517517
})

0 commit comments

Comments
Β (0)