Closed tapioca24 closed 2 years ago
There are two options.
For example, something like this:
P5Capture.setDefaultOptions({
baseFilename: {
pattern: "my-sketch-<timestamp>", // <timestamp> is replaced by a timestamp at runtime
timestampFormat: "MMM-DD-YYYY-HHmmss",
},
imageFilename: {
pattern: "my-sketch-<count>", // <count> is replaced by a count at runtime
digitsInCounter: 10,
counterStartValue: 100
}
})
For example, something like this:
P5Capture.setDefaultOptions({
baseFilename(date) {
return `my-sketch-${date.valueOf()}`
},
imageFilename(count) {
const newCount = count + 100
const countStr = newCount.toString().padStart(10, "0")
return `my-sketch-${countStr}`
}
})
I prefer the function option because it is simpler and more flexible. It would meet almost all requirements.
Hi there! Thanks so much for dedicating time to this! In my opinion, the function option is also the most flexible. The user can have their own functions written with any arbitrary complexity, and for those who are not experts they can always just copy-paste an easy example for the most basic features (basically, those functions you have there in the example). Then an expert user can build upon that as much as they please. If this does not complicate your development of the library, I believe it's a useful feature for many use cases. Thank you so much once again!
@msoriaro Thank you for your input. It has helped me to confirm that the function option is optimal. I am working on this now! Basically this will be ready soon. I will let you know when it''s done.
Hi, @msoriaro.
Added by https://github.com/tapioca24/p5.capture/pull/13. Released in 1.3.0. Now you can customize filenames using the baseFilename
and imageFilename
options!
Thank you again for your valuable suggestions. Let me know if you have any problems.
v1.2.0 specification
YYYYMMDD-HHmmdd
)20220729-003612.webm
0000123.png
The timestamp is to avoid duplicate file names.
Issues
The following issues are considered.
YYYYYMMDD-HHmmdd
Requirements
It is cool if the following requirements are met.