minor improvements

This commit is contained in:
Liangliang Zhu
2023-01-16 23:38:49 +08:00
parent 529c095ae8
commit cfff424a32
2 changed files with 5 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# download selected books for cli
def download_selected_books(kindle, options):
# get all books and get the default device
print('Getting all books, please wait...')
books = kindle.get_all_books(filetype=options.filetype)
device = kindle.find_device()
@@ -52,7 +53,8 @@ def download_selected_books(kindle, options):
# decode the range
idx_begin, idx_end = [int(i) for i in idx.split(':')]
# append the range to downlist
[downlist.append(i) for i in range(idx_begin-1, idx_end)]
extend_list = [i for i in range(idx_begin-1, idx_end)]
downlist.extend(extend_list)
else:
# if is not a number, and no ":" in it, then it is an error
print('Input error, please input numbers!!!')
@@ -61,7 +63,7 @@ def download_selected_books(kindle, options):
else:
# if is a number, then append it to downlist
downlist.append(int(idx)-1)
if flag == False:
if not flag:
continue
# remove the duplicate indices

View File

@@ -2,7 +2,7 @@ import random
from kindle_download_helper.user_agents import USER_AGENTS
DEFAULT_OUT_DIR = "tmp"
DEFAULT_OUT_DIR = "DOWNLOADS"
DEFAULT_OUT_DEDRM_DIR = "DEDRMS"
DEFAULT_SESSION_FILE = ".kindle_session"