mikf / gallery-dl

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

Passing arguments to the postprocessor #5693

Closed qqtpi closed 3 weeks ago

qqtpi commented 3 weeks ago

Hello, I'm using a python postprocessor like this:

"postprocessors": [
    {
        "name": "python",
        "function": "my_file.py:my_function"
    }
def my_function(kwargs):
    pass

I would like to pass custom command line args and catch them - for example: gallery-dl "some_site.com" --postprocessor-option "print_tags"=1

def my_function(kwargs):
    if kwargs["print_tags"]:
        print(kwargs["tags"])

Is something like this possible?

mikf commented 3 weeks ago

Kind of. You can use -o keywords.print_tags=1 to add a print_tags value to each metadata dict like kwargs.