implement conditional directories (#1394)

They work the same way as conditional filenames (84d2e640), e.g.

"directory": {
    "score >= 20": ["high score"],
    "score >= 5" : ["mid score"],
    ""           : ["{category}", "default"]
}
This commit is contained in:
Mike Fährmann
2021-06-20 19:44:12 +02:00
parent ee1064a2b2
commit fd00d47116
4 changed files with 76 additions and 27 deletions

View File

@@ -60,7 +60,7 @@ extractor.*.filename
Type
``string`` or ``object``
Example
* .. code::
* .. code:: json
"{manga}_c{chapter}_{page:>03}.{extension}"
@@ -115,11 +115,25 @@ Description
extractor.*.directory
---------------------
Type
``list`` of ``strings``
``list`` of ``strings`` or ``object``
Example
``["{category}", "{manga}", "c{chapter} - {title}"]``
* .. code:: json
["{category}", "{manga}", "c{chapter} - {title}"]
* .. code:: json
{
"'nature' in content": ["Nature Pictures"],
"retweet_id != 0" : ["{category}", "{user[name]}", "Retweets"],
"" : ["{category}", "{user[name]}"]
}
Description
A list of `format strings`_ for the resulting target directory.
A list of `format strings`_ to build target directory paths with.
If this is an ``object``, it must contain Python expressions mapping to the
list of format strings to use.
Each individual string in such a list represents a single path
segment, which will be joined together and appended to the