-
Notifications
You must be signed in to change notification settings - Fork 9
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
allow custom filenaming #32
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! However, I have a quibble
adafruit_pycamera/__init__.py
Outdated
filename = "/sd/img%04d.%s" % (self._image_counter, extension) | ||
filename = f"/sd/{filename_prefix}%04d.%s" % ( | ||
self._image_counter, | ||
extension, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like you to revise this so that it's just one formatting operation. It'd be something like f"/sd/{filename_prefix}{image_counter:04d}.{extension}"
, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest commits change that to use a single format operation. It turns out my IDEs code formatter also unintentionally broke the example by splitting a long line string across multiples so I fixed that with .format()
This change allows you to pass a custom string to get used instead of the default "img" in the photo filenames.
It will still include the 4 digit integer counter for ensuring unique names.
resolves #17