diff --git a/Download_Novel.py b/Download_Novel.py
index c58e48f..a3b8a9b 100644
--- a/Download_Novel.py
+++ b/Download_Novel.py
@@ -196,6 +196,7 @@ class Download_Novel:
time.sleep(self.interval)
+ # 标志位 0 为
file = 0
# 判断是否全部下载成功
for i in range(0, len(self.chapter_urls)):
@@ -203,7 +204,14 @@ class Download_Novel:
if not status:
file += 1
break
- if not file:
+ if file:
+ print('部分文件下载失败,限制线程数可以提高下载成功率,是否重新下载个别文件?')
+ download = input('0 退出\n1 重试\n')
+ if download == 0:
+ exit(0)
+ else:
+ self.download_process()
+ else:
convert_type = int(input('下载成功!\n请输入要合并的格式:\n0 TxT文件\n1 Epub文件\n'))
convert_status = True
if convert_type == 0:
@@ -214,7 +222,7 @@ class Download_Novel:
txt_files = []
for n in range(0, len(self.chapter_urls)):
txt_files.append(self.file_path + str(n) + '.txt')
- # print('txt_files:',txt_files)
+
convert_status = self.merge_txt_to_epub(txt_files, self.download_path + self.title + '.epub')
if convert_status:
@@ -223,13 +231,6 @@ class Download_Novel:
print('合并失败!请删除downloads下面目录后重新运行程序!')
exit(1)
- else:
- print('部分文件下载失败,限制线程数可以提高下载成功率,是否重新下载个别文件?')
- download = input('0 退出\n1 重试\n')
- if download == 0:
- exit(0)
- else:
- self.download_process()
# 合并为txt文件
def merge_txt_file(self, merged_file_name=''):
@@ -285,7 +286,8 @@ class Download_Novel:
book.set_title(self.title)
book.set_language('zh')
book.add_author(self.author)
- book.set_direction(self.intro)
+ book.add_metadata('DC', 'description', self.intro)
+
# 添加封面
# 获取图片并将其转换为字节流
response = requests.get(self.cover)
@@ -296,10 +298,8 @@ class Download_Novel:
print('合并中。。。。。。')
# print(txt_files)
- # 书籍目录
- book_spine = []
# 遍历所有txt文件
- # os.chdir(title)
+ # book.spine.append('nav')
for i, txt_file in enumerate(txt_files):
# 读取txt文件内容
with open(txt_file, 'r', encoding='utf-8') as file:
@@ -314,10 +314,12 @@ class Download_Novel:
# content = [' ' + line + '
' for line in content]
# 处理html文档
- content[0] = f"""
' + line + '
\n' + + # content.append('