Skip to content

Option to preserve file mtime on save #645

Open
kjc1 wants to merge 6 commits into
quodlibet:mainfrom
kjc1:preserve_mtime
Open

Option to preserve file mtime on save #645
kjc1 wants to merge 6 commits into
quodlibet:mainfrom
kjc1:preserve_mtime

Conversation

@kjc1
Copy link
Copy Markdown

@kjc1 kjc1 commented Apr 2, 2024

Provides support to all file formats to preserve the original file mtime on save. I'm aware some users already implement this functionality outside of Mutagen (e.g. Picard) so this has been implemented as an optional flag on the save method where the default (false) maintains the current behaviour.

I have a separate PR incoming to utilise this in Quod Libet.

@lazka
Copy link
Copy Markdown
Member

lazka commented Jun 30, 2024

What's the use case for this? Any why does it have to be part of mutagen?

@phw
Copy link
Copy Markdown
Collaborator

phw commented Jun 30, 2024

I also think this should be part of an application using mutagen, not mutagen itself. Mutagen should stick to the low level functionality.

I see several issues here

  • Even if mutagen does this it might not be sufficient for applications, as they might do additional changes to the files and hence need to implement the timestamp reset anyway
  • The implementation does not work reliably in all cases. E.g. we learned in Picard that resetting the timestamp after writing does not work reliable when writing to SMB shares on Windows. There is some asynchronicity when writing files that lead to a race condition and the timestamp still being changed by the OS after the reset happened. I don't think situations like this are to be solved by a library handling metadata tags.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants