Skip to content

Commit

Permalink
v9.3.9
Browse files Browse the repository at this point in the history
1、cg_rename修改为Qt5框架
2、修复cg_rename引用
3、修复番号打开网页
  • Loading branch information
cgkings committed Dec 15, 2024
1 parent 639ddf5 commit dc6bcc9
Show file tree
Hide file tree
Showing 4 changed files with 557 additions and 392 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ jobs:
# 首先构建 cg_crop
pyinstaller --name "cg_crop" --onefile --noconsole --icon="chuizi.ico" --add-data "chuizi.ico;." --add-data "Img;Img" "cg_crop.py"
# 确保临时目录存在
New-Item -ItemType Directory -Force -Path "temp"
# # 确保临时目录存在
# New-Item -ItemType Directory -Force -Path "temp"
# 将 cg_crop.exe 复制到临时目录,供 NFO.Editor 使用
Copy-Item -Path "dist/cg_crop.exe" -Destination "temp/cg_crop.exe"
# # 将 cg_crop.exe 复制到临时目录
# Copy-Item -Path "dist/cg_crop.exe" -Destination "temp/cg_crop.exe"
# 构建 NFO.Editor
pyinstaller --name "NFO.Editor" --onefile --noconsole --icon="chuizi.ico" --add-data "chuizi.ico;." --add-data "mapping_actor.xml;." --add-data "Img;Img" --exclude-module matplotlib --exclude-module numpy --exclude-module pandas --clean --hidden-import xml.etree.ElementTree --hidden-import xml.dom.minidom "NFO.Editor.py"
# # 构建 NFO.Editor
# pyinstaller --name "NFO.Editor" --onefile --noconsole --icon="chuizi.ico" --add-data "chuizi.ico;." --add-data "mapping_actor.xml;." --add-data "Img;Img" --exclude-module matplotlib --exclude-module numpy --exclude-module pandas --clean --hidden-import xml.etree.ElementTree --hidden-import xml.dom.minidom "NFO.Editor.py"
# 构建 NFO.Editor.Qt5
pyinstaller --name "NFO.Editor.Qt5" --onefile --noconsole --icon="chuizi.ico" --add-data "chuizi.ico;." --add-data "mapping_actor.xml;." --add-data "Img;Img" --exclude-module matplotlib --exclude-module numpy --exclude-module pandas --clean --hidden-import xml.etree.ElementTree --hidden-import xml.dom.minidom "NFO.Editor.Qt5.py"
pyinstaller --name "NFO.Editor.Qt5" --onefile --noconsole --icon="chuizi.ico" --add-data "chuizi.ico;." --add-data "mapping_actor.xml;." --add-data "Img;Img" "NFO.Editor.Qt5.py"
# 构建 cg_rename
pyinstaller --name "cg_rename" --onefile --noconsole --icon="chuizi.ico" --add-data "chuizi.ico;." --add-data "mapping_actor.xml;." "cg_rename.py"
Expand All @@ -74,14 +74,14 @@ jobs:
pyinstaller --name "cg_dedupe" --onefile --noconsole --icon="chuizi.ico" --add-data "chuizi.ico;." "cg_dedupe.py"
# 重命名生成的文件
Move-Item -Path "dist/NFO.Editor.exe" -Destination "dist/NFO.Editor.${{ env.BUILD_NAME }}.exe" -Force
# Move-Item -Path "dist/NFO.Editor.exe" -Destination "dist/NFO.Editor.${{ env.BUILD_NAME }}.exe" -Force
Move-Item -Path "dist/NFO.Editor.Qt5.exe" -Destination "dist/NFO.Editor.Qt5.${{ env.BUILD_NAME }}.exe" -Force
Move-Item -Path "dist/cg_crop.exe" -Destination "dist/cg_crop.${{ env.BUILD_NAME }}.exe" -Force
Move-Item -Path "dist/cg_rename.exe" -Destination "dist/cg_rename.${{ env.BUILD_NAME }}.exe" -Force
Move-Item -Path "dist/cg_dedupe.exe" -Destination "dist/cg_dedupe.${{ env.BUILD_NAME }}.exe" -Force
# 清理临时文件
Remove-Item -Path "temp" -Recurse -Force
# # 清理临时文件
# Remove-Item -Path "temp" -Recurse -Force
- name: 创建 Release
id: create_release
Expand All @@ -92,7 +92,7 @@ jobs:
draft: false
prerelease: false
files: |
dist/NFO.Editor.${{ env.BUILD_NAME }}.exe
# dist/NFO.Editor.${{ env.BUILD_NAME }}.exe
dist/NFO.Editor.Qt5.${{ env.BUILD_NAME }}.exe
dist/cg_crop.${{ env.BUILD_NAME }}.exe
dist/cg_rename.${{ env.BUILD_NAME }}.exe
Expand Down
51 changes: 44 additions & 7 deletions NFO.Editor.Qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ def setup_signals(self):
# 添加筛选输入框回车键响应
self.filter_entry.returnPressed.connect(self.apply_filter)

# 为番号标签添加点击事件
if "num" in self.fields_entries:
num_label = self.fields_entries["num"]
num_label.mousePressEvent = lambda event: self.open_number_search(event)

def eventFilter(self, obj, event):
"""事件过滤器"""
if (
Expand Down Expand Up @@ -462,6 +467,19 @@ def load_nfo_fields(self):
except Exception as e:
QMessageBox.critical(self, "错误", f"加载NFO文件失败: {str(e)}")

def open_number_search(self, event):
"""打开番号搜索网页"""
if event.button() == Qt.LeftButton: # 只响应左键点击
num_text = self.fields_entries["num"].text().strip()
if num_text:
try:
# 打开JavDB搜索
webbrowser.open(f"https://javdb.com/search?q={num_text}&f=all")
# 打开JavTrailers搜索
webbrowser.open(f"https://javtrailers.com/search/{num_text}")
except Exception as e:
QMessageBox.warning(self, "警告", f"打开网页失败: {str(e)}")

def load_target_files(self, target_path):
"""加载目标文件夹内容"""
self.sorted_tree.clear()
Expand Down Expand Up @@ -1254,19 +1272,38 @@ def open_batch_rename_tool(self):
return

try:
# 使用subprocess启动独立进程
import subprocess
import sys
# 检查目录是否存在
if not os.path.isdir(self.folder_path):
QMessageBox.critical(self, "错误", f"目录不存在: {self.folder_path}")
return

# 获取 Python 解释器路径
# 获取Python解释器路径
python_executable = sys.executable

# 构建命令
# 构建重命名工具脚本路径
rename_script = os.path.join(os.path.dirname(__file__), "cg_rename.py")

# 检查脚本文件是否存在
if not os.path.exists(rename_script):
QMessageBox.critical(self, "错误", "找不到重命名工具脚本(cg_rename.py)")
return

# 构建命令
cmd = [python_executable, rename_script, self.folder_path]

# 启动独立进程
subprocess.Popen(cmd)
# 启动独立进程,并捕获可能的启动错误
try:
process = subprocess.Popen(
cmd,
creationflags=subprocess.CREATE_NO_WINDOW if os.name == "nt" else 0,
)

# 可选:检查进程是否成功启动
if process.poll() is not None: # 如果进程立即退出
QMessageBox.warning(self, "警告", "重命名工具可能未正常启动")

except subprocess.SubprocessError as se:
raise Exception(f"启动进程失败: {se}")

except Exception as e:
QMessageBox.critical(self, "错误", f"启动重命名工具时出错: {str(e)}")
Expand Down
2 changes: 1 addition & 1 deletion NFO_Editor_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self):
self.screen_dpi = self.screen().logicalDotsPerInch()
self.scale_factor = self.screen_dpi / 96.0

self.setWindowTitle("大锤 NFO Editor Qt v9.3.8")
self.setWindowTitle("大锤 NFO Editor Qt v9.3.9")
self.resize(1280, 800)

try:
Expand Down
Loading

0 comments on commit dc6bcc9

Please sign in to comment.