Bug 484211 - Spectacle should convert old format string in filename
Summary: Spectacle should convert old format string in filename
Status: REPORTED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 24.02.1
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-22 06:28 UTC by gudvinr+kde
Modified: 2024-03-27 16:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gudvinr+kde 2024-03-22 06:28:19 UTC
SUMMARY

After an update, spectacle started using Qt date format (apparently) instead of printf.
This broke custom filename strings. So, instead of "20240-03-22 01.01.01.png" I get "%Y-%M-%D %H.%m.%S.png"

Spectacle should either fallback to printf, when it sees "old" formatting, or convert that to "<yyyy>-<MM>-<dd> <hh>.<mm>.<ss>.png" to make names look the same.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.6.22-1-lts (64-bit)
Graphics Platform: X11
Comment 1 Noah Davis 2024-03-24 23:45:52 UTC
There was a configuration migration script to automatically convert old format filename templates if your config file was created before 2024-02-28T00:00:00Z (roughly the release date/time of 24.02). I don't think we have a way to get the version we're upgrading from, so we used the age of the config file. I did test the script before release, but it's possible that the script wouldn't have been triggered in some situations, like a config file for version 23.08 created on 2024-02-29. If the configuration migration script didn't work for you, it's probably too late to fix the conversion script in a way that is actually relevant to users who already upgraded to 24.02.

Internally, printf was never used (QDateTime was always used), the syntax was just printf-like. Re-adding printf-like syntax would add a lot of complexity to filename template parsing. I don't want to support multiple types of syntax, so this probably isn't going to be done.
Comment 2 Jens 2024-03-26 16:37:54 UTC
I also just got bitten by this.
How about the conversion script actually checks for the "%" placeholder in the filename template, and runs based on that result, instead of the config file timestamp?
I think we should still do this, there may be a number of users who have upgraded but haven't used Spectacle yet, and haven't noticed this bug.
Comment 3 gudvinr+kde 2024-03-27 16:24:32 UTC
(In reply to Noah Davis from comment #1)
> I don't want to support multiple types of syntax, so this probably isn't going to be done.

There's no need to, simple regex like "/%[a-z][^a-z]?$/gi" should be good enough for detection with simple lookup table to convert.