코드 리뷰, .lownload 파일 작성 함수 추가

This commit is contained in:
2026-08-29 02:47:37 +09:00
parent 321b1c03a0
commit a56d443e80
3 changed files with 53 additions and 17 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ class PupilData:
# pupil 의 JSON 을 파싱해서 ImageFileList 를 반환한다.
def GetImgFileList(self) -> list[info.ImageFileInfo]:
listRet = set(info.ImageFileInfo)
listRet = list[info.ImageFileInfo]()
if None != self.m_data:
listFiles = self.m_data[GALINFO]["files"]
+17 -15
View File
@@ -80,18 +80,19 @@ class GetArc_Hitomi:
strContent = driver.page_source
listRet = self.parseMangaInfos(strContent)
#for Idx in range(len(listRet)):
# print(f"{Idx} : {listRet[Idx]}")
try:
for Idx in range(len(listRet)):
print(f"{Idx} : {listRet[Idx]}")
with open( f"{id}.txt", 'w') as file:
for item in listRet[Idx]:
file.write( + "\n")
except IOError:
util.DbgOut(f"Error: Could not write to the file at {id}.txt.", True)
for Idx in range(len(listRet)):
util.DbgOut(f"{Idx} : {listRet[Idx]}", True)
if True == bSave and 0 < len(listRet):
strFileName = f"{nID}.txt"
try:
with open(strFileName, 'w', encoding="utf-8") as file:
for item in listRet:
file.write(f"{item}\n")
util.DbgOut(f"Saved to {strFileName}", True)
except IOError:
util.DbgOut(f"Error: Could not write to the file at {strFileName}.", True)
except Exception as e:
util.DbgOut(f"Hitomi Loading Error : {e}", True)
@@ -182,11 +183,12 @@ class GetArc_Hitomi:
#util.DbgOut(outMsg)
#
if "Series" == tds[0]:
retPtr.serires = listTags[-1].name
elif "Type" == tds[0]:
strLabel = tds[0].text.strip()
if "Series" == strLabel:
retPtr.series = listTags[-1].name
elif "Type" == strLabel:
retPtr.type = listTags[-1].name
elif "Language" == tds[0]:
elif "Language" == strLabel:
retPtr.language = listTags[-1].name
else:
pass
+35 -1
View File
@@ -1,5 +1,6 @@
import sys
import os
import json
import shutil
import UtilPack as util
import DataClass_Pupil as pupil
@@ -580,7 +581,40 @@ class MyApp(QMainWindow):
#
def on_btn_MakeDownList_clicked(self):
pass
itemCount = self.tableWidget_Src.rowCount()
if itemCount <= 0:
util.DbgOut("파싱된 만화가 없습니다.", True)
return
pathSave = QFileDialog.getSaveFileName(self, '다운로드 리스트 저장', 'download.json', 'JSON Files (*.json)')[0]
if util.IsEmptyStr(pathSave):
return
dictDownload: dict[str, str] = {}
for idx in range(itemCount):
itemID = self.tableWidget_Src.item(idx, 2)
itemTitle = self.tableWidget_Src.item(idx, 1)
if itemID is None or itemTitle is None:
continue
strID = itemID.text()
strTitle = itemTitle.text()
if util.IsEmptyStr(strID) or util.IsEmptyStr(strTitle):
continue
dictDownload[strID] = f"[{strID}] {strTitle}"
if 0 >= len(dictDownload):
util.DbgOut("작성할 다운로드 리스트 항목이 없습니다.", True)
return
try:
with open(pathSave, "w", encoding="utf-8") as file:
json.dump(dictDownload, file, ensure_ascii=False, indent=2)
util.DbgOut(f"다운로드 리스트 저장 완료: {pathSave}", True)
except Exception as e:
util.DbgOut(f"다운로드 리스트 저장 중 오류 발생: {e}", True)
QMessageBox.critical(self, "Error", str(e))
"""
if __name__ == '__main__':