blissd / fotema

Photo gallery for Linux
29 stars 6 forks source link

Allow choosing a specific photos folder #18

Closed bertob closed 1 week ago

bertob commented 1 month ago

My Pictures folder has way too much stuff in it, and the app keeps choking on importing all of them. It'd be great if there was a way to choose which folder to look at, to test it with a more limited set.

blissd commented 1 month ago

How large is the picture library? And when you say it chokes, what does that mean? Is it just time consuming, or does the app fail?

bertob commented 1 month ago

First it was loading for over an hour, and now it fails on every new restart with this:

13:26:03.807 ERROR fotema::app::background::photo_thumbnail: Failed add_thumbnail: Remote error: org.gnome.glycin.Error.LoadingError: loaders/glycin-image-rs/src/bin/glycin-image-rs.rs:148:29: /run/build/glycin-loaders/vendor/glycin-utils/src/image_rs.rs:56:41: Format error decoding Png: Unexpected end of data before image end.

Caused by:
    org.gnome.glycin.Error.LoadingError: loaders/glycin-image-rs/src/bin/glycin-image-rs.rs:148:29: /run/build/glycin-loaders/vendor/glycin-utils/src/image_rs.rs:56:41: Format error decoding Png: Unexpected end of data before image end.
thread '<unnamed>' panicked at /run/build/fotema/vendor/zune-jpeg/src/mcu.rs:209:9:
assertion `left == right` failed
  left: 1512000
 right: 36000000
Rayon: detected unexpected panic; aborting
blissd commented 1 month ago

Thank you for the error message. I have tested Fotema against the corrupt files in this repo and can see stack traces and errors (though not the one you reported), but I can't reproduce an abort.

I do see that Fotema tries to generate thumbnails for the corrupt images every time it starts, so I'll do some work to mark images or videos as broken in the database so Fotema won't try and generate thumbnails again.

If the troublesome image isn't personal or obscene, then feel free to attach the image to this issue and I'll see if it can be handled more gracefully.

If you want more logging output to help identify the image, you can run Fotema with:

flatpak run --env=RUST_LOG=fotema=DEBUG,glycin=DEBUG --env=RUST_BACKTRACE=1 app.fotema.Fotema

Removing the troublesome image might allow Fotema to proceed without further error, but if you don't want to remove the image or can't identify it, then as a work around you can set your XDG_PICTURES_DIR in ~/.config/user-dirs.dirs to point to the directory of your choice. However, I warn you that Fotema will then proceed to do some database maintenance to delete records and thumbnails for images and videos it can't find which will undo that hour of thumbnail processing you've already waited for.

blissd commented 1 month ago

I've released version 1.3 of Fotema which has more robust handling of panics when generating thumbnails, so hopefully if you are still interested in using Fotema it might be able to process your photos and videos correctly.

I've looked at allowing the user to choose a directory, and I'm not sure how to go about it without requiring more permissions. I don't think it is suitable for a photo gallery app to have more access than xdg-pictures:ro so I wouldn't want to add home folder access. I've looked at the xdg-documents-portal API and I'm left confused as to whether it would be a good fit for what I want to do.

I'll play with the xdg-documents portal at some point, but unfortunately for now you and other users will have to live with changing your xdg-pictures directory to control where Fotema finds your photos.

bertob commented 1 month ago

Thanks! I tried the latest version, and can confirm that the app successfully completed the setup process this time without crashing :+1:

It'd still be good to allow setting custom folders for easier testing though, AFAIK there should be a portal that allows doing that without home folder access. I'd try asking in #flathub or #flatpak on Matrix :)

queeup commented 1 month ago

I like to have this option too. I solve this with using Flatseal app to change Filesystem folder xdg-pictures:ro to xdg-pictures/MyPhotos:ro

xdg-pictures/MyPictures:ro = $HOME/Pictures/MyPhotos