it-is-wednesday / cute-sway-recorder

SwayWM screen recorder; a GUI for wf-recorder
33 stars 6 forks source link

Feature: filename formatting #36

Open ketexon opened 3 months ago

ketexon commented 3 months ago

Filename Formatting

Filename formatting, similar to OBS's %CCYY-%MM-%DD %hh-%mm-%ss, would be useful for sorting files by name and automatic collision avoidance.

If we only want date/time formatting, we can use the syntax of strftime (%Y-%m-%d %H-%M-%S.mp4).

Random ID generation Considerations (not priority)

If we want to have the option for a random 5 ascii characters (eg. ~/Videos/%id.mp4 -> ~/Videos/bq2it.mp4), I think template strings would be the "best" option, since it can look the same as strftime, unlike % formatting and str.format. We could use % as a delimiter to match strftime and use %id as the placeholder. The only potential edge case would be if strftime implements %i, but we can handle that when it happens ;)

If we allow a random 5 ascii characters as a template placeholder, this makes the "Random name" button a little less useful, and maybe we should consider removing it (or replacing it with "Default name"). However, it could be useful if the user wants to know where the file will be saved before starting recording.

It might be a good idea for accessibility to show the realized filename after/before a recording is finished. Eg. a status line at the bottom that says Saved to "~/Videos/2024-46-07/27/24 14-46-02.mp4". This could also be the same place that displays #23 .

ketexon commented 3 months ago

If the strftime + string.Template with % delimiter and %id behavior sounds good, let me know and I'll start working on it.

it-is-wednesday commented 3 months ago

Hi! Thanks so much for getting discussions running here. You're a godsend.

Frankly I'm not sure what you meant by mentioning template strings: this sounds like logic that should be implemented entirely in strftime, no? I didn't completely understand the logic behind your Template-based solution. Like, I didn't get neither the solution itself nor the reason to consider something other than strftime.

Can you demonstrate what the Template-based implementation would look like?

ketexon commented 3 months ago

Hi! Thanks so much for getting discussions running here. You're a godsend.

Frankly I'm not sure what you meant by mentioning template strings: this sounds like logic that should be implemented entirely in strftime, no? I didn't completely understand the logic behind your Template-based solution. Like, I didn't get neither the solution itself nor the reason to consider something other than strftime.

Can you demonstrate what the Template-based implementation would look like?

Oh my bad I realize I wrote little too much hehe I meant just having an ability have have like 5 random letters in the filename: ~/Videos/%id.mp4 would generate (eg.) ~/Videos/jfab4.mp4.

I think now though that this would belong in its own issue and is not really a priority so maybe just strftime for this issue unless you think otherwise :3

it-is-wednesday commented 3 months ago

Yeah just strftime would be sufficient. I guess there would be no need to add extra random letters except coolness factor