mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
add list of command-line options as docs/options.md (#3464)
This commit is contained in:
parent
4611237f8c
commit
7de6b7f489
9
Makefile
9
Makefile
@ -6,7 +6,7 @@ SHAREDIR ?= $(PREFIX)/share
|
||||
PYTHON ?= /usr/bin/env python3
|
||||
|
||||
|
||||
all: man completion supportedsites
|
||||
all: man completion supportedsites options
|
||||
|
||||
clean:
|
||||
$(RM) -r build/
|
||||
@ -30,11 +30,16 @@ man: data/man/gallery-dl.1 data/man/gallery-dl.conf.5
|
||||
|
||||
supportedsites: docs/supportedsites.md
|
||||
|
||||
.PHONY: all clean install release test executable completion man supportedsites
|
||||
options: docs/options.md
|
||||
|
||||
.PHONY: all clean install release test executable completion man supportedsites options
|
||||
|
||||
docs/supportedsites.md: gallery_dl/*/*.py scripts/supportedsites.py
|
||||
$(PYTHON) scripts/supportedsites.py
|
||||
|
||||
docs/options.md: gallery_dl/option.py scripts/options.py
|
||||
$(PYTHON) scripts/options.py
|
||||
|
||||
data/man/gallery-dl.1: gallery_dl/option.py gallery_dl/version.py scripts/man.py
|
||||
$(PYTHON) scripts/man.py
|
||||
|
||||
|
363
docs/options.md
Normal file
363
docs/options.md
Normal file
@ -0,0 +1,363 @@
|
||||
# Command-Line Options
|
||||
|
||||
<!-- auto-generated by scripts/options.py -->
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th width="26%"></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
|
||||
<tr>
|
||||
<td colspan="4"><strong>General Options</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-h</code></td>
|
||||
<td><code>--help</code></td>
|
||||
<td>Print this help message and exit</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--version</code></td>
|
||||
<td>Print program version and exit</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-i</code></td>
|
||||
<td><code>--input-file</code></td>
|
||||
<td>Download URLs found in FILE (<code>-</code> for stdin). More than one --input-file can be specified</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-d</code></td>
|
||||
<td><code>--destination</code></td>
|
||||
<td>Target location for file downloads</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-D</code></td>
|
||||
<td><code>--directory</code></td>
|
||||
<td>Exact location for file downloads</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-f</code></td>
|
||||
<td><code>--filename</code></td>
|
||||
<td>Filename format string for downloaded files (<code>/O</code> for "original" filenames)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--proxy</code></td>
|
||||
<td>Use the specified proxy</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--source-address</code></td>
|
||||
<td>Client-side IP address to bind to</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--user-agent</code></td>
|
||||
<td>User-Agent request header</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--clear-cache</code></td>
|
||||
<td>Delete cached login sessions, cookies, etc. for MODULE (ALL to delete everything)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--cookies</code></td>
|
||||
<td>File to load additional cookies from</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--cookies-from-browser</code></td>
|
||||
<td>Name of the browser to load cookies from, with optional keyring name prefixed with <code>+</code>, profile prefixed with <code>:</code>, and container prefixed with <code>::</code> (<code>none</code> for no container)</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4"><strong>Output Options</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-q</code></td>
|
||||
<td><code>--quiet</code></td>
|
||||
<td>Activate quiet mode</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-v</code></td>
|
||||
<td><code>--verbose</code></td>
|
||||
<td>Print various debugging information</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-g</code></td>
|
||||
<td><code>--get-urls</code></td>
|
||||
<td>Print URLs instead of downloading</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-G</code></td>
|
||||
<td><code>--resolve-urls</code></td>
|
||||
<td>Print URLs instead of downloading; resolve intermediary URLs</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-j</code></td>
|
||||
<td><code>--dump-json</code></td>
|
||||
<td>Print JSON information</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-s</code></td>
|
||||
<td><code>--simulate</code></td>
|
||||
<td>Simulate data extraction; do not download anything</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-E</code></td>
|
||||
<td><code>--extractor-info</code></td>
|
||||
<td>Print extractor defaults and settings</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-K</code></td>
|
||||
<td><code>--list-keywords</code></td>
|
||||
<td>Print a list of available keywords and example values for the given URLs</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--list-modules</code></td>
|
||||
<td>Print a list of available extractor modules</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--list-extractors</code></td>
|
||||
<td>Print a list of extractor classes with description, (sub)category and example URL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--write-log</code></td>
|
||||
<td>Write logging output to FILE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--write-unsupported</code></td>
|
||||
<td>Write URLs, which get emitted by other extractors but cannot be handled, to FILE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--write-pages</code></td>
|
||||
<td>Write downloaded intermediary pages to files in the current directory to debug problems</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4"><strong>Downloader Options</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-r</code></td>
|
||||
<td><code>--limit-rate</code></td>
|
||||
<td>Maximum download rate (e.g. 500k or 2.5M)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-R</code></td>
|
||||
<td><code>--retries</code></td>
|
||||
<td>Maximum number of retries for failed HTTP requests or -1 for infinite retries (default: 4)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--http-timeout</code></td>
|
||||
<td>Timeout for HTTP connections (default: 30.0)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--sleep</code></td>
|
||||
<td>Number of seconds to wait before each download. This can be either a constant value or a range (e.g. 2.7 or 2.0-3.5)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--sleep-request</code></td>
|
||||
<td>Number of seconds to wait between HTTP requests during data extraction</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--sleep-extractor</code></td>
|
||||
<td>Number of seconds to wait before starting data extraction for an input URL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--filesize-min</code></td>
|
||||
<td>Do not download files smaller than SIZE (e.g. 500k or 2.5M)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--filesize-max</code></td>
|
||||
<td>Do not download files larger than SIZE (e.g. 500k or 2.5M)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--chunk-size</code></td>
|
||||
<td>Size of in-memory data chunks (default: 32k)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--no-part</code></td>
|
||||
<td>Do not use .part files</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--no-skip</code></td>
|
||||
<td>Do not skip downloads; overwrite existing files</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--no-mtime</code></td>
|
||||
<td>Do not set file modification times according to Last-Modified HTTP response headers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--no-download</code></td>
|
||||
<td>Do not download any files</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--no-postprocessors</code></td>
|
||||
<td>Do not run any post processors</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--no-check-certificate</code></td>
|
||||
<td>Disable HTTPS certificate validation</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4"><strong>Configuration Options</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-c</code></td>
|
||||
<td><code>--config</code></td>
|
||||
<td>Additional configuration files</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-o</code></td>
|
||||
<td><code>--option</code></td>
|
||||
<td>Additional <code><key>=<value></code> option values</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--ignore-config</code></td>
|
||||
<td>Do not read default configuration files</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4"><strong>Authentication Options</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-u</code></td>
|
||||
<td><code>--username</code></td>
|
||||
<td>Username to login with</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-p</code></td>
|
||||
<td><code>--password</code></td>
|
||||
<td>Password belonging to the given username</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--netrc</code></td>
|
||||
<td>Enable .netrc authentication data</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4"><strong>Selection Options</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--download-archive</code></td>
|
||||
<td>Record all downloaded or skipped files in FILE and skip downloading any file already in it</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-A</code></td>
|
||||
<td><code>--abort</code></td>
|
||||
<td>Stop current extractor run after N consecutive file downloads were skipped</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-T</code></td>
|
||||
<td><code>--terminate</code></td>
|
||||
<td>Stop current and parent extractor runs after N consecutive file downloads were skipped</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--range</code></td>
|
||||
<td>Index range(s) specifying which files to download. These can be either a constant value, range, or slice (e.g. <code>5</code>, <code>8-20</code>, or <code>1:24:3</code>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--chapter-range</code></td>
|
||||
<td>Like <code>--range</code>, but applies to manga chapters and other delegated URLs</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--filter</code></td>
|
||||
<td>Python expression controlling which files to download. Files for which the expression evaluates to False are ignored. Available keys are the filename-specific ones listed by <code>-K</code>. Example: --filter "image_width >= 1000 and rating in (<code>s</code>, <code>q</code>)"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--chapter-filter</code></td>
|
||||
<td>Like <code>--filter</code>, but applies to manga chapters and other delegated URLs</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4"><strong>Post-processing Options</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--zip</code></td>
|
||||
<td>Store downloaded files in a ZIP archive</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--ugoira-conv</code></td>
|
||||
<td>Convert Pixiv Ugoira to WebM (requires FFmpeg)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--ugoira-conv-lossless</code></td>
|
||||
<td>Convert Pixiv Ugoira to WebM in VP9 lossless mode</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--ugoira-conv-copy</code></td>
|
||||
<td>Convert Pixiv Ugoira to MKV without re-encoding any frames</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--write-metadata</code></td>
|
||||
<td>Write metadata to separate JSON files</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--write-info-json</code></td>
|
||||
<td>Write gallery metadata to a info.json file</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--write-tags</code></td>
|
||||
<td>Write image tags to separate text files</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--mtime-from-date</code></td>
|
||||
<td>Set file modification times according to <code>date</code> metadata</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--exec</code></td>
|
||||
<td>Execute CMD for each downloaded file. Example: --exec <code>convert {} {}.png && rm {}</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><code>--exec-after</code></td>
|
||||
<td>Execute CMD after all files were downloaded successfully. Example: --exec-after <code>cd {} && convert * ../doc.pdf</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-P</code></td>
|
||||
<td><code>--postprocessor</code></td>
|
||||
<td>Activate the specified post processor</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
77
scripts/options.py
Executable file
77
scripts/options.py
Executable file
@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2023 Mike Fährmann
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
"""Generate a Markdown document listing gallery-dl's command-line arguments"""
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
import util
|
||||
from gallery_dl import option
|
||||
|
||||
|
||||
TEMPLATE = """# Command-Line Options
|
||||
|
||||
<!-- auto-generated by {} -->
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th width="26%"></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
{}
|
||||
</tbody>
|
||||
</table>
|
||||
"""
|
||||
|
||||
|
||||
tbody = []
|
||||
append = tbody.append
|
||||
sub = re.compile(r"'([^']+)'").sub
|
||||
|
||||
for group in option.build_parser()._action_groups[2:]:
|
||||
|
||||
append('\n<tr>\n <td colspan="3"><strong>' +
|
||||
group.title + '</strong></td>\n</tr>')
|
||||
|
||||
for action in group._group_actions:
|
||||
help = action.help
|
||||
if help == "==SUPPRESS==":
|
||||
continue
|
||||
|
||||
try:
|
||||
short, long = action.option_strings
|
||||
except ValueError:
|
||||
try:
|
||||
long = action.option_strings[0]
|
||||
except IndexError:
|
||||
continue
|
||||
short = ""
|
||||
|
||||
if short:
|
||||
short = "<code>" + short + "</code>"
|
||||
if long:
|
||||
long = '<code>' + long + "</code>"
|
||||
|
||||
append("<tr>")
|
||||
append(" <td>" + short + "</td>")
|
||||
append(" <td>" + long + "</td>")
|
||||
append(" <td>" + sub("<code>\\1</code>", help) + "</td>")
|
||||
append("</tr>")
|
||||
|
||||
|
||||
with open(util.path("docs", "options.md"), "w", encoding="utf-8") as fp:
|
||||
fp.write(TEMPLATE.format(
|
||||
"/".join(os.path.normpath(__file__).split(os.sep)[-2:]),
|
||||
"\n".join(tbody),
|
||||
))
|
Loading…
Reference in New Issue
Block a user