-
Notifications
You must be signed in to change notification settings - Fork 14
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 script to update creation dates. #61
base: main
Are you sure you want to change the base?
Conversation
Interesting, just so I follow correctly: We're writing for each uploaded file a timestamp file to a configured directory with the timestamp in And when calling the script So the intention is to "mirror" the creation date from the remote source? And this would reshuffle only posts which were uploaded with |
Precisely. Modified time obviously won't mean much for Szurubooru sorts on id by default but when you use This affects both One thing that does come to mind is that the database must be able to accept the timestamps under ISO-8601 format, I believe it always should but maybe certain locales may cause problems, if anything does go wrong because of it though then the errors will only show up during the |
I see, so the sorting is being affected only when explicitly sorting for date. The thing is, writing a timestamp file to disk and reading from it later on to apply it works, but seems quite unintuitive on the user side. What I'm thinking: You can supply a query to that update script and the script would check the sources from each post returned from the query, fetch the creation date from there and update it then in the database. In Also, when using With this, the user only need's the specify the DB credentials and if he wants to go that extra step of updating the timestamps. And he'd also have that "backwards" compatibility for posts that were already uploaded. |
That doesn't sound like a bad idea to me. My initial use-case was for a newly built instance, so I wasn't too worried about existing posts at the time, but I do agree that it would be cleaner to handle existing posts as well. I'll convert this into a draft then. I'm not entirely sure when I'll have the time to update this either but like you said, it's a niche feature anyway. |
Maybe a bit specific to my personal preferences, so feel free to decline.
Added a script that updates the creation dates in the database since there's no API call for this. The media uploader writes a simple timestamp file, that way the upload process won't be affected if the database connection doesn't work. Had to forward some file-paths through because otherwise we only had access to the raw file-data.
To get the correct modified time in the files, you'd need to set
"mtime": true
in the gallery-dl config file, but it will first attempt to read the metadata file.I'm running on Python 3.13 myself, so I also updated some packages to be compatible. It still runs fine in docker too.