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

Directory Iteration and Recursion #69

Open
EmilianoJordan opened this issue Jan 20, 2025 · 3 comments
Open

Directory Iteration and Recursion #69

EmilianoJordan opened this issue Jan 20, 2025 · 3 comments

Comments

@EmilianoJordan
Copy link

Is your feature request related to a problem? Please describe.
For some of my use cases it would be nice to be able to pass arguments/flags to iterate directories or recursively process images. This is, for the most part, for convenience. Most functionality can be done by the caller and and CLI. Python has glob, pathlib etc for accomplishing this from the caller. And the CLI could used something like this ls -R | grep '.jpeg\|.jpg' | xargs exif-stripper.

But it might still be worth implementing something in this package. I'd be happy to PR a full working example if you're open to that.

Describe the solution you'd like
I have a very rough proposal, The CLI would need updates to support the new function args but this should give an idea.

This does have some issues that will need to be addressed that I know of:

  1. symlinks: I added recurse_symlinks: bool = False but the similar Path().glob() arg did not get added until python 3.13. I think this functionality should be included in this (>=3.8).
  2. case sensitivity: very similar to symlinks but different.
  3. file suffixes: There might be better strategies than the white list one I went with.

Thanks for this package in the first place!

Copy link

It looks like this is your first issue here – welcome! Please familiarize yourself with the contributing guidelines, if you haven't already.

@stefmolin
Copy link
Owner

Thanks for reaching out, @EmilianoJordan. Am I correct in assuming you don't use exif-stripper as a pre-commit hook? I ask because pre-commit has this functionality (and it also handles passing in only image files to the tool using https://github.com/pre-commit/identify):

pre-commit run --all-files  # process all images in the repository

In general, I'm not opposed to adding this to the tool itself, as long as it doesn't interfere with using the pre-commit hook.

@EmilianoJordan
Copy link
Author

I did not know about identify, thanks for that!

You are correct, I have not found a pre-commit use case yet. I installed it as a CLI tool for now, and thought that I had a couple use cases for this + what I mentioned. Although I might be able to integrate exiftool for those, I also wanted the flexibility of having the same functionality in a python callable.

I'll put something together that doesn't break your pre-commit use case and see what you think.

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