Skip to content

Commit

Permalink
Last downloaded chapter (--cache)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carleslc committed Mar 10, 2020
1 parent a32e78a commit ca4962a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions manga.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,17 +344,18 @@ def online_search():

if args.cache:
all_chapters = [int(chapter[0]) for chapter in folders(directory)]
if args.chapters == 'last':
print_colored(f'Last downloaded chapter: {max(all_chapters)}', Fore.YELLOW, Style.BRIGHT);
else:
chapters_json = get(CHAPTERS_WEBSITE + uuid)
exit_if_fails(chapters_json)
chapters_full = load_json(chapters_json.content, 'data', 'result')
all_chapters = [int(chapter['Number']) for chapter in chapters_full]

last = max(all_chapters)
if args.cache:
print_colored(f'Last downloaded chapter: {last}', Fore.YELLOW, Style.BRIGHT);

if args.chapters:
args.chapters = args.chapters.replace(' ', '')
last = max(all_chapters)
parse_chapters_range(args.chapters, last)
else:
CHAPTERS.update(all_chapters)
Expand Down

0 comments on commit ca4962a

Please sign in to comment.