From 29774ba8557cd241eb68e5f396976ad6ca1d28e4 Mon Sep 17 00:00:00 2001 From: shadlc Date: Fri, 15 Nov 2024 23:57:50 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=97=B6=E8=A3=85=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=9B=BE=E7=89=87=E6=A0=BC=E5=BC=8F=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DownloadManager.py | 1 - src/Episode.py | 19 +++++++++++++++++++ src/ui/PySide_src/mainWindow.ui | 10 +++++----- src/ui/PySide_src/mainWindow_ui.py | 18 +++++++++--------- src/ui/SettingUI.py | 25 ++++++++++++++++++++----- 5 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/DownloadManager.py b/src/DownloadManager.py index 31a7aef..f381da0 100644 --- a/src/DownloadManager.py +++ b/src/DownloadManager.py @@ -158,7 +158,6 @@ def __thread__EpisodeTask(self, curr_id: int, epi: Episode) -> None: img_url = img["complete_url"] else: img_url = img["url"] - img_url = re.sub(r"@[^?]*\?", "", img_url) match_cpx = re.search(r"[?&]cpx=([^&]*)", img_url) cpx = match_cpx.group(1) if match_cpx else "" img_path = epi.downloadImg(index, img_url, cpx) diff --git a/src/Episode.py b/src/Episode.py index ae908ca..c25a665 100644 --- a/src/Episode.py +++ b/src/Episode.py @@ -154,6 +154,25 @@ def _() -> list[dict]: ) return False + # ?########################################################### + # ? 配置图片下载格式 + img_format_list = { + "default": "", + "jpg": "@10000w.jpg", + "webp": "@10000w.webp", + "avif": "@10000w.avif", + "1700jpg": "@1700w.jpg", + "1400jpg": "@1400w.jpg", + "1100jpg": "@1100w.jpg", + "1700webp": "@1700w.webp", + "1400webp": "@1400w.webp", + "1700avif": "@1700w.avif", + "1400avif": "@1400w.avif", + "1100avif": "@1100w.avif", + } + img_format = self.mainGUI.getConfig("img_format") + imgs_urls = [img_url + img_format_list[img_format] for img_url in imgs_urls] + # ?########################################################### # ? 获取图片token ImageTokenURL = ( diff --git a/src/ui/PySide_src/mainWindow.ui b/src/ui/PySide_src/mainWindow.ui index c9f2b45..5b52b81 100644 --- a/src/ui/PySide_src/mainWindow.ui +++ b/src/ui/PySide_src/mainWindow.ui @@ -192,8 +192,8 @@ 0 0 - 524 - 191 + 98 + 28 @@ -1097,7 +1097,7 @@ li.checked::marker { content: "\2612"; } 0 - + 章节命名规则: @@ -1166,9 +1166,9 @@ li.checked::marker { content: "\2612"; } - + - 下载图片格式: + 请求图片格式: diff --git a/src/ui/PySide_src/mainWindow_ui.py b/src/ui/PySide_src/mainWindow_ui.py index bd0c63f..03292c3 100644 --- a/src/ui/PySide_src/mainWindow_ui.py +++ b/src/ui/PySide_src/mainWindow_ui.py @@ -146,7 +146,7 @@ def setupUi(self, MainWindow): self.scrollArea_myLibrary.setWidgetResizable(True) self.scrollAreaWidgetContents_myLibrary = QWidget() self.scrollAreaWidgetContents_myLibrary.setObjectName(u"scrollAreaWidgetContents_myLibrary") - self.scrollAreaWidgetContents_myLibrary.setGeometry(QRect(0, 0, 524, 191)) + self.scrollAreaWidgetContents_myLibrary.setGeometry(QRect(0, 0, 98, 28)) self.v_Layout_myLibrary = QVBoxLayout(self.scrollAreaWidgetContents_myLibrary) self.v_Layout_myLibrary.setObjectName(u"v_Layout_myLibrary") self.scrollArea_myLibrary.setWidget(self.scrollAreaWidgetContents_myLibrary) @@ -692,10 +692,10 @@ def setupUi(self, MainWindow): self.h_Layout_save_prefer = QHBoxLayout() self.h_Layout_save_prefer.setObjectName(u"h_Layout_save_prefer") self.h_Layout_save_prefer.setContentsMargins(0, 0, 0, 0) - self.label_img_format = QLabel(self.tab_setting) - self.label_img_format.setObjectName(u"label_img_format") + self.label_epi_rename_rule = QLabel(self.tab_setting) + self.label_epi_rename_rule.setObjectName(u"label_epi_rename_rule") - self.h_Layout_save_prefer.addWidget(self.label_img_format) + self.h_Layout_save_prefer.addWidget(self.label_epi_rename_rule) self.horizontalSpacer = QSpacerItem(20, 20, QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Minimum) @@ -715,10 +715,10 @@ def setupUi(self, MainWindow): self.h_Layout_save_prefer.addItem(self.horizontalSpacer_15) - self.label_epi_rename_rule = QLabel(self.tab_setting) - self.label_epi_rename_rule.setObjectName(u"label_epi_rename_rule") + self.label_img_format = QLabel(self.tab_setting) + self.label_img_format.setObjectName(u"label_img_format") - self.h_Layout_save_prefer.addWidget(self.label_epi_rename_rule) + self.h_Layout_save_prefer.addWidget(self.label_img_format) self.horizontalSpacer_14 = QSpacerItem(20, 20, QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Minimum) @@ -1025,13 +1025,13 @@ def retranslateUi(self, MainWindow): self.label_6.setText(QCoreApplication.translate("MainWindow", u"\u6587\u4ef6\u9644\u52a0\u4fe1\u606f\uff1a", None)) self.checkBox_exif_info.setText(QCoreApplication.translate("MainWindow", u"\u662f\u5426\u5728\u4fdd\u5b58\u6587\u4ef6\u5c5e\u6027\u4e2d\u8bb0\u5f55\u7ae0\u8282\u6807\u9898\u3001\u4f5c\u8005\u3001\u51fa\u7248\u793e\u7b49\u9644\u52a0\u4fe1\u606f", None)) self.checkBox_save_meta.setText(QCoreApplication.translate("MainWindow", u"\u662f\u5426\u521b\u5efa\u6f2b\u753b\u5143\u6570\u636e\u6587\u4ef6", None)) - self.label_img_format.setText(QCoreApplication.translate("MainWindow", u"\u7ae0\u8282\u547d\u540d\u89c4\u5219\uff1a", None)) + self.label_epi_rename_rule.setText(QCoreApplication.translate("MainWindow", u"\u7ae0\u8282\u547d\u540d\u89c4\u5219\uff1a", None)) self.comboBox_epi_rename_rule.setItemText(0, QCoreApplication.translate("MainWindow", u"\u77ed\u6807\u9898+\u957f\u6807\u9898", None)) self.comboBox_epi_rename_rule.setItemText(1, QCoreApplication.translate("MainWindow", u"\u5e8f\u53f7+\u957f\u6807\u9898", None)) self.comboBox_epi_rename_rule.setItemText(2, QCoreApplication.translate("MainWindow", u"\u5e8f\u53f7+\u77ed\u6807\u9898+\u957f\u6807\u9898", None)) self.comboBox_epi_rename_rule.setItemText(3, QCoreApplication.translate("MainWindow", u"3\u4f4d\u5e8f\u53f7+\u77ed\u6807\u9898+\u957f\u6807\u9898", None)) - self.label_epi_rename_rule.setText(QCoreApplication.translate("MainWindow", u"\u4e0b\u8f7d\u56fe\u7247\u683c\u5f0f\uff1a", None)) + self.label_img_format.setText(QCoreApplication.translate("MainWindow", u"\u8bf7\u6c42\u56fe\u7247\u683c\u5f0f\uff1a", None)) self.comboBox_img_format.setItemText(0, QCoreApplication.translate("MainWindow", u"\u539f\u59cb\u683c\u5f0f", None)) self.comboBox_img_format.setItemText(1, QCoreApplication.translate("MainWindow", u"\u5168\u5c3a\u5bf8jpg", None)) self.comboBox_img_format.setItemText(2, QCoreApplication.translate("MainWindow", u"\u5168\u5c3a\u5bf8webp", None)) diff --git a/src/ui/SettingUI.py b/src/ui/SettingUI.py index 5169e73..df184b3 100644 --- a/src/ui/SettingUI.py +++ b/src/ui/SettingUI.py @@ -402,7 +402,7 @@ def _(button: QRadioButton, checked: bool) -> None: if checked: self.mainGUI.updateConfig("save_method", button.text()) self.mainGUI.signal_information_box.emit( - "修改成功!重新解析章节后生效" + f"修改成功!重新解析章节后生效" ) for i in range(self.mainGUI.h_Layout_groupBox_save_method.count()): @@ -560,12 +560,12 @@ def _(rename_rule: str) -> None: ############################################################ def init_img_format_setting(self) -> None: - """绑定下载图片格式设置""" + """绑定请求图片格式设置""" img_format_list = { "default": "原始格式", - "10000jpg": "全尺寸jpg", - "10000webp": "全尺寸webp", - "10000avif": "全尺寸avif", + "jpg": "全尺寸jpg", + "webp": "全尺寸webp", + "avif": "全尺寸avif", "1700jpg": "1700宽jpg", "1400jpg": "1400宽jpg", "1100jpg": "1100宽jpg", @@ -582,6 +582,17 @@ def init_img_format_setting(self) -> None: def _(img_format: str) -> None: self.mainGUI.updateConfig("img_format", reversed_img_format_list[img_format]) + self.mainGUI.signal_information_box.emit( + f"已成功切换图片质量至 [{img_format}]!重新解析章节后生效\n" + f"注意!此设置对Biliplus不一定有效" + ) + if self.mainGUI.getConfig("save_method") == "PDF" and ( + img_format.endswith("webp") + or img_format.endswith("avif") + ): + self.mainGUI.signal_message_box.emit( + f"请注意!PDF格式保存时,非JPG格式文件会被二次压缩为JPG编码存入PDF", + ) self.mainGUI.comboBox_img_format.currentTextChanged.connect(_) @@ -596,6 +607,10 @@ def init_hash_check_setting(self) -> None: self.mainGUI.updateConfig("hash_check", True) def _(checked: bool) -> None: + if not checked: + self.mainGUI.signal_message_box.emit( + f"请注意!图片下载完整性校验已取消,可能会造成缺页与其它预料之外的严重问题!", + ) self.mainGUI.updateConfig("hash_check", checked) self.mainGUI.checkBox_hash_check.toggled.connect(_)