maps icon indicating copy to clipboard operation
maps copied to clipboard

Images and tracks in group folders are not scanned

Open jurgenhaas opened this issue 6 years ago β€’ 29 comments

As my images still didn't show up after a couple of days I've tried the OCC command to scan images and tracks and they find some images for the users. But most images on our family NC installation are stored in group folders and none of them gets scanned.

Are you planning to offer that too?

jurgenhaas avatar Sep 04 '19 07:09 jurgenhaas

With group folders, do you mean folders other people shared to you? Or created with the https://github.com/nextcloud/groupfolders app?

jancborchardt avatar Sep 04 '19 16:09 jancborchardt

I mean group folders.

jurgenhaas avatar Sep 05 '19 05:09 jurgenhaas

But of course the same problem occurs with shared folders too. I think an additional setting whether to scan shared folders or not is needed - exactly like it is done in the settings of the gpxpod app.

Klakla2 avatar Sep 15 '19 07:09 Klakla2

I propose to change the tiltle of the issue to

Images and tracks in group folders and shared folders are not scanned.

Klakla2 avatar Sep 15 '19 07:09 Klakla2

Photos in folders "explicitly" shared with you should be scanned and file hooks should also handle them (when a photo file is created/edited/deleted in such folders). If that does not work, there is a bug.

If a folder is shared with a user group (implicitly with you), file hooks won't work but manual scan should work as they appear when exploring your storage.

I don't know about adding an option. As we're supposed to avoid scan performance issues with automatic background scanning + file hooks in Maps, I think seeing photo files shared with you should always happen. There is no point in disabling it here, or is there?

julien-nc avatar Sep 15 '19 13:09 julien-nc

Explicitly shared tracks appear, but that's not our use case.

I do not understand your statement on 'manual scan' - can this be triggered in GUI or only via occ command? If the latter is true this is not posible for 99% of the users.

I see no point in disabling the scan of files explicitly shared, but - for our use case - we would require an option to also scan implicitly shared folders.

Thank you for this beautiful app and your patience.

Klakla2 avatar Sep 15 '19 15:09 Klakla2

Explicitly shared tracks appear, but that's not our use case.

Let me rephrase: I'm not saying things are fine, just explaining what works and what does not. For the moment, file hooks don't work for folders/files shared with a group. Everything should work fine if files/folders are shared with users.

It's not a choice, just something that is a bit challenging and not implemented. Adding an option to enable it is not possible for the moment because it's not implemented :wink:.

julien-nc avatar Sep 15 '19 19:09 julien-nc

Ok for me.

I do not know, whether it is related, but I saw following error in Log repeatedly:

[PHP] Error: Division by zero at /html/owncloud/apps/maps/lib/Service/PhotofilesService.php#420

GET /cron.php from 89.12.216.19 at 2019-09-15T19:06:26+00:00

Julien Veyssier [email protected] schrieb am So., 15. Sep. 2019 21:21:

Explicitly shared tracks appear, but that's not our use case.

Let me rephrase: I'm not saying things are fine, just explaining what works and what does not. For the moment, file hooks don't work for folders/files shared with a group. Everything should work fine if files/folders are shared with users.

It's not a choice, just something that is a bit challenging and not implemented. Adding an option to enable it is not possible for the moment because it's not implemented πŸ˜‰.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nextcloud/maps/issues/123?email_source=notifications&email_token=AEMERLRXVIY4SHDTSFJ7GLDQJ2DKJA5CNFSM4ITOSNA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6XXGVA#issuecomment-531592020, or mute the thread https://github.com/notifications/unsubscribe-auth/AEMERLTOLFXHBUDJMVQIHGLQJ2DKJANCNFSM4ITOSNAQ .

Klakla2 avatar Sep 15 '19 19:09 Klakla2

And just to clarify from the design side: If you can see the stuff in Files, then you should also see it in Maps. No additional setting should be needed. :) (But as @eneiluj said of course stuff has to be implemented.)

jancborchardt avatar Sep 16 '19 20:09 jancborchardt

As I understand the comments, this should generally be possible, but it isn't. Then I don't get the idea of why it is labeled with a milestone that seem to say something like "We're not sure, if we want to do something about it at all". Does it need additional work what must be done in the nextcloud core? Maybe then it should be linked to an issue filed there?

Bloodsoul avatar Oct 18 '19 05:10 Bloodsoul

@Bloodsoul this might have been because the milestone was given before we named the milestones. But in any case the "0.4 maybe someday" is a placeholder for anything after a possible 0.3 cause we can’t really look that far in the future. :)

Regarding what is needed, @eneiluj explained it a bit above. If someone is interested in helping with the implementation I’m sure he can explain it more. :)

jancborchardt avatar Oct 18 '19 14:10 jancborchardt

Thanks for clarification and changing it to 0.3. Maybe the milestone needs a better name then ;) But that's off-topic here.

Bloodsoul avatar Oct 18 '19 14:10 Bloodsoul

In case the external storage feature of Nextcloud is not used, a workaround could be to change file apps/maps/lib/Service/PhotofilesService.php the way that

     private function gatherPhotoFiles ($folder, $recursive) {
         $notes = [];
         $nodes = $folder->getDirectoryListing();
         foreach ($nodes as $node) {
             if ($node->getType() === FileInfo::TYPE_FOLDER AND $recursive) {
                 // we don't explore external storages for which previews are disabled
                 if ($node->isMounted()) {
                     $options = $node->getMountPoint()->getOptions();
                     if (!$options['previews']) {
                         continue;
                     }
                 }
                 $notes = array_merge($notes, $this->gatherPhotoFiles($node, $recursive));
                 continue;
             }
             if ($this->isPhoto($node)) {
                 $notes[] = $node;
             }
         }
         return $notes;
     }

becomes

     private function gatherPhotoFiles ($folder, $recursive) {
         $notes = [];
         $nodes = $folder->getDirectoryListing();
         foreach ($nodes as $node) {
             if ($node->getType() === FileInfo::TYPE_FOLDER AND $recursive) {
                 $notes = array_merge($notes, $this->gatherPhotoFiles($node, $recursive));
                 continue;
             }
             if ($this->isPhoto($node)) {
                 $notes[] = $node;
             }
         }
         return $notes;
     }

At least I found no further flaws with that.

slackfan avatar Jan 16 '20 20:01 slackfan

Hello If I understand well, this is not an issue, but a confirmed improvement/enhancement request for future releases ?

Skip75 avatar Jan 22 '20 18:01 Skip75

Probably related https://github.com/nextcloud/photos/issues/129

gabrielklein avatar Jan 29 '20 10:01 gabrielklein

I do not know, whether it is related, but I saw following error in Log repeatedly: [PHP] Error: Division by zero at /html/owncloud/apps/maps/lib/Service/PhotofilesService.php#420 GET /cron.php from 89.12.216.19 at 2019-09-15T19:06:26+00:00 Julien Veyssier [email protected] schrieb am So., 15. Sep. 2019 21:21: …

I'm also getting a similar error:

Division by zero at /var/www/html/custom_apps/maps/lib/Service/PhotofilesService.php#407

This error is currently appearing for every photo I have, but only after I've manually added them to the job queue using occ maps:scan-photos, and the cron job has run.

Is there any advice for fixing this issue?

sirjaymond avatar Apr 12 '20 01:04 sirjaymond

In case the external storage feature of Nextcloud is not used, a workaround could be to change file apps/maps/lib/Service/PhotofilesService.php the way that

     private function gatherPhotoFiles ($folder, $recursive) {
         $notes = [];
         $nodes = $folder->getDirectoryListing();
         foreach ($nodes as $node) {
             if ($node->getType() === FileInfo::TYPE_FOLDER AND $recursive) {
                 // we don't explore external storages for which previews are disabled
                 if ($node->isMounted()) {
                     $options = $node->getMountPoint()->getOptions();
                     if (!$options['previews']) {
                         continue;
                     }
                 }
                 $notes = array_merge($notes, $this->gatherPhotoFiles($node, $recursive));
                 continue;
             }
             if ($this->isPhoto($node)) {
                 $notes[] = $node;
             }
         }
         return $notes;
     }

becomes

     private function gatherPhotoFiles ($folder, $recursive) {
         $notes = [];
         $nodes = $folder->getDirectoryListing();
         foreach ($nodes as $node) {
             if ($node->getType() === FileInfo::TYPE_FOLDER AND $recursive) {
                 $notes = array_merge($notes, $this->gatherPhotoFiles($node, $recursive));
                 continue;
             }
             if ($this->isPhoto($node)) {
                 $notes[] = $node;
             }
         }
         return $notes;
     }

At least I found no further flaws with that.

This partially solves the problem. However, new images will only show in the map if you start the maps:scan-photos command manually - as long as they are uploaded to a shared folder. Of course this is not ideal since depending on the amount of images, it can take a long time to do the scan.

Any advice how this can be avoided?

Chris-A-sc avatar May 18 '20 14:05 Chris-A-sc

I don't see how this should relate, but anyways, I have a cron job for the maps:scan-photos task.

slackfan avatar May 18 '20 18:05 slackfan

On some systems the rescan, no matter if started via cron or manually, of all photos will take a long time to finish. As I understood normally when you upload a photo, the maps app will only add the single image as a job and won't rescan everything. Which in my opinion would also be the preferred way for group folders.

Chris-A-sc avatar May 19 '20 09:05 Chris-A-sc

I don't see how this should relate, but anyways, I have a cron job for the maps:scan-photos task.

Just don't. It will rescan all pictures on your system and probably delay all other brackground jobs until it is finished. And at least on my picture collection this takes days. It is not a problem doing it once, but you shouldn't do it via cron.

tacruc avatar May 19 '20 09:05 tacruc

So basically, the problem is that there is no equivalent to https://docs.nextcloud.com/server/stable/developer_manual/app/events.html#filesystem-root for group folders, or? @rullzer @nickvergessen A'm I wrong here? I couldn't find anything in the event docs. Is it clear if those events are comming some day, or it there a more fundamental problem?

tacruc avatar May 19 '20 09:05 tacruc

Should be triggered as well. Maybe you can check the activity for differences?

nickvergessen avatar May 19 '20 16:05 nickvergessen

How are the chances oft any progress here? I love the map feature for GPS info in exif. More than 95% oft my pictures are not scanned though because they are mostly stored in groupfolders (not external storage!).

I had no deep look into that code, but could it be possible to treat those as one user representing all group folders. Say rescan on occ giving 'group' as userid would scan group folders? Still the need for the 'on upload' trigger... Where is the job trigger handling the single scan and why is it not triggered for groupfolders?

stuckinger avatar Jul 05 '20 20:07 stuckinger

+1 I have the same request, should be too complicated, right?

iamklaus avatar Aug 28 '20 09:08 iamklaus

+1 I have the same request, should be too complicated, right?

Feel free happy for the PR.

tacruc avatar Aug 28 '20 12:08 tacruc

Has there been a fix/improvement to enable to location of Group Folders? I followed this threat but it's a bit convoluted on if it is or isn't possible?

isaacolsen94 avatar Sep 13 '21 18:09 isaacolsen94

I would also be interested in this feature.

Superharz avatar Jan 11 '22 23:01 Superharz

grafik

The Nextcloud Cookbook integration has an option which looks for me similaire to this feature: It lets you select where to store and look for recipes. It also allows selecting Group Folders as storage place.

Superharz avatar Jan 12 '22 23:01 Superharz

Hello,

I read the discussion, but I am not sure what the status is. In my case:

  • Photos that are in a group folder do not show in the photo app under tab 'your photos' .
  • They are shown under tab 'shared with you'.

Is that currently expected behaviour?

GHBLoos avatar Aug 06 '22 08:08 GHBLoos

Just tested on v0.2.5 and it worked for shares and groupfolders.

tacruc avatar Mar 03 '23 23:03 tacruc