Skip to content

Commit

Permalink
Fix for #30
Browse files Browse the repository at this point in the history
Fix for #30
  • Loading branch information
Xonshiz committed Aug 23, 2017
1 parent 05b5cbe commit 090b8bc
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 8 deletions.
2 changes: 1 addition & 1 deletion comic_dl/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

__version__ = "2017.07.24"
__version__ = "2017.08.23"
9 changes: 9 additions & 0 deletions comic_dl/sites/acQQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ def single_chapter(self, comic_url, comic_name, download_directory, conversion,

for image_link in img_list:
file_name = "0" + str(img_list.index(image_link)) + "." + str(image_link).split(".")[-1]
if len(str(file_name)) < len(str(img_list[-1])):
number_of_zeroes = len(str(img_list[-1])) - len(str(file_name))
# If a chapter has only 9 images, we need to avoid 0*0 case.
if len(str(number_of_zeroes)) == 0:
file_name = str(img_list.index(image_link)) + "." + str(image_link).split(".")[-1]
else:
file_name = "0" * int(number_of_zeroes) + str(img_list.index(image_link)) + "." + str(image_link).split(".")[-1]
else:
file_name = str(img_list.index(image_link)) + "." + str(image_link).split(".")[-1]
logging.debug("image_link : %s" % image_link)
globalFunctions.GlobalFunctions().downloader(image_link, file_name, comic_url, directory_path,
log_flag=self.logging)
Expand Down
11 changes: 10 additions & 1 deletion comic_dl/sites/comicNaver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ def single_chapter(self, comic_url, comic_name, download_directory, conversion,
for link in image_list:
# link = link.replace("\\", "")
# file_name = str(link).split("/")[-1].strip()
file_name = "0" + str(image_list.index(link)) + ".jpg" # 0 for #18 (Leading 0s)
file_name = "0" + str(image_list.index(link)) + ".jpg"
if len(str(file_name)) < len(str(image_list[-1])):
number_of_zeroes = len(str(image_list[-1])) - len(str(file_name))
# If a chapter has only 9 images, we need to avoid 0*0 case.
if len(str(number_of_zeroes)) == 0:
file_name = str(image_list.index(link)) + ".jpg"
else:
file_name = "0" * int(number_of_zeroes) + str(image_list.index(link)) + ".jpg"
else:
file_name = str(image_list.index(link)) + ".jpg"
globalFunctions.GlobalFunctions().downloader(link, file_name, comic_url, directory_path,
log_flag=self.logging)

Expand Down
17 changes: 14 additions & 3 deletions comic_dl/sites/foolSlide.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,20 @@ def single_chapter(self, chapter_url, comic_name, download_directory, conversion

for link in img_links:
link = link.replace("\\", "")
file_name = "0" + str(link).split("/")[-1].strip()
globalFunctions.GlobalFunctions().downloader(link, file_name, chapter_url, directory_path,
log_flag=self.logging)
#file_name = "0" + str(link).split("/")[-1].strip()
file_count = str(str(link).split("/")[-1]).strip().replace(".jpg", "").replace(".png", "")
print("File Count : {0}".format(file_count))
if len(str(file_count)) < len(str(img_links[-1])):
number_of_zeroes = len(str(img_links[-1])) - len(str(file_count))
# If a chapter has only 9 images, we need to avoid 0*0 case.
if len(str(number_of_zeroes)) == 0:
file_name = str(img_links.index(link)) + ".jpg"
else:
file_name = "0" * int(number_of_zeroes) + str(img_links.index(link)) + ".jpg"
else:
file_name = str(img_links.index(link)) + ".jpg"
# globalFunctions.GlobalFunctions().downloader(link, file_name, chapter_url, directory_path,
# log_flag=self.logging)

globalFunctions.GlobalFunctions().conversion(directory_path, conversion, delete_files, comic_name,
chapter_number)
Expand Down
13 changes: 11 additions & 2 deletions comic_dl/sites/mangaFox.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def single_chapter(self, comic_url, comic_name, download_directory, conversion,
os.makedirs(directory_path)

for file_name in range(current_page_number, last_page_number + 1):
# print("Actual file_name : {0}".format(file_name))
# http://mangafox.me/manga/colette_wa_shinu_koto_ni_shita/v03/c019/2.html
chapter_url = "http://mangafox.me/manga/" + str(series_code) + "/" + str(
current_chapter_volume) + "/%s.html" % str(file_name)
Expand All @@ -66,8 +67,16 @@ def single_chapter(self, comic_url, comic_name, download_directory, conversion,
x = link.findAll('img')
for a in x:
image_link = a['src']

file_name = "0" + str(file_name) + ".jpg"
# Fix for 30 (File Naming 0's)
if len(str(file_name)) < len(str(last_page_number)):
number_of_zeroes = len(str(last_page_number)) - len(str(file_name))
# If a chapter has only 9 images, we need to avoid 0*0 case.
if len(str(number_of_zeroes)) == 0:
file_name = str(file_name) + ".jpg"
else:
file_name = "0"*int(number_of_zeroes) + str(file_name) + ".jpg"
else:
file_name = str(file_name) + ".jpg"
logging.debug("Image Link : %s" % image_link)
globalFunctions.GlobalFunctions().downloader(image_link, file_name, chapter_url, directory_path,
log_flag=self.logging)
Expand Down
14 changes: 13 additions & 1 deletion comic_dl/sites/readcomicOnlineto.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,22 @@ def single_chapter(self, comic_url, comic_name, download_directory, conversion,

globalFunctions.GlobalFunctions().info_printer(comic_name, chapter_number)

image_len = len(image_list)
for link in image_list:
link = link.replace("\\", "")
# file_name = str(link).split("/")[-1].strip()
file_name = "0" + str(image_list.index(link)) + ".jpg"
#file_name = "0" + str(image_list.index(link)) + ".jpg"

if len(str(image_list.index(link))) < len(str(image_len)):
number_of_zeroes = len(str(image_len)) - len(str(image_list.index(link)))
# If a chapter has only 9 images, we need to avoid 0*0 case.
if len(str(number_of_zeroes)) == 0:
file_name = str(image_list.index(link)) + ".jpg"
else:
file_name = "0" * int(number_of_zeroes) + str(image_list.index(link)) + ".jpg"
else:
file_name = str(image_list.index(link)) + ".jpg"

logging.debug("Image Link : %s" % link)
globalFunctions.GlobalFunctions().downloader(link, file_name, comic_url, directory_path)

Expand Down

0 comments on commit 090b8bc

Please sign in to comment.