haha
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
dist/多多自动化发文助手.exe
vendored
BIN
dist/多多自动化发文助手.exe
vendored
Binary file not shown.
15
gui_app.py
15
gui_app.py
@@ -1721,10 +1721,16 @@ class MainWindow(QMainWindow):
|
||||
cell_compare = cell_text.lower()
|
||||
if all(term in cell_compare for term in terms_lower):
|
||||
matching_indices.append(i)
|
||||
self.filtered_config_indices = matching_indices
|
||||
only_match = self.table_only_match.isChecked() if hasattr(self, 'table_only_match') and self.table_only_match else False
|
||||
if only_match:
|
||||
# 仅显示匹配项:只显示匹配的数据,表格行数=当前页数据行,不出现空行或其它数据
|
||||
self.filtered_config_indices = matching_indices
|
||||
else:
|
||||
# 显示全部,只做高亮
|
||||
self.filtered_config_indices = None
|
||||
self.current_page = 1
|
||||
self.update_table()
|
||||
# 当前页均为匹配行,应用高亮
|
||||
# 高亮当前页中的匹配单元格(仅显示匹配项时当前页全是匹配行;显示全部时只高亮匹配的格)
|
||||
for row in range(self.config_table.rowCount()):
|
||||
for col in range(self.config_table.columnCount()):
|
||||
if column_index >= 0 and col != column_index:
|
||||
@@ -2912,8 +2918,9 @@ class MainWindow(QMainWindow):
|
||||
# 临时禁用排序,防止填充数据时自动排序打乱顺序
|
||||
self.config_table.setSortingEnabled(False)
|
||||
|
||||
# 计算实际显示行数:数据行数和最小行数取最大值
|
||||
display_rows = max(len(self.page_row_indices), min_display_rows)
|
||||
# 筛选时只显示当前页数据行,不预留空行,避免“仅显示匹配项”时仍看到多余行
|
||||
is_filtered = getattr(self, 'filtered_config_indices', None) is not None
|
||||
display_rows = len(self.page_row_indices) if is_filtered else max(len(self.page_row_indices), min_display_rows)
|
||||
self.config_table.setRowCount(display_rows)
|
||||
|
||||
# 先统一设置行高,再填数据,避免后设行高导致勾选框列布局重算、出现“除第一行外往下移”
|
||||
|
||||
@@ -90,17 +90,17 @@ class WorkerThread(QThread):
|
||||
prepared_image_folders=prepared_image_folders,
|
||||
collect_all_videos=False
|
||||
)
|
||||
ok = bool(result.get("ok")) if isinstance(result, dict) else True
|
||||
ok = bool(result.get("ok")) if isinstance(result, dict) else False
|
||||
reason = result.get("reason", "未知原因") if isinstance(result, dict) else "未返回结果"
|
||||
if not ok:
|
||||
self.log_message.emit(f"失败原因: {result.get('reason') if isinstance(result, dict) else ''}")
|
||||
if isinstance(result, dict):
|
||||
self.item_result.emit({
|
||||
"user_id": config.get("多多id", ""),
|
||||
"index": config.get("序号", ""),
|
||||
"name": config.get("标题", "") or "",
|
||||
"ok": ok,
|
||||
"reason": result.get("reason", ""),
|
||||
})
|
||||
self.log_message.emit(f"失败原因: {reason}")
|
||||
self.item_result.emit({
|
||||
"user_id": config.get("多多id", ""),
|
||||
"index": config.get("序号", ""),
|
||||
"name": config.get("标题", "") or "",
|
||||
"ok": ok,
|
||||
"reason": reason,
|
||||
})
|
||||
self.progress.emit(100)
|
||||
self.finished.emit(ok, f"单个任务执行完成(ok={ok})")
|
||||
except Exception as e:
|
||||
@@ -130,17 +130,17 @@ class WorkerThread(QThread):
|
||||
|
||||
try:
|
||||
result = pdd.action(folder_path=folder_path, collect_all_videos=is_batch_mode)
|
||||
ok = bool(result.get("ok")) if isinstance(result, dict) else True
|
||||
ok = bool(result.get("ok")) if isinstance(result, dict) else False
|
||||
reason = result.get("reason", "未知原因") if isinstance(result, dict) else "未返回结果"
|
||||
if not ok:
|
||||
self.log_message.emit(f"失败原因: {result.get('reason') if isinstance(result, dict) else ''}")
|
||||
if isinstance(result, dict):
|
||||
self.item_result.emit({
|
||||
"user_id": config.get("多多id", ""),
|
||||
"index": config.get("序号", ""),
|
||||
"name": config.get("标题", "") or "",
|
||||
"ok": ok,
|
||||
"reason": result.get("reason", ""),
|
||||
})
|
||||
self.log_message.emit(f"失败原因: {reason}")
|
||||
self.item_result.emit({
|
||||
"user_id": config.get("多多id", ""),
|
||||
"index": config.get("序号", ""),
|
||||
"name": config.get("标题", "") or "",
|
||||
"ok": ok,
|
||||
"reason": reason,
|
||||
})
|
||||
except Exception as e:
|
||||
error_msg = f"执行action方法失败: {str(e)}"
|
||||
self.log_message.emit(error_msg)
|
||||
@@ -209,7 +209,7 @@ class WorkerThread(QThread):
|
||||
self.log_message.emit(f" 回调处理异常: {e}")
|
||||
|
||||
result = pdd.action1(folder_path=video_file_paths, on_item_done=on_video_done)
|
||||
ok = bool(result.get("ok")) if isinstance(result, dict) else True
|
||||
ok = bool(result.get("ok")) if isinstance(result, dict) else False
|
||||
if not ok:
|
||||
fails = [r for r in (result.get("results") or []) if not r.get("ok")]
|
||||
self.log_message.emit(f"发布校验失败条数: {len(fails)}")
|
||||
|
||||
22
main.py
22
main.py
@@ -597,10 +597,11 @@ class Pdd:
|
||||
|
||||
logger.info("等待上传完成...")
|
||||
while True:
|
||||
# if creator_tab.ele("x://div[contains(text(), '视频上传成功')]", timeout=3):
|
||||
if creator_tab.ele('x://*[contains(., "视频上传成功")]', timeout=3):
|
||||
print(1)
|
||||
break
|
||||
if creator_tab.ele('x://*[contains(., "视频上传失败")]', timeout=3):
|
||||
logger.warning("检测到页面提示「视频上传失败」,退出并标记为失败")
|
||||
return {"ok": False, "reason": "视频上传失败"}
|
||||
time.sleep(5)
|
||||
|
||||
# 输入视频描述(只输入第一个视频的描述,因为批量上传后可能需要单独处理每个视频)
|
||||
@@ -1132,6 +1133,23 @@ class Pdd:
|
||||
):
|
||||
break
|
||||
|
||||
if video_container.ele('x://*[contains(., "视频上传失败")]', timeout=3):
|
||||
logger.warning(f"检测到视频 {video_name} 上传失败,退出并标记该条为失败")
|
||||
result_item = {
|
||||
"index": str(video_info.get("index", "")),
|
||||
"path": str(video_path),
|
||||
"name": video_name,
|
||||
"ok": False,
|
||||
"reason": "视频上传失败",
|
||||
}
|
||||
results.append(result_item)
|
||||
if on_item_done and callable(on_item_done):
|
||||
try:
|
||||
on_item_done(result_item)
|
||||
except Exception:
|
||||
pass
|
||||
return {"ok": False, "results": results, "reason": "视频上传失败"}
|
||||
|
||||
logger.warning(f" ✗ 视频 {video_name} 还在上传中,跳过处理")
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user