Nextcloud Pictures-Directory not shown in Gallery

I think I remember from patching the Gallery app that it checks for AD running and only enables that folder then.

However, it’s relatively easy to hack Gallery to show other paths:

1 Like

I did add this to gallery.qml but it seems there are some missing parts (import-section):

Looks alright, but that only configures the display of the folder.
It still has to be added to the Indexer (tracker3) so it can display anything.

Haven’t done that part but there’s

gsettings get org.freedesktop.Tracker3.Miner.Files index-recursive-directories

which has a list of dirs that’s indexed. You’ll have to add $HOME/NAS/Bilder to that list. I believe that can be done with something like

# note the -p for devel-su
devel-su -p tracker3 index --add --recursive '$HOME/NAS/Bilder'
1 Like

Looks alright, but that only configures the display of the folder.

I’m not 100% sure this is enough modification, at least the Gallery should show an empty Entry but it doesn´t. And Videos from the ~/NAS/Bilder/2023 are shown inside the Video-Dir of Gallery without Thumbnail. So there must be something of a sorting Part inside the Gallery-Code.

Tracker3 is working and Tracking, so this Part should be adressed.

Ah, yes you have just added a Model to the app.

You need to display it in GalleryStartPage.qml using a MediaSource element:

    SilicaGridView {
         id: view
         objectName: "albumsView"
         //...
         model: MediaSourceModel {
      
             // Existing entries...

             MediaSource {
                id: nasPhotoSource
                //% "Photos"
                title: "NAS %1".arg(qsTrId("gallery-bt-photos"))
                icon: "PhotoIcon.qml"
                page: "GalleryGridPage.qml"
                model: nasStorage
                ready: true
                busy: model.status == DocumentGalleryModel.Active
                count: model ? model.count : 0
                type: MediaSource.Photos
            }

            // other entries

        }
2 Likes

Thanks for that Code-Snippet, now its displayed and also the Thumbnails but the Pictures can´t be opened but it shows the Exif-Data correct, i guess Gallery have no rights to access the Pictures?

Most likely, yes.

You can just add your paths to the Pictures permission, or invent a new Permission and add that in the .desktop file.

1 Like

Quotation marks need to be used:

devel-su -p tracker3 index --add --recursive "$HOME/NAS/Bilder"

I did add:

[X-Sailjail]
Permissions=UserDirs;MediaIndexing;Ambience;Privileged;Internet;Synchronization;RemovableMedia;Audio;Accounts;PublicDir,Pictures;Videos

to /usr/share/applications/jolla-gallery.desktop

But can´t still open Pictures.

With Linux-Mint-Terminal (Gnome-Terminal) that Quotation → ’ works:

[defaultuser@XperiaXZ2Compact ~]$ tracker3 index
Pfad Rekursiv
/home/defaultuser/Desktop *
/home/defaultuser/Documents *
/home/defaultuser/Downloads *
/home/defaultuser/Music *
/home/defaultuser/Pictures *
/home/defaultuser/Videos *

(tracker index:2400): GLib-CRITICAL **: 11:14:30.352: g_file_test: assertion ‘filename != NULL’ failed

(tracker index:2400): Tracker-WARNING **: 11:14:30.352: Could not expand XDG user directory $HOME/android_storage/DCIM

(tracker index:2400): GLib-CRITICAL **: 11:14:30.353: g_file_test: assertion ‘filename != NULL’ failed

(tracker index:2400): Tracker-WARNING **: 11:14:30.353: Could not expand XDG user directory $HOME/android_storage/Download

(tracker index:2400): GLib-CRITICAL **: 11:14:30.353: g_file_test: assertion ‘filename != NULL’ failed

(tracker index:2400): Tracker-WARNING **: 11:14:30.353: Could not expand XDG user directory $HOME/android_storage/Pictures

(tracker index:2400): GLib-CRITICAL **: 11:14:30.353: g_file_test: assertion ‘filename != NULL’ failed

(tracker index:2400): Tracker-WARNING **: 11:14:30.353: Could not expand XDG user directory $HOME/android_storage/Podcasts

(tracker index:2400): GLib-CRITICAL **: 11:14:30.353: g_file_test: assertion ‘filename != NULL’ failed

(tracker index:2400): Tracker-WARNING **: 11:14:30.353: Could not expand XDG user directory $HOME/android_storage/Music
/home/defaultuser/NAS/Bilder/2023 *

I get the same warnings but everything seems to work despite them.
If I copy pictures to android_storage/Pictures, Gallery shows them in the Android Storage folder.

This does not work, though:
If there are videos in android_storage/Movies, Gallery does not show them. This is because android_storage/Movies does not seem to belong to the default folders to be indexed.

After this command

devel-su -p tracker3 index --add --recursive "$HOME/android_storage/Movies"

it gets better. Gallery starts showing those videos in the Videos folder (although not in Android Storage). No need to run tracker3 index .

1 Like

[defaultuser@XperiaXZ2Compact ~]$ /usr/bin/sailjail -p jolla-gallery.desktop /usr/bin/jolla-gallery
constructing /run/firejail/mnt/privileged: Images,Ambienced,msyncd,Accounts,Keys …
mounting /run/firejail/mnt/privileged @ /home/defaultuser/.local/share/system/privileged
hiding /run/firejail/mnt/privileged
[D] unknown:0 - Using Wayland-EGL
library “libGLESv2_adreno.so” not found
library “eglSubDriverAndroid.so” not found

Error: Input file path cannot be read: /home/defaultuser/NAS/Bilder/2023/IMG_20230423_101731.mp4

[W] unknown:0 - NemoThumbnailCache::ThumbnailData {anonymous}::generateVideoThumbnail(const QString&, const QString&, const QByteArray&, const QSize&, bool) Could not generateVideoThumbnail: “/home/defaultuser/NAS/Bilder/2023/IMG_20230423_101731.mp4” QSize(512, 512) true

Error: Input file path cannot be read: /home/defaultuser/NAS/Bilder/2023/IMG_20230417_074131.mp4

[W] unknown:0 - NemoThumbnailCache::ThumbnailData {anonymous}::generateVideoThumbnail(const QString&, const QString&, const QByteArray&, const QSize&, bool) Could not generateVideoThumbnail: “/home/defaultuser/NAS/Bilder/2023/IMG_20230417_074131.mp4” QSize(512, 512) true

Error: Input file path cannot be read: /home/defaultuser/NAS/Bilder/2023/IMG_20230415_102301.mp4

[W] unknown:0 - NemoThumbnailCache::ThumbnailData {anonymous}::generateVideoThumbnail(const QString&, const QString&, const QByteArray&, const QSize&, bool) Could not generateVideoThumbnail: “/home/defaultuser/NAS/Bilder/2023/IMG_20230415_102301.mp4” QSize(512, 512) true

Error: Input file path cannot be read: /home/defaultuser/NAS/Bilder/2023/IMG_20230414_191634.mp4

[W] unknown:0 - NemoThumbnailCache::ThumbnailData {anonymous}::generateVideoThumbnail(const QString&, const QString&, const QByteArray&, const QSize&, bool) Could not generateVideoThumbnail: “/home/defaultuser/NAS/Bilder/2023/IMG_20230414_191634.mp4” QSize(512, 512) true
[W] unknown:52 - file:///usr/lib64/qt5/qml/Sailfish/Gallery/ImageViewer.qml:52:5: QML Image: Cannot open: file:///home/defaultuser/NAS/Bilder/2023/IMG_20230501_183102.jpg
[W] unknown:52 - file:///usr/lib64/qt5/qml/Sailfish/Gallery/ImageViewer.qml:52:5: QML Image: Cannot open: file:///home/defaultuser/NAS/Bilder/2023/IMG_20230501_183100.jpg
[W] unknown:1154 - file:///usr/lib64/qt5/qml/Sailfish/Silica/PageStack.qml:1154:13: QML Binding: Binding loop detected for property “value”
[W] unknown:1154 - file:///usr/lib64/qt5/qml/Sailfish/Silica/PageStack.qml:1154:13: QML Binding: Binding loop detected for property “value”
[W] unknown:1154 - file:///usr/lib64/qt5/qml/Sailfish/Silica/PageStack.qml:1154:13: QML Binding: Binding loop detected for property “value”

Would the path /home/defaultuser/Pictures/NAS/Bilder/2023/… work better?

Would the path /home/defaultuser/Pictures/NAS/Bilder/2023/… work better?

Not in all aspects:

  • Thumbnails for Pictures are created and showed in Gallery-Dirs and when opening the Overview-Page of NAS, but open a Picture is not possible (not found), Exif-Data are shown of each Picture.
  • Thumbnails for Videos are not created (maybe through too big files or missing permissions) but shown without Thumbnail inside Video-Dir (which seems to be some kind of internal Sorting for Video-Files, which isn´t a bad idea). Open Video not Possible but also Info (Exif-Info are shown).

So tracker3 do its part here, the Sailjail-Permissions are all set, so there must be other Problems with my dafs2fs-share or permissions for Gallery.

Softlinking the ~/NAS/Bilder/2023 inside Pictures is no option for me because then all content will be Displayed under Pictures from Phone-Memory/SD-Card which create doubled content there.

I got the solution:

add

whitelist ${HOME}/NAS

to /etc/sailjail/permissions/Pictures.permissions
and /etc/sailjail/permissions/Videos.permissions

2 Likes

The next OS update may wipe these lines out, unfortunately.

I know so maybe a patch will be made or the option to add other Directorys in App-Preferences in SFOS.

For some reason tracker3 did not update home/defaultuser/Pictures/NAS/Bilder/2023/ by itself.

Is there a way to trigger the daemon without the need to buildup the complete database from the ground up?

Nextcloud account is meant to be used with Nextcloud, it is not a generic WebDAV client, so I’ll close this bug report.

1 Like