Gallery-dl: Feature request .chapter-filter only download the newest X chapters.

Created on 6 Jan 2019  路  5Comments  路  Source: mikf/gallery-dl

I dont know if this is a feature already implemented or not, I want to for example download the newest 3 chapters of each manga on a list.
I've tried -3, 3, 3-, etc. But it wont just download the last 3 from the array

feature-request question

Most helpful comment

Done. Set chapter-reverse to true and chapter-range to 1-3 to only download the 3 newest chapters from any manga:

"kissmanga":
        {
            "chapter-reverse": true,
            "chapter-range": "1-3",
        }

All 5 comments

chapter-filter relies on a working Python expression and the metadata provided by the site, like provided by --list-keywords.
Posting your cli input would probably help here. If this is indeed only a question about accessing elements from an array, something like this could maybe work: array_name[-3:]

Hello, I'm trying to figure out how to make this work, when I use --list-keywords it prints the following:

Keywords for --chapter-filter:
------------------------------
chapter
  0
chapter_id
  401738
chapter_minor

chapter_string
  _Special - Sins on Vacation
lang
  en
language
  English
manga
  Nanatsu no Taizai
title
  _Special - Sins on Vacation
volume
  0

However I can't quite figure out what to do with this information
This is how I have configured my .json file

"kissmanga":
        {
            "directory": ["{manga}", "{manga}_{chapter}"],
            "chapter-range": "i[-1:]",
            "postprocessors":
            [
                {
                    "name": "zip",
                    "compression": "store",
                    "extension": "cbz",
                    "keep-files": false
                }
            ]
        },

Since you mentioned the CLI input, I guess the workaround this would be to download the manga directly from the console which I am sure I can figure out how to make a batch file that cycles through the links.

However I am unable to figure out how to use those tags to create an array of chapters.

Any help would be greatly appreciated.

There is currently no way to get the last 3 chapters of a manga - in general, at least.

If you know the last chapter number you downloaded, lets say 40, you can use --chapter-filter "chapter > 40", meaning "get everything with a chapter number greater than 40", but that obviously doesn't work if you have a whole list of manga URls. The chapter variable here is the same chapter field you have in the output of --list-keywords, by the way.

The chapter-range option you are using in your config file accepts only ranges in the form <start>-<end> (for example 2-4, meaning item 2 to 4 in the list of all chapters). There are no negative indices allowed and you can't specify anything like "the last 3 items", only "the first 3" with 1-3 or -3.

Possible solutions to implement:

  • An options to reverse the chapter order.
    Currently all chapters are listed from first to last. Reversing it would turn --chapter-range 1-3 into "get the last 3 items".
  • Add a chapter_max field as metadata representing the highest available chapter number. You could then do --chapter-filter "chapter >= chapter_max - 3" to get the latest 3 chapters.
  • Python's array slice syntax for (chapter-)range arguments, so "chapter-range": "[-3:]" would actually be valid.

I guess I'll go with the first one for right now. Should be the easiest one to implement.
The last one might be a bit too much, but maybe I'll implement something like that for v2.0.0.

Done. Set chapter-reverse to true and chapter-range to 1-3 to only download the 3 newest chapters from any manga:

"kissmanga":
        {
            "chapter-reverse": true,
            "chapter-range": "1-3",
        }

Thank you so much! godbless! It works just as I wanted!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

biznizz picture biznizz  路  4Comments

Mrakobes666 picture Mrakobes666  路  6Comments

TestPolygon picture TestPolygon  路  3Comments

indrakaw picture indrakaw  路  4Comments

lyz-code picture lyz-code  路  6Comments