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] More customization in Filename Pattern #74

Open
x-wiz opened this issue Jul 3, 2023 · 10 comments · Fixed by #78
Open

[FEATURE] More customization in Filename Pattern #74

x-wiz opened this issue Jul 3, 2023 · 10 comments · Fixed by #78
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed PR-welcome

Comments

@x-wiz
Copy link

x-wiz commented Jul 3, 2023

Describe the solution you'd like
More customization in Filename Pattern, Like a textbox I can type the layout of the text, the order and also more info.

Example post:
https://twitter.com/saltastic_/status/1658472020735303690

Example Filename pattern:
twitter_{user-name}(@{user-id})_{date-time}_{status-id}_{file-type}

output:
twitter_shio(@saltastic_)_20230516-135837_1658472020735303690_photo.jpg

@x-wiz x-wiz added the enhancement New feature or request label Jul 3, 2023
@EltonChou EltonChou added help wanted Extra attention is needed good first issue Good for newcomers PR-welcome labels Jul 3, 2023
@EltonChou
Copy link
Owner

EltonChou commented Jul 3, 2023

Good suggestion.

I attempted to implement this feature in the past.
But there are more works to do than I thought.

  1. Not every character can be used in the filename, this problem was related to how the file system works. And the most of users don't have this knowledge.
  2. Any filename should be considered as an unique filename. To prevent the users overwrite the file accidentally, the parser need to check the pattern is unique enough or not.
  3. Try to make file can be sorted well in filesystem,
  4. Try to make the filename is human-readable. Some infos are not necessary in filename like timestamp or file-type.
    • There are only two file-types in twitter media, image and video. And you can distinguish file type from their extension.
    • The most of file system can record the time when was the file created.
  5. user-name can be changed and it is not unique. user-id isunique, but it can be changed.

If you want to make a PR. There are few things need to be done.

  1. An advanced user toggle option.
  2. Defined the allowed pattern token.
  3. Input parser.
  4. When users are typing, need a UI component to give feedback.

Feel free to let me know if you need further information.

@Doofy420
Copy link

Doofy420 commented Jul 3, 2023

Something like elonmusk 1673852066572406784_1-4 would be great too, which would make the resulting filenames compatible with a popular twitter ripper (gallery-dl)

@EltonChou
Copy link
Owner

Something like elonmusk 1673852066572406784_1-4 would be great too, which would make the resulting filenames compatible with a popular twitter ripper (gallery-dl)

@outlaw420
That's another serial pattern could be considered to implement.

In my opinion, I prefer non-space filename especially in CLI environment.
but if you choose _ as seperator it would be confused in some situations, because _ is valid character in twitter id.

@Doofy420
Copy link

Doofy420 commented Jul 4, 2023

I'm no dev but I understand it may cause a conflict in some environments, though it's great for casuals like me. It's up to you but it would be nice to have this option regardless. Thanks!

@fredinno
Copy link

I'm trying to go from TwMediaDownloader to this extension.
The name format seems to work fine, except for the name format at the very end.

It would be nice if we could add a filename option to the end, and customize if there is the extra 0 at the end of the serial to make it fully compatible with the old extension.
eg:
{userName}-{serial}-{datetime}-img1.jpg (or vid for videos.)

Currently, I have to manually rename those files.

@EltonChou
Copy link
Owner

EltonChou commented Dec 13, 2023

.jpg and .png are image. .mp4 is video, I don't think we need one more token to distinguish the file type.

@cyanlamp247
Copy link

Regarding your comment on July 3, you can take a look at an extension called Powerful Pixiv Downloader.
It can customize naming rules and enter characters that are not available in file names, but it will turn these characters into full-width characters. As for unique file names, it should be strict enough to maintain the existing rules that say "The pattern must include Tweet ID + Serial or Hash."

But it can be a lot of work. In terms of my personal needs, I currently only need to add a customizable prefix, such as "MH▲-", so that I can distinguish which files are downloaded through your extension.

@fredinno
Copy link

fredinno commented Dec 16, 2023

.jpg and .png are image. .mp4 is video, I don't think we need one more token to distinguish the file type.

I can use a mass renamer to fix the incompatibility, but it's another step that it would be nice if I could avoid if possible in case I forget.

@EltonChou
Copy link
Owner

Regarding your comment on July 3, you can take a look at an extension called Powerful Pixiv Downloader. It can customize naming rules and enter characters that are not available in file names, but it will turn these characters into full-width characters. As for unique file names, it should be strict enough to maintain the existing rules that say "The pattern must include Tweet ID + Serial or Hash."

But it can be a lot of work. In terms of my personal needs, I currently only need to add a customizable prefix, such as "MH▲-", so that I can distinguish which files are downloaded through your extension.

You can use Create sub-directory in options page.

@EltonChou
Copy link
Owner

.jpg and .png are image. .mp4 is video, I don't think we need one more token to distinguish the file type.

I can use a mass renamer to fix the incompatibility, but it's another step that it would be nice if I could avoid if possible in case I forget.

If you really need this you can make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed PR-welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants