Skip to content

Commit

Permalink
✨ 实现 exif 设置相关逻辑;更新版权信息
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeal-L committed Feb 27, 2024
1 parent ad26bd0 commit bf3f5eb
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 21 deletions.
15 changes: 9 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from PySide6.QtWidgets import QApplication, QMessageBox

from src.ui.MainGUI import MainGUI
from src.Utils import __main_window_title__
from src.Utils import __main_window_title__, logger

if __name__ == "__main__":
app = QApplication.instance() or QApplication(argv)
Expand All @@ -21,7 +21,7 @@
)
exit(0)
elif platform == "darwin":
script = '''
script = """
set windowTitle to "{}"
tell application "System Events"
set listOfProcesses to every process whose visible is true
Expand All @@ -34,15 +34,18 @@
end repeat
end tell
return false
'''.format(__main_window_title__)
""".format(__main_window_title__)

try:
output = subprocess.check_output(["osascript", "-e", script], text=True).strip()
if output == "true":
QMessageBox.information(None, "提示", "有一个我已经不满足不了你吗?\n\t...(。•ˇ‸ˇ•。) ...")
exit(0)
QMessageBox.information(
None, "提示", "有一个我已经不满足不了你吗?\n\t...(。•ˇ‸ˇ•。) ..."
)
exit(1)
except subprocess.CalledProcessError as e:
print("Error executing AppleScript:", e)
logger.error("检查是否有重复窗口时出错:", e)
exit(1)

window = MainGUI(app)
window.show()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "一个好用的哔哩哔哩漫画下载器,拥有图形界面
license = "AGPL-3.0"
name = "bilibili-manga-downloader"
readme = "README.md"
version = "1.5.0"
version = "1.5.1"

[tool.poetry.dependencies]
beautifulsoup4 = "^4.12.2"
Expand Down
16 changes: 10 additions & 6 deletions src/Episode.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(
self.imgs_token = None
self.author = comic_info["author_name"]
self.save_method = mainGUI.getConfig("save_method")
self.exif_setting = mainGUI.getConfig("exif")

if self.save_method == "Cbz压缩包":
self.comicinfoxml = ComicInfoXML(comic_info, episode)
Expand Down Expand Up @@ -291,6 +292,8 @@ def _() -> None:
img.close()

# 在pdf文件属性中记录章节标题作者和软件版本以及版权信息
if not self.exif_setting:
return
with open(f"{self.epi_path}.pdf", "rb") as f:
pdf = PdfReader(f)
pdf_writer = PdfWriter()
Expand Down Expand Up @@ -351,12 +354,13 @@ def jpg_exif(img_path: str):
img_format = img_path.split(".")[-1]

# 将 exif 数据插入到图像文件中, 如果插入失败则跳过
try:
if img_format == "jpg":
jpg_exif(img_path)
except piexif.InvalidImageDataError as e:
logger.warning(f"Failed to insert exif data for {img_path}: {e}")
logger.exception(e)
if self.exif_setting:
try:
if img_format == "jpg":
jpg_exif(img_path)
except piexif.InvalidImageDataError as e:
logger.warning(f"Failed to insert exif data for {img_path}: {e}")
logger.exception(e)

# 复制图片到文件夹
shutil.copy2(
Expand Down
4 changes: 2 additions & 2 deletions src/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
from ui.MainGUI import MainGUI

__app_name__ = "BiliBili-Manga-Downloader"
__version__ = "1.5.0"
__version__ = "1.5.1"
__author__ = "Zeal L"
__copyright__ = "Copyright (C) 2023 Zeal L"
__copyright__ = "Copyright (C) 2023-2024 Zeal L"
__main_window_title__ = f"哔哩哔哩漫画下载器 v{__version__}"

############################################################
Expand Down
2 changes: 1 addition & 1 deletion src/ui/PySide_src/myAbout.ui
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<item>
<widget class="QLabel" name="outline">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:16pt; font-weight:700; color:#00aaff;&quot;&gt;哔哩哔哩&lt;/span&gt;&lt;span style=&quot; font-size:16pt; font-weight:700;&quot;&gt;漫画下载器 &lt;/span&gt;&lt;span style=&quot; font-size:16pt; font-weight:700; color:#aa00ff;&quot;&gt;v1.5.0&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:700;&quot;&gt;作者:Zeal-L&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:700;&quot;&gt;项目地址:&lt;/span&gt;&lt;a href=&quot;https://github.com/Zeal-L/BiliBili-Manga-Downloader&quot;&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/Zeal-L/BiliBili-Manga-Downloader&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:700;&quot;&gt;本程序仅供学习交流使用,严禁用于商业用途&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:16pt; font-weight:700; color:#00aa00;&quot;&gt;联系方式:&lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:700;&quot;&gt;Q群号:&lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:700; color:#aa00ff;&quot;&gt;244029317&lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:700;&quot;&gt;&lt;br/&gt;欢迎进群讨论程序,漫画,资源分享, 提交问题等等&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt; font-weight:700;&quot;&gt;-- LICENSE --&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;BiliBili-Manga-Downloader&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;Copyright (C) 2023 Zeal L&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;You should have received a copy of the GNU Affero General Public License along with this program. If not, see &lt;/span&gt;&lt;a href=&quot;https://www.gnu.org/licenses&quot;&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://www.gnu.org/licenses&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:16pt; font-weight:700; color:#00aaff;&quot;&gt;哔哩哔哩&lt;/span&gt;&lt;span style=&quot; font-size:16pt; font-weight:700;&quot;&gt;漫画下载器 &lt;/span&gt;&lt;span style=&quot; font-size:16pt; font-weight:700; color:#aa00ff;&quot;&gt;v1.5.1&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:700;&quot;&gt;作者:Zeal-L&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:700;&quot;&gt;项目地址:&lt;/span&gt;&lt;a href=&quot;https://github.com/Zeal-L/BiliBili-Manga-Downloader&quot;&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/Zeal-L/BiliBili-Manga-Downloader&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:700;&quot;&gt;本程序仅供学习交流使用,严禁用于商业用途&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:16pt; font-weight:700; color:#00aa00;&quot;&gt;联系方式:&lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:700;&quot;&gt;Q群号:&lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:700; color:#aa00ff;&quot;&gt;244029317&lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:700;&quot;&gt;&lt;br/&gt;欢迎进群讨论程序,漫画,资源分享, 提交问题等等&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt; font-weight:700;&quot;&gt;-- LICENSE --&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;BiliBili-Manga-Downloader&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;Copyright (C) &lt;/span&gt;2023-2024 &lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;Zeal L&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;You should have received a copy of the GNU Affero General Public License along with this program. If not, see &lt;/span&gt;&lt;a href=&quot;https://www.gnu.org/licenses&quot;&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://www.gnu.org/licenses&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'HYWenHei-85W'; font-size:12pt;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/PySide_src/myAbout_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def setupUi(self, My_about):
def retranslateUi(self, My_about):
My_about.setWindowTitle(QCoreApplication.translate("My_about", u"Form", None))
self.label.setText("")
self.outline.setText(QCoreApplication.translate("My_about", u"<html><head/><body><p align=\"center\"><span style=\" font-size:16pt; font-weight:700; color:#00aaff;\">\u54d4\u54e9\u54d4\u54e9</span><span style=\" font-size:16pt; font-weight:700;\">\u6f2b\u753b\u4e0b\u8f7d\u5668 </span><span style=\" font-size:16pt; font-weight:700; color:#aa00ff;\">v1.5.0</span></p><p align=\"center\"><span style=\" font-size:14pt; font-weight:700;\">\u4f5c\u8005\uff1aZeal-L</span></p><p align=\"center\"><span style=\" font-size:12pt; font-weight:700;\">\u9879\u76ee\u5730\u5740\uff1a</span><a href=\"https://github.com/Zeal-L/BiliBili-Manga-Downloader\"><span style=\" font-size:12pt; text-decoration: underline; color:#0000ff;\">https://github.com/Zeal-L/BiliBili-Manga-Downloader</span></a></p><p align=\"center\"><span style=\" font-size:12pt; font-weight:700;\">\u672c\u7a0b\u5e8f\u4ec5\u4f9b\u5b66\u4e60\u4ea4\u6d41\u4f7f\u7528\uff0c\u4e25\u7981\u7528\u4e8e\u5546\u4e1a\u7528\u9014</span></p><p align=\"center\"><span style=\" font-size:16pt; font-weight:700; color:#00aa00;\">\u8054\u7cfb\u65b9"
"\u5f0f\uff1a</span><span style=\" font-size:12pt; font-weight:700;\">Q\u7fa4\u53f7\uff1a</span><span style=\" font-size:12pt; font-weight:700; color:#aa00ff;\">244029317</span><span style=\" font-size:12pt; font-weight:700;\"><br/>\u6b22\u8fce\u8fdb\u7fa4\u8ba8\u8bba\u7a0b\u5e8f\uff0c\u6f2b\u753b\uff0c\u8d44\u6e90\u5206\u4eab, \u63d0\u4ea4\u95ee\u9898\u7b49\u7b49</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt; font-weight:700;\">-- LICENSE --</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">BiliBili-Manga-Downloader</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">Copyright (C) 2023 Zeal L</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ("
"at your option) any later version.</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">You should have received a copy of the GNU Affero General Public License along with this program. If not, see </span><a href=\"https://www.gnu.org/licenses\"><span style=\" font-size:12pt; text-decoration: underline; color:#0000ff;\">https://www.gnu.org/licenses</span></a><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">.</span></p><p><br/></p></body></html>", None))
self.outline.setText(QCoreApplication.translate("My_about", u"<html><head/><body><p align=\"center\"><span style=\" font-size:16pt; font-weight:700; color:#00aaff;\">\u54d4\u54e9\u54d4\u54e9</span><span style=\" font-size:16pt; font-weight:700;\">\u6f2b\u753b\u4e0b\u8f7d\u5668 </span><span style=\" font-size:16pt; font-weight:700; color:#aa00ff;\">v1.5.1</span></p><p align=\"center\"><span style=\" font-size:14pt; font-weight:700;\">\u4f5c\u8005\uff1aZeal-L</span></p><p align=\"center\"><span style=\" font-size:12pt; font-weight:700;\">\u9879\u76ee\u5730\u5740\uff1a</span><a href=\"https://github.com/Zeal-L/BiliBili-Manga-Downloader\"><span style=\" font-size:12pt; text-decoration: underline; color:#0000ff;\">https://github.com/Zeal-L/BiliBili-Manga-Downloader</span></a></p><p align=\"center\"><span style=\" font-size:12pt; font-weight:700;\">\u672c\u7a0b\u5e8f\u4ec5\u4f9b\u5b66\u4e60\u4ea4\u6d41\u4f7f\u7528\uff0c\u4e25\u7981\u7528\u4e8e\u5546\u4e1a\u7528\u9014</span></p><p align=\"center\"><span style=\" font-size:16pt; font-weight:700; color:#00aa00;\">\u8054\u7cfb\u65b9"
"\u5f0f\uff1a</span><span style=\" font-size:12pt; font-weight:700;\">Q\u7fa4\u53f7\uff1a</span><span style=\" font-size:12pt; font-weight:700; color:#aa00ff;\">244029317</span><span style=\" font-size:12pt; font-weight:700;\"><br/>\u6b22\u8fce\u8fdb\u7fa4\u8ba8\u8bba\u7a0b\u5e8f\uff0c\u6f2b\u753b\uff0c\u8d44\u6e90\u5206\u4eab, \u63d0\u4ea4\u95ee\u9898\u7b49\u7b49</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt; font-weight:700;\">-- LICENSE --</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">BiliBili-Manga-Downloader</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">Copyright (C) </span>2023-2024 <span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">Zeal L</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as publish"
"ed by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.</span></p><p align=\"center\"><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">You should have received a copy of the GNU Affero General Public License along with this program. If not, see </span><a href=\"https://www.gnu.org/licenses\"><span style=\" font-size:12pt; text-decoration: underline; color:#0000ff;\">https://www.gnu.org/licenses</span></a><span style=\" font-family:'HYWenHei-85W'; font-size:12pt;\">.</span></p><p><br/></p></body></html>", None))
# retranslateUi

18 changes: 16 additions & 2 deletions src/ui/SettingUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __init__(self, mainGUI: MainGUI):
self.init_saveMethod()
self.init_checkUpdate()
self.init_theme()
self.init_exif_setting()
self.qr_ui = QrCodeUI()

############################################################
Expand Down Expand Up @@ -314,7 +315,7 @@ def init_num_thread(self) -> None:
mainGUI (MainGUI): 主窗口类实例
"""

if self.mainGUI.getConfig("num_thread"):
if self.mainGUI.getConfig("num_thread") is not None:
self.mainGUI.h_Slider_num_thread.setValue(self.mainGUI.getConfig("num_thread"))
else:
self.mainGUI.updateConfig("num_thread", self.mainGUI.h_Slider_num_thread.value())
Expand Down Expand Up @@ -369,7 +370,7 @@ def _() -> None:
############################################################
def init_saveMethod(self) -> None:
"""绑定保存方式设置"""
if self.mainGUI.getConfig("save_method"):
if self.mainGUI.getConfig("save_method") is not None:
for i in range(self.mainGUI.h_Layout_groupBox_save_method.count()):
button: QRadioButton = self.mainGUI.h_Layout_groupBox_save_method.itemAt(i).widget()
if button.text() == self.mainGUI.getConfig("save_method"):
Expand Down Expand Up @@ -482,3 +483,16 @@ def _(text: str) -> None:

if self.mainGUI.comboBox_theme_style.currentText() == "默认":
self.mainGUI.comboBox_theme_density.setEnabled(False)

############################################################

def init_exif_setting(self) -> None:
if self.mainGUI.getConfig("exif") is not None:
self.mainGUI.checkBox_exif_info.setChecked(self.mainGUI.getConfig("exif"))
else:
self.mainGUI.updateConfig("exif", True)

def _(checked: bool) -> None:
self.mainGUI.updateConfig("exif", checked)

self.mainGUI.checkBox_exif_info.toggled.connect(_)

0 comments on commit bf3f5eb

Please sign in to comment.