Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request .chapter-filter only download the newest X chapters. #149

Closed
CaptainJawZ opened this issue Jan 6, 2019 · 5 comments
Closed

Comments

@CaptainJawZ
Copy link

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

@Hrxn
Copy link
Contributor

Hrxn commented Jan 6, 2019

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:]

@CaptainJawZ
Copy link
Author

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.

@mikf
Copy link
Owner

mikf commented Jan 7, 2019

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.

mikf added a commit that referenced this issue Jan 7, 2019
Setting it to `true` will start with the latest chapter instead of the
first one.
@mikf
Copy link
Owner

mikf commented Jan 7, 2019

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",
		}

@CaptainJawZ
Copy link
Author

CaptainJawZ commented Jan 7, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants