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

Add toggleable option to preserve "modified date" on file saving #66

Closed
Gr3q opened this issue Jun 1, 2021 · 7 comments
Closed

Add toggleable option to preserve "modified date" on file saving #66

Gr3q opened this issue Jun 1, 2021 · 7 comments
Assignees

Comments

@Gr3q
Copy link

Gr3q commented Jun 1, 2021

I know I shouldn't have, but I rely on the timestamps to know when I started listening to those songs because I don't have a music manager (I will probably have a future, but the timestamps are still valuable for me because I can use them in simple mp3 players to sort, etc.) so I can sort them by recently added on my phone when they get synced.

I want to clean up my library and make sure everything has tags, but it's cumbersome to get the date, update it with tag editor and use touch to restore the original modified date.

Thanks

@Martchus
Copy link
Owner

Martchus commented Jun 1, 2021

The tag editor might even rewrite the original by renaming it and creating a new file from scratch (see https://github.com/Martchus/tageditor#backuptemporary-files). So even the creation date might change. This is likely something which should actually be preserved. When one would implement that it would likely not be much extra effort to implement preserving the modified date as well.

For the time being (not sure when I'll have the time to implement this) I'd simply create a wrapper script to invoke the tag editor to avoid having to call touch manually. Of course you're also welcome to create a PR yourself.

@Gr3q
Copy link
Author

Gr3q commented Jun 1, 2021

If the relevant code is relatively self-contained and you can point me to it, I'm happy to have a go at it (even if I'm not that good C++ programmer).

@Martchus
Copy link
Owner

Martchus commented Jun 1, 2021

When I remember correctly, I've looked into setting the creation date and noticed that it isn't that trivial under GNU/Linux. Maybe it is actually better to start with the modification date. I suppose there's a function within std::filesystem to read and write/restore it.

The code is in setTagInfo(): https://github.com/Martchus/tageditor/blob/master/cli/mainfeatures.cpp#L441

It is a bit of a mess but hopefully still manageable. For the argument passing … well I suppose you just have to read through the code a little bit yourself because explaining everything takes too long.

The change should be actually very easy (at least for the modification date) so maybe I can do it later this week as well.

(Please write if you're actually start working on this. I'll do the same so we won't duplicate the work.)

@Gr3q
Copy link
Author

Gr3q commented Jun 1, 2021

I only have time next week the earliest, I'll let you know when I start to look into it (assuming by then you haven't started already).

@Martchus Martchus self-assigned this Jun 1, 2021
Martchus added a commit that referenced this issue Jun 1, 2021
@Martchus
Copy link
Owner

Martchus commented Jun 1, 2021

I've been implementing it for the CLI (that's where you need it, right?): 7ada28b

@Gr3q
Copy link
Author

Gr3q commented Jun 1, 2021

I didn't know there is a CLI, but yeah that might be even better for me atm.

In the future I would like to use it in the GUI as well, but it's not urgent.

For cleaning up my library the CLI will actually be better than the GUI.

Thank you for the quick response and work!

@Gr3q
Copy link
Author

Gr3q commented Jun 8, 2021

Thanks, it was very useful to cleanup my library. I will open another Issue for the UI option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants