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

Gallery-dl portable configuration #1805

Closed
the-nothingman opened this issue Aug 28, 2021 · 5 comments
Closed

Gallery-dl portable configuration #1805

the-nothingman opened this issue Aug 28, 2021 · 5 comments

Comments

@the-nothingman
Copy link

According to this closed bug report gallery-dl has the ability to to use a config file that is within the same directory as the program for a portable version but there's no documentation on how to do this. When I try it keeps ignoring the gallery-dl.conf, is there something specific this needs to work or does this not work with the gallery-dl.exe as is.

@Hrxn
Copy link
Contributor

Hrxn commented Aug 28, 2021

I haven't tried it, but a gallery-dl.conf in the same directory as the exefile should work.
Did you make sure that there are no hidden file extensions or something?

@rautamiekka
Copy link
Contributor

rautamiekka commented Aug 28, 2021

Can't say for sure but when I read the config.py code, there's no check for the config file where the binary is, so you can "bypass" that with:

--config config.json

, but it doesn't check for the file where the binary is, only the folder where your shell/terminal is currently; cd C:\Program Files while the binary is C:\Users\Public\gallery.exe fails without C:\Program Files\config.json.

But if you use drag-dropping, then it can be done like this (only by using a .bat):

--config "%~dp0config.json"

Notice that there's no \ cuz %~dp0 implicitly adds one, so config.json is the file.

^ Here's a Bash equivalent (Linux/WSL/etc.), and pretty sure it doesn't need a script file:

--config "$(dirname -- "${0}")/config.json"

@mikf
Copy link
Owner

mikf commented Aug 28, 2021

You might also want to prevent the cache file being written to %APPDATA%\gallery-dl\cache.sqlite3 by default. -o cache.file= would disable it completely (see cache.file).


when I read the config.py code, there's no check for the config file where the binary is
it doesn't check for the file where the binary is, only the folder where your shell/terminal is currently

It only checks in the same folder where the binary is:

if getattr(sys, "frozen", False):
# look for config file in PyInstaller executable directory (#682)
_default_configs.append(os.path.join(
os.path.dirname(sys.executable),
"gallery-dl.conf",
))

@the-nothingman
Copy link
Author

In the end I just deleted the old file and made a new one from scratch and it started working as intended. I have no idea what the bug was so I'm closing the issue.

@the-nothingman
Copy link
Author

I just figured out what was going wrong, for anyone checking out this in the future @rautamiekka is correct the binary doesn't check the folder it is in for the config file.

If for example you do what I did and you add a folder to PATH and place all the gallery-dl files within it and use right click open command line (not in that specific folder) then gallery-dl will ignore any config files. If you want to use the gallery-dl.conf in the same folder you have to open your terminal specifically in that folder

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

No branches or pull requests

4 participants