darktable icon indicating copy to clipboard operation
darktable copied to clipboard

export module: keep last piwigo album used - again

Open reox opened this issue 1 year ago • 2 comments

Describe the bug

I think this bug is back: #8687 Every time I export a photo to piwigo, the selected album switches back to the first one in the list.

Steps to reproduce

  1. Select Album
  2. export
  3. Album switches back to first one

Expected behavior

keep the last album

Logfile | Screenshot | Screencast

No response

Commit

No response

Where did you install darktable from?

OBS

darktable version

4.4.2-1.1+70.1

What OS are you using?

Linux

What is the version of your OS?

Debian Bookworm

Describe your system?

No response

Are you using OpenCL GPU in darktable?

Yes

If yes, what is the GPU card and driver?

AMD RX7800XT / ROCm

Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip

No response

reox avatar Nov 01 '23 13:11 reox

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.

github-actions[bot] avatar Jan 01 '24 00:01 github-actions[bot]

Still an issue in 4.6.0

reox avatar Jan 01 '24 14:01 reox

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.

github-actions[bot] avatar Mar 03 '24 00:03 github-actions[bot]

Still an issue in 4.7.0~git646.57744753-1+11388.1

reox avatar Mar 03 '24 08:03 reox

I tried to understand the issue - however my knowledge of darktable's API is limited (i.e., non-existent) thus, my conclusions might be errornous.

It looks like the plugin stores the last album in the configuration and also reads it from there. Maybe something gets messed up there. I checked that this is working: If I select an album, then close darktable and open it again, the old album is selected.

However, I also noticed in the code, that the plugin tries to remove parentheses as it needs the name without the number of photos: https://github.com/darktable-org/darktable/blob/577447536bc4a4dab6a4d2d30fc86f249779910c/src/imageio/storage/piwigo.c#L654-L668

However, my Album names already contain parentheses - which might be the problem here? As I understand the code, it checks if the current char is a space and the next is a ( and inserts a null at that location. My guess it that in that case the album name is not found any more, because it contains the incorrect name! I.e., my album is named Travel to Iceland (2011), the string the function gets will look like Travel to Iceland (2011) (42)\0 and will incorrectly be trimmed to Travel to Iceland\0.

I think the fix here would be to traverse the string from the back and remove the last parentheses pair at the end?

The only weird thing is, the album I export into does not have extra parenthesis. But maybe to have one album with parentheses is enough the trigger this issue?

reox avatar Mar 03 '24 11:03 reox