-
-
Notifications
You must be signed in to change notification settings - Fork 976
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
Access environment variables with format strings #1968
Comments
Not sure, I mean adding UUID generation would probably not be much of a thing, but isn't this something that's best handled by your shell? Simply use a short script to call gallery-dl, and you can easily access any UUID from within. In bash, you can either use |
I do have a wrapper script for this, it would just be nice to have access to such a value internally, to use for building file paths and passing to post-processor scripts. Essentially as a job ID I can use in my paths to separate out files generated by individual runs of gallery-dl. Perhaps this would be better implemented as allowing you to reference environment variables in format strings, so I can set/use any variable I want easily from the shell. Something like |
You can add custom entries to each metadata dict with the But you are right, having access to environment variables and other data in format strings would be nice. |
Ah my bad, I totally missed that in the docs. The docs say Does the |
Any extractor option can be used as
Just This is all somewhat described here.
Most can. Output options and something highly specific like |
The docs doesn't seem to mention the existence of a global namespace/scope though, might be a good idea to update it to something like this:
And then perhaps options could specify the "scope" they are valid at. |
So, basically something like gallery-dl's Path type, which already should support environment variable expansion, except not only for paths? |
Yeah, well, maybe not directly, but it clearly explains the specificity of the settings for the configuration file. Calling it a global namespace, while correct, might be a bit misleading, so this is something that could be considered. But here's this part of the main README that mentions setting options on the command-line overrides any settings defined per configuration, just like what is considered usual best practice for all CLI apps. |
I thought of doing it more like
Also, if any of you have a better suggestion for the option name, I'm all ears. |
{_env[HOME]} to get the value of $HOME every other format string feature is supported as well
Oh my god, thank you. This is going to be super useful. |
So yeah, environment variable access is now possible in all format strings and without enabling any options with Adding a UUID/GUID ( |
Sweet! This will simplify a lot of things, thank you. |
When downloading files and/or running exec scripts, it would be nice to have some kind of guaranteed unique value tied to a specific call of
gallery-dl
.Ideally, each run would generate a GUID and make it accessible with something like
{_instance}
(like other values in the exec post-processor).Additionally, a field containing a
datetime
of whengallery-dl
was called would be nice too.The text was updated successfully, but these errors were encountered: