From a56d443e80dcf44dc103ae2445da3cc43ed66658 Mon Sep 17 00:00:00 2001 From: user01 Date: Sat, 29 Aug 2026 02:47:37 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=A6=AC=EB=B7=B0,=20.low?= =?UTF-8?q?nload=20=ED=8C=8C=EC=9D=BC=20=EC=9E=91=EC=84=B1=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataClass_Pupil.py | 2 +- GetArc_Hitomi.py | 32 +++++++++++++++++--------------- MgrCalibreUI.py | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/DataClass_Pupil.py b/DataClass_Pupil.py index 15fb466..a0cc339 100644 --- a/DataClass_Pupil.py +++ b/DataClass_Pupil.py @@ -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"] diff --git a/GetArc_Hitomi.py b/GetArc_Hitomi.py index 0c3258b..ed4264b 100644 --- a/GetArc_Hitomi.py +++ b/GetArc_Hitomi.py @@ -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 diff --git a/MgrCalibreUI.py b/MgrCalibreUI.py index 976d009..89f3693 100644 --- a/MgrCalibreUI.py +++ b/MgrCalibreUI.py @@ -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__':