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

[FEATURE] Set file modified time to tweet time #80

Closed
fireattack opened this issue Jul 6, 2023 · 5 comments
Closed

[FEATURE] Set file modified time to tweet time #80

fireattack opened this issue Jul 6, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@fireattack
Copy link
Contributor

fireattack commented Jul 6, 2023

Is your feature request related to a problem? Please describe.

Set the modified time of downloaded items to its tweet time.

Additional context

It is very useful to manage large amount of medias. You can sort by filename to group files by username and sort by modified date to order them in chronological order.

I don't know if it's even possible with download API, though.

@fireattack fireattack added the enhancement New feature or request label Jul 6, 2023
@EltonChou
Copy link
Owner

The modified time was managed by the browser or the file system, extension can't specify them.

This feature might be related to #55 .
Feel free to share you ideas!

@fireattack
Copy link
Contributor Author

Thanks.

As soon as we can add datetime to the filename (after #74), I can at least use a local script to modify them in batch, so not a big deal (which is also to say that timestamp is definitely not useless in filename).

@EltonChou
Copy link
Owner

I will add some pattern tokens in next patch.
image

Can you share the scenario how do you use the timestamp in filename?
In the most of file system, the modified time would be managed by system.

@fireattack
Copy link
Contributor Author

You can always modify them manually:

Like in Python:

from os import utime
from datetime import datetime
from pathlib import Path

def update_mtime(f, mtime=None):
    f = Path(f)
    if mtime is None:
        mtime = datetime.now()

    current_mtime = datetime.fromtimestamp(f.stat().st_mtime)
    print(f'{f.name}: {current_mtime.isoformat()} -> {mtime.isoformat()}')
    mtime_unix = int(mtime.timestamp())
    utime(f, (mtime_unix, mtime_unix))

(You can even modify creation time, but that's more complicated.)

@EltonChou
Copy link
Owner

Tweet time pattern was introduced in v4.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants