Skip to content

Commit

Permalink
Fix for #28
Browse files Browse the repository at this point in the history
Fix for #28 .Check the ReadMe for details
  • Loading branch information
Xonshiz committed Aug 24, 2017
1 parent 9d287df commit 5266dcd
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
- Fix for #36 [2017.07.24]
- Fix for #37 [2017.07.24]
- Fix for #30 [2017.08.23]
- Fix for #30 (mangahere.co) [2017.08.23]
- Fix for #30 (mangahere.co) [2017.08.23]
- Added support for CBZ file creation (#28) [2017.08.24]
2 changes: 1 addition & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Currently, the script supports these arguments :
--sorting Sorts the download order.(VALUES = asc, ascending,old,new,desc,descending,latest,new)
-dd,--download-directory Specifies custom download location for the comics/manga.
-rn,--range Selects the range of Chapters to download (Default = All) [ Ex : --range 1-10 (This will download first 10 episodes of a series)]
--convert Tells the script to convert the downloaded Images to PDF or anything else. (Supported Values : pdf) (Default : No) [By default, script will not convert anything.]
--convert Tells the script to convert the downloaded Images to PDF or anything else. (Supported Values : pdf, cbz) (Default : No) [By default, script will not convert anything.]
--keep Tells the script whether to keep the files after conversion or not. (Supported : No, False) (Default : Yes/True) [By default, images will be kept even after conversion.]
```
#### Note :
Expand Down
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.08.23.b"
__version__ = "2017.08.24"
26 changes: 25 additions & 1 deletion comic_dl/globalFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,31 @@ def conversion(self, directory_path, conversion, delete_files, comic_name, chapt
print(FileMoveError)
pass

elif str(conversion).lower().strip() in ['cbz']:
# Such kind of lambda functions and breaking is dangerous...

main_directory = str(directory_path).split('\\')
main_directory.pop()
cbz_directory = str('\\'.join(main_directory)) + '\\'

cbz_file_name = str(cbz_directory) + "{0} - Ch {1}".format(comic_name, chapter_number)

try:
shutil.make_archive(cbz_file_name, 'zip', directory_path)
os.rename(str(cbz_file_name) + ".zip", str(cbz_file_name).replace(".zip", ".cbz"))
except Exception as CBZError:
print("Coudn't write the cbz file...")
print(CBZError)
# Let's not delete the files if the conversion failed...
delete_files = "No"
pass
try:
self.conversion_cleaner(file_path=str(directory_path))
except Exception as FileMoveError:
print("Could not move the pdf file.")
print(FileMoveError)
pass

elif str(conversion) == "None":
pass
else:
Expand Down Expand Up @@ -160,4 +185,3 @@ def conversion_cleaner(self, file_path):
print("Couldn't move the file or delete the directory.")
print(FileDeleteError)
pass

3 changes: 2 additions & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
- Fix for #36 [2017.07.24]
- Fix for #37 [2017.07.24]
- Fix for #30 [2017.08.23]
- Fix for #30 (mangahere.co) [2017.08.23]
- Fix for #30 (mangahere.co) [2017.08.23]
- Added support for CBZ file creation (#28) [2017.08.24]
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Currently, the script supports these arguments :
--sorting Sorts the download order.(VALUES = asc, ascending,old,new,desc,descending,latest,new)
-dd,--download-directory Specifies custom download location for the comics/manga.
-rn,--range Selects the range of Chapters to download (Default = All) [ Ex : --range 1-10 (This will download first 10 episodes of a series)]
--convert Tells the script to convert the downloaded Images to PDF or anything else. (Supported Values : pdf) (Default : No) [By default, script will not convert anything.]
--convert Tells the script to convert the downloaded Images to PDF or anything else. (Supported Values : pdf, cbz) (Default : No) [By default, script will not convert anything.]
--keep Tells the script whether to keep the files after conversion or not. (Supported : No, False) (Default : Yes/True) [By default, images will be kept even after conversion.]
```
#### Note :
Expand Down

0 comments on commit 5266dcd

Please sign in to comment.