Skip to content

Config File Outline

HRXN edited this page Apr 5, 2022 · 26 revisions

The structure of the gallery-dl configuration file

Configuration files for gallery-dl use a JSON-based file format.

First steps

  • If you're not familiar with it: Configuration file introduction from gallery-dl's official README.
  • Handling a JSON file: The JSON format is actually very simple.
    • Every somewhat decent text editor, no matter your operating system, should be able to handle it. You don't need explicit support for JSON, but having JSON syntax highlighting etc. definitely helps a lot.
  • "My local text editor sucks!": There is an online (in-browser) version of the cross-platform editor VS Code.
    • https://vscode.dev/
    • Simply open a new file there (Main Menu (upper left corner), select File > New File), and set the Language Mode to JSON (Click on the field in the lower right corner, that says Plain Text by default, to change this), et voilà, you are ready to go!
  • Online tools to validate a JSON text: too many to list all, probably. But some examples:
The options of gallery-dl can be specified on multiple levels of the configuration tree:
Base level: extractor.<option-name>
Category level: extractor.<category>.<option-name>
Subcategory level: extractor.<category>.<subcategory>.<option-name>

Some Examples to demonstrate the layout of a config file

Empty
All Sections, including some basic options
{
    "extractor":
    {
        "base-directory": "~/gallery-dl/",
        "archive": "~/gallery-dl/archive.sqlite3",

        "keywords": {"bkey": "", "ckey": ""},
        "keywords-default": "",

        "path-restrict": {
            "\\": "",
            "/" : "",
            "|" : "",
            ":" : "",
            "*" : "",
            "?" : "",
            "\"": "",
            "<" : "",
            ">" : ""
        },

        "postprocessors": [
            {
                "name": "metadata",
                "mode": "tags",
                "whitelist": ["danbooru", "moebooru", "sankaku"]
            }
        ],




        "#": "All Extractor settings belong here"





    },

    "downloader":
    {

    },

    "output":
    {

    },

    "postprocessor":
    {

    }

}
Explanations for the options listed above: