From 6f8ea112c6b26ba8fb6ded667a04131dbba50336 Mon Sep 17 00:00:00 2001 From: nimaid Date: Tue, 7 Jul 2020 16:06:27 -0700 Subject: [PATCH] Almost ready for a new release --- Example PDF.pdf | Bin 16470 -> 16459 bytes README.md | 51 ++++++++++++++++++++++++------------------------ bookdir2pdf.py | 13 +++++++----- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/Example PDF.pdf b/Example PDF.pdf index def86ece479d406d4c338e8f7c45b8b2f2fbb5c2..5e3470010c2674b3ac020a4ffa2776c2755f5fe1 100644 GIT binary patch delta 1441 zcmZuxyHP_y3>*RoUKLK9>#tKrf>S!7g>wnaPzXaEWCUdN!ad`${cdsO*(Yfw?drad zcb~_**RPMC_v#`$T7SEj-E#Uvq#l4-5nv$(Sb77j6>u=gA4k6-W)2`>DW40nDaLtV zT#m7(;kfB0uCL#@5&~tQbFxq-U|g^*5!;Zg9HN1_#vPO08At*rk=#ylBFP4lNNWo9 zO3#w?tL~}-U8^P(RA(qSECU*A80JQ8bJzWACK5L^msUVQBW%V9J!6cLm`L_{H72OB z8Ev~BO`ADlj*^%+7|!D2g?>3ZOU3CXx2_s{HCS~JY8?NpKXTr}*nb*>Gt(LFxN$>F z8eGXZcc@n+kXwp3>4693kBsiDd_xrA2&%wTJ8`9BtS}l3v5n+ka7~vK?MaDp`_t$2ub!0 zTdgeHW6zA=+v@0Zb@cLaK3gvD=eJMtFu%EI#^dICF<;K^8eKmgpS^xPd#Bn`|Fw&@ z+58Y`Ob`pi5Q`chmZC$<2{4%S7o$4>W=;UYO0jOpW|$We<|W3wY=gY6-L=)DUbXXjs07%45Bn>y&fFuV=B)dUBx2+`IUUyZ6sZ}#H)F9AM zLjsL82CPjqtnK+P%ph<^bEzk2XoSNUqi2j!5);i`O^pd^T>Lhix(sa=F&0n~3l7U! z+?\/*: and also means you can make a really long name like this without hitting the path le -ngth limit of your OS) -Page #2 The First Part -Page #2 --- Chapter 1 -Page #4 --- Chapter 2 -Page #6 The Middle Part -Page #6 --- Chapter 3 -Page #8 --- Chapter 4 -Page #10 The Final Part -Page #10 --- Chapter 5 -Page #12 --- Chapter 6 +test_dir - Table of Contents +---------------------------- +Page #1 00. Cover Page +Page #2 --- 01. Empty Directory Example +Page #2 --- --- 01. Nested Empty Directory Level 1 +Page #2 --- --- --- 01. Nested Empty Directory Level 2 +Page #2 --- --- --- --- 01. Nested Empty Directory Level 3 +Page #2 Empty Directory .name File Example (allows for forbidden characters like <>?\/*: and also means you can make a really long name like this without hitting the path length limit of your OS) +Page #2 02. The First Part +Page #2 --- 01. Chapter 1 +Page #4 --- 02. Chapter 2 +Page #6 03. The Middle Part +Page #6 --- 01. Chapter 3 +Page #8 --- 02. Chapter 4 +Page #10 04. The Final Part +Page #10 --- 01. Chapter 5 +Page #12 --- 02. Chapter 6 + Page count: 13 + +... [output removed] ... ``` \ No newline at end of file diff --git a/bookdir2pdf.py b/bookdir2pdf.py index 050b8cb..66646c5 100644 --- a/bookdir2pdf.py +++ b/bookdir2pdf.py @@ -196,7 +196,8 @@ def get_valid_filename(s): else: print("PDF author: {}".format(pdf_author)) -print("PDF resolution: {} DPI".format(pdf_dpi)) +if not args["table_of_contents"]: + print("PDF resolution: {} DPI".format(pdf_dpi)) print("Input directory: {}".format(input_dir)) @@ -401,6 +402,8 @@ def get_valid_filename(s): # Update page_list with new images/paths page_list = new_page_list + + print("\tDone purifying images!") # Make page_list but with only files page_list_files = [p for p in page_list if os.path.isfile(p)] @@ -419,7 +422,6 @@ def get_valid_filename(s): current_level[part] = OrderedDict() current_level = current_level[part] -print("\tDone purifying images!") # Create PDF from page_list(no bookmarks) @@ -447,9 +449,10 @@ def get_valid_filename(s): print() -print("-------- BOOKMARK CREATION --------") -print("Table of Contents will be printed as bookmarks are created.") -print() +if not args["table_of_contents"]: + print("-------- BOOKMARK CREATION --------") + print("Table of Contents will be printed as bookmarks are created.") + print() # Get ToC title toc_title = pdf_title