Skip to content
This repository was archived by the owner on Dec 17, 2023. It is now read-only.

feat: added range chapter selection #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manga_livre_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ def main():
'--chapter-selection',
nargs = '+',
default = ['all'],
help = 'Chapter selection. Can be "all", "last" or a list of chapters'
help = 'Chapter selection. Can be "all", "last", a list of chapters or range "init-end"'
)
parser.add_argument(
'-f',
2 changes: 2 additions & 0 deletions manga_livre_dl/manga_livre_dl.py
Original file line number Diff line number Diff line change
@@ -48,6 +48,8 @@ def get_manga_chapters(self, url, chapter_selection):
count += 1
if chapter_selection[0] == 'last':
manga_chapters = [manga_chapters[-1]]
elif len((range_chapters := chapter_selection[0].split('-'))) > 1:
manga_chapters = [manga_chapter for manga_chapter in manga_chapters if manga_chapter['number'] in [str(x) for x in range(int(range_chapters[0]), int(range_chapters[-1])+1)]]
elif chapter_selection[0] != 'all':
manga_chapters = [manga_chapter for manga_chapter in manga_chapters if manga_chapter['number'] in chapter_selection]
if not manga_chapters: