일단 저장
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
import UtilPack as util
|
||||
import DataClass_Pupil as pupil
|
||||
@@ -235,15 +234,12 @@ class MyApp(QMainWindow):
|
||||
btn_ChkDuplicate.clicked.connect(self.on_btn_Validate_clicked)
|
||||
btn_Archive = QPushButton("압축 및 데이터 저장")
|
||||
btn_Archive.clicked.connect(self.on_btn_Archive_clicked)
|
||||
btn_EnterCalibre = QPushButton("컬리버에 삽입")
|
||||
btn_EnterCalibre.clicked.connect(self.on_btn_EnterCalibre_clicked)
|
||||
btn_MakeDownList = QPushButton("다운로드 목록 생성")
|
||||
btn_MakeDownList.clicked.connect(self.on_btn_MakeDownList_clicked)
|
||||
btn_EnterCalibre = QPushButton(".Download 리스트 작성")
|
||||
btn_EnterCalibre.clicked.connect(self.on_btn_MakeDownList_clicked)
|
||||
|
||||
layout_mid.addWidget(btn_ChkDuplicate)
|
||||
layout_mid.addWidget(btn_Archive)
|
||||
layout_mid.addWidget(btn_EnterCalibre)
|
||||
layout_mid.addWidget(btn_MakeDownList)
|
||||
|
||||
self.tableWidget_Src = QTableWidget()
|
||||
self.tableWidget_Src.verticalHeader().setVisible(False)
|
||||
@@ -583,53 +579,10 @@ class MyApp(QMainWindow):
|
||||
|
||||
|
||||
#
|
||||
def on_btn_EnterCalibre_clicked(self):
|
||||
def on_btn_MakeDownList_clicked(self):
|
||||
pass
|
||||
|
||||
#
|
||||
def on_btn_MakeDownList_clicked(self):
|
||||
folder_path = QFileDialog.getExistingDirectory(self, '폴더 선택', '')
|
||||
if util.IsEmptyStr(folder_path):
|
||||
return
|
||||
|
||||
result = {}
|
||||
listDirs = util.ListChildDirectories(folder_path)
|
||||
for item in listDirs:
|
||||
pathDir = os.path.join(folder_path, item)
|
||||
if not os.path.isdir(pathDir):
|
||||
continue
|
||||
|
||||
metadataPath = os.path.join(pathDir, ".metadata")
|
||||
if not os.path.exists(metadataPath):
|
||||
continue
|
||||
|
||||
data = pupil.PupilData(metadataPath)
|
||||
if data.m_data is None:
|
||||
continue
|
||||
|
||||
title = data.GetTitle()
|
||||
strID = data.GetHitomiID()
|
||||
if util.IsEmptyStr(strID):
|
||||
strID = util.GetTextInBrakets(item)[0]
|
||||
|
||||
nImgListLen = data.GetImgFileCount()
|
||||
nImgFileCnt = len(util.ListContainFiles(pathDir))
|
||||
|
||||
if nImgFileCnt <= 0 or nImgListLen <= 0 or nImgFileCnt != nImgListLen:
|
||||
if not util.IsEmptyStr(strID):
|
||||
result[strID] = title
|
||||
|
||||
if result:
|
||||
timestamp = util.GetCurrentTime()
|
||||
filename = f"download_{timestamp}.json"
|
||||
savePath = os.path.join(folder_path, filename)
|
||||
with open(savePath, "w", encoding="utf-8") as f:
|
||||
json.dump(result, f, ensure_ascii=False, indent=2)
|
||||
util.DbgOut(f"다운로드 목록이 생성되었습니다: {savePath}", True)
|
||||
else:
|
||||
util.DbgOut("완료되지 않은 다운로드가 없습니다.", True)
|
||||
|
||||
"""
|
||||
"""
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user