-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scan photos of specific directory #1231
base: master
Are you sure you want to change the base?
Conversation
Thanks for your contribution. Can you pass the path as optional argument? |
Signed-off-by: tete <tete@Data.lan>
Signed-off-by: tete <tete@Data.lan>
Signed-off-by: tete <tete@Data.lan>
You are very welcome. Done with DCO, thanks. Is there anything else besides this so the path parameter is optional? I believe it already is since help command displays it like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tetebueno,
sorry for the late reply and beeing a little unprecise.
I mean in stead of adding the functions
RescanPhotos->scanUserPhotos
and
PhotofilesService->rescanPath
Just provide an optional parameter to
private function rescanUserPhotos(string $userId, bool $inBackground=true, sting? $pathToScan===null) {
and PhotofilesService
public function rescan($userId, $inBackground=true, $pathToScan=null) {
and then make an if in the Photofilesservice->rescan
$userFolder = $this->root->getUserFolder($userId)
if ($pathToScan === null) {
$folder = $userFolder
} else {
$folder = $userFolder->get($pathToScan);
}
$photos = $this->gatherPhotoFiles($folder, true);
Don't blindly copy my code. It is just typed in here to outline my thought and not tested.
$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) use ($inBackground) { | ||
$this->rescanUserPhotos($user->getUID(), $inBackground); | ||
if ($pathToScan === null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($pathToScan === null) { | |
$this->rescanUserPhotos($user->getUID(), $inBackground, pathToScan); |
if ($pathToScan === null) { | ||
$this->rescanUserPhotos($userId, $inBackground); | ||
} else { | ||
$this->scanUserPhotos($userId, $pathToScan, $inBackground); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($pathToScan === null) { | |
$this->rescanUserPhotos($userId, $inBackground); | |
} else { | |
$this->scanUserPhotos($userId, $pathToScan, $inBackground); | |
} | |
$this->rescanUserPhotos($userId, $inBackground, pathToScan); |
@tetebueno Do you think you will make the changes befor the NC29 release. Then I would wait with #1244 to include this. I'm sorry that it is on such short notice after not reviewing for a month. Just have to decide whether to wait or not. |
I've been getting memory exhaustion when scanning all photos collection on an initial load; trying to address #525 I made these changes and was able to scan each year/month directory of photos succesfully like this (the example is for the folder with photos of july '84):
$ docker exec -t -u www-data container-name php occ maps:scan-photos -vvv username Photos/1984/06
I didn't like the
if
s all over the implementation, but it's something like a make it work approach. If I can get comments about it, we can make it better.Cheers.