mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.7k stars 953 forks source link

Allow `gallery-dl.conf` to be named `gallery-dl.conf.txt` and `gallery-dl.conf.json` #2333

Open AlttiRi opened 2 years ago

AlttiRi commented 2 years ago

Allow gallery-dl.conf file to be additionally named gallery-dl.conf.txt.

Since by default Windows hides the extensions in File Explorer.

Some people created gallery-dl.conf.txt and think that they created gallery-dl.conf that is wrong. It generates additional issues here with their problems.

And gallery-dl.conf.json for syntax highlighting in text editors.

https://github.com/mikf/gallery-dl/blob/3acfe683eababaa575ff13081a7225b7e9f55623/gallery_dl/config.py#L25-L38

madindehead commented 2 years ago

Surely people using this can turn on file extensions in Windows? It's not difficult and is incredibly useful.

AlttiRi commented 2 years ago

Independently how it's useful and easy to set up, it's disabled by default.

And some people will face the problem.

Since they create New Text Document file first from the context menu, then they rename it to gallery-dl.conf that results to gallery-dl.conf.txt actually.

Hrxn commented 2 years ago

It's a CLI program, and no matter what you use here, the CLI will always show you the real file extensions, and you can easily rename files from there as well..

AlttiRi commented 2 years ago

There are 46 issues about "Deviantart 429 Error". (Edit: with mention of it.)

Do you think that everybody knows basic shell commands?

For some people just to run gallery-dl.exe with the default settings is a challenge. Because it requires to use a terminal.

I see that there is a problem and resolving is trivial. Why not. It will exclude one reason why config is ignored.

Hrxn commented 2 years ago

Dunno, but this is even the most basic of the basic ones, like dir or ls, and you're already only one step away from renaming a file then..

But you're probably right about this, with regard to the issue count.

So, don't get me wrong, I'm not against this change.

-- Edit --

One thing that definitely could be improved here is maybe adding an additional line to the debug status messages when running in --verbose.

This wasn't an issue for me personally yet, because you can actually tell from the verbose messages from the extractor if you are using any custom auth settings or something. More, you can always check the output settings with gallery-dl -E <url>, which shows you your custom "directory" and "filename" settings e.g. - when you see these, it must mean that your config has been successfully loaded.

But again, something along the lines of what yt-dlp is currently doing might be a good idea:

PS D:\Temp> yt-dlp -v
[debug] Command-line config: ['-v']
[debug] User config "C:\Users\Hrxn\AppData\Roaming\yt-dlp\config.txt": ['--download-archive', 'E:\\ {SNIP} ..]
.. {SNIP} ...

So, the first debug message shows the options provided from the CLI, and the second line the user config file, with it's entire path, and then following in the square-brackets the actual options set by this file (which isn't even that important, in my opinion, a simple message a la "config file loaded from <PATH> successfully" or something should be enough).

AlttiRi commented 2 years ago

Yes, I also suggested this before.

https://github.com/mikf/gallery-dl/issues/2143#issuecomment-1001365408

madindehead commented 2 years ago

Honestly, I would question why someone is using a CLI utility if they can't even change file extensions via the CLI. Or just turn them on in the Windows explorer.

ghost commented 2 years ago

If someone use the Windows Explorer to run, create or configure a CLI utility, that person should buy one of numerous downloaders for windows available on the internet. I felt kind a shame for the author of this "issue"...

AlttiRi commented 2 years ago

I felt kind a shame for the author of this "issue"...

Because I want to decrease the issue's count and help a bit to people who are not "elite" because they want to download the content with the best tool, but it's their the first experience with CLI? With a minor fix that will not change, but only extend the interface. You (and me too) will continue to use gallery-dl.conf.

Maybe lets start to close all issues if there is an answer in the other one? Just marks these issues as a duplicate and close for commenting.

Okay, @mikf your opinion about it? I see this opened issue is the red rag to CLI-masters. Even people that never commented here anything were triggered ([1], [2]).


BTW, the repost of my old message:

Add in --version showing if there is any config file in use. Add a command to create a dummy config file.

Read also gallery-dl.conf.txt? To resolve such problems in future.

Or add a command to open (and create an empty file if it does not exist) the config file. --open-config

thatfuckingbird commented 2 years ago

I don't think that it should automatically use these files, as that would be just further enabling user mistakes. But I agree with @AlttiRi that the problem is real, I think implementing a check for these mistakenly named files and displaying a warning/instructions would be OK. I think it's better to to educate users about potential problems than trying to silently paper over them.