Skip to content
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

dk.image.find not working on windows #3

Open
raphaelquast opened this issue Sep 29, 2023 · 2 comments
Open

dk.image.find not working on windows #3

raphaelquast opened this issue Sep 29, 2023 · 2 comments
Assignees

Comments

@raphaelquast
Copy link

Hey,
First of all thanks a lot for this awesome tool!
I tried to use it to auto-tag a ton of images based on folder-names and it did the job really well!

I am on windows, so I can confirm that most of the image and tagging api works as expected.

The only issue I ran into so far is that the image.find function which seems to search for some linux-mounts?

Using ordinary indexing to access images works just fine (e.g. dk.image[10])

dk.image.find("some path")
>>>FileNotFoundError: [Errno 2] No such file or directory: '/proc/mounts'
@rcw-2
Copy link
Owner

rcw-2 commented Oct 1, 2023

Hello Raphael,

Hey, First of all thanks a lot for this awesome tool! I tried to use it to auto-tag a ton of images based on folder-names and it did the job really well!

Thank you for the praise. ;-)

I am on windows, so I can confirm that most of the image and tagging api works as expected.
The only issue I ran into so far is that the image.find function which seems to search for some linux-mounts?

Digikam usually stores the file system's UUID and a relative path in AlbumRoots to specify the directory. The code converts this to a path on Linux, but I cannot test how this works on Windows. You can try to get around this with the (hardly documented) root_override argument of the Digikam constructor, e.g.

dk = Digikam(
    "sqlite:///....",
    root_override = {"ids": {"<Identifier>": "<Path>"}}
)

Identifier ist the contents of AlbumRoots.identifier in the database (usually of the form "volumeid:?uuid=...") and Path the root directory of the volume (probably something like "C:\"). With this parameter, Digikam-DB will just use the given path and the error should not occur.

There may be additional issues as Digikam does case-sensitive compares and may miss some filename equalities.

Hope this helps you a step further...

@rcw-2 rcw-2 self-assigned this Oct 1, 2023
@rcw-2
Copy link
Owner

rcw-2 commented Nov 11, 2023

0.3.3 warns when trying to determine mountpoints on systems other than Linux. Anyway, it will probably just crash without the /dev/disk/... links. The documentation for the root_override parameter has also been updated.
Python 3.12 has some function (listmounts, listvolumes) that may do the job, but I don't have the time to develop and test on other systems than Linux. If someone can provide a fix, I'll be glad to include it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants