finished get_chapter_list function
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ivan Schaller 2021-12-19 21:59:39 +01:00
parent 3a5ccb7dd9
commit bb956e5198
2 changed files with 16 additions and 5 deletions

View file

@ -53,8 +53,6 @@ def mangadex_dlp(md_url='',md_chapters=None,md_dest='downloads',md_lang='en',md_
print('=========================================\n') print('=========================================\n')
exit(0) exit(0)
print('=========================================\n\n')
# check chapters to download if it not all # check chapters to download if it not all
chapters_to_download = [] chapters_to_download = []
if md_chapters.lower() == 'all': if md_chapters.lower() == 'all':
@ -62,6 +60,10 @@ def mangadex_dlp(md_url='',md_chapters=None,md_dest='downloads',md_lang='en',md_
else: else:
chapters_to_download = MdUtils.get_chapter_list(md_chapters) chapters_to_download = MdUtils.get_chapter_list(md_chapters)
# show chapters to download
print(f'Chapters selected:\n{", ".join(chapters_to_download)}')
print('=========================================\n')
# create manga folder # create manga folder
manga_path = Path(f'{md_dest}/{manga_title}') manga_path = Path(f'{md_dest}/{manga_title}')
manga_path.mkdir(parents=True, exist_ok=True) manga_path.mkdir(parents=True, exist_ok=True)
@ -87,7 +89,6 @@ def mangadex_dlp(md_url='',md_chapters=None,md_dest='downloads',md_lang='en',md_
chapter_path.mkdir(parents=True, exist_ok=True) chapter_path.mkdir(parents=True, exist_ok=True)
# download images # download images
print('------------------------------')
print(f'Downloading Chapter {chapter_num}') print(f'Downloading Chapter {chapter_num}')
print(f'DEBUG: Downloading Chapter {chapter}') print(f'DEBUG: Downloading Chapter {chapter}')
@ -110,5 +111,5 @@ def mangadex_dlp(md_url='',md_chapters=None,md_dest='downloads',md_lang='en',md_
exit(1) exit(1)
else: else:
print('Done\n') print('Done\n')
print('------------------------------\n')

View file

@ -26,6 +26,16 @@ def get_img_urls(manga_chapter_data):
def get_chapter_list(chapters): def get_chapter_list(chapters):
pass chapter_list = []
for chapter in chapters.split(','):
if '-' in chapter:
lower = chapter.split('-')[0]
upper = chapter.split('-')[1]
for n in range(int(lower), int(upper)+1):
chapter_list.append(str(n))
else:
chapter_list.append(chapter)
return chapter_list