diff --git a/README.md b/README.md index cc6949f..ba19e9a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,13 @@ FlaskFarm용 범용 다운로드 매니저 플러그인입니다. 여러 다운로더 플러그인(YouTube, Anime 등)의 다운로드 요청을 통합 관리하고 큐(Queue)를 제공합니다. -## v0.2.0 변경사항 +## v0.2.8 변경사항 (2026-01-07) +- **콜백 시스템 개선**: `module_list`가 리스트 형태인 플러그인(애니 다운로더 등)과의 콜백 연동 호환성 해결 (`AttributeError` 수정). +- **메타데이터 강화**: 다운로드 시작/종료 시간 및 최종 파일 크기 추적 기능 추가. +- **UI 상세 정보 보강**: GDM 큐 목록에서 시작 시간, 종료 시간, 파일 크기를 상세 패널에 표시. +- **DB 정밀 동기화**: 다운로드 완료 시 실제 파일 크기를 DB에 영구 저장. + +## v0.2.7 변경사항 - **패키지명 수정**: `gommi_download_manager` -> `gommi_downloader_manager`로 폴더명과 일치시켜 Bind Key 오류 해결. - **안정성 개선**: DB 테이블 생성 로직 강화 (`setup.py` 명시적 모델 import). - **YouTube 제목 지원**: `yt-dlp` 다운로드 시작 시 영상의 진짜 제목과 썸네일을 실시간으로 DB에 업데이트합니다. diff --git a/info.yaml b/info.yaml index 8bbffe4..21c4805 100644 --- a/info.yaml +++ b/info.yaml @@ -1,6 +1,6 @@ title: "GDM" package_name: gommi_downloader_manager -version: '0.2.7' +version: '0.2.9' description: FlaskFarm 범용 다운로더 큐 - YouTube, 애니24, 링크애니, Anilife 지원 developer: projectdx home: https://gitea.yommi.duckdns.org/projectdx/gommi_downloader_manager diff --git a/mod_queue.py b/mod_queue.py index a0fb6fc..d50a5e0 100644 --- a/mod_queue.py +++ b/mod_queue.py @@ -396,6 +396,9 @@ class DownloadTask: self._downloader = None self._cancelled = False self.db_id: Optional[int] = None + self.start_time: Optional[str] = None + self.end_time: Optional[str] = None + self.created_time: str = datetime.now().strftime('%Y-%m-%d %H:%M:%S') def start(self): """다운로드 시작 (비동기)""" @@ -406,6 +409,8 @@ class DownloadTask: """다운로드 실행""" try: self.status = DownloadStatus.EXTRACTING + if not self.start_time: + self.start_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') self._emit_status() # 다운로더 선택 및 실행 @@ -434,13 +439,17 @@ class DownloadTask: self.status = DownloadStatus.COMPLETED self.filepath = result.get('filepath', '') self.progress = 100 + self.end_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + if self.filepath and os.path.exists(self.filepath): + self.filesize = os.path.getsize(self.filepath) # DB 업데이트 self._update_db_status() # 실시간 콜백 처리 if self._on_complete: - self._on_complete(self.filepath) + try: self._on_complete(self.filepath) + except: pass # 플러그인 간 영구적 콜백 처리 if self.caller_plugin and self.callback_id: @@ -566,6 +575,7 @@ class DownloadTask: item.status = self.status if self.status == DownloadStatus.COMPLETED: item.completed_time = datetime.now() + item.filesize = self.filesize if self.error_message: item.error_message = self.error_message F.db.session.add(item) @@ -605,7 +615,15 @@ class DownloadTask: if target_P: # 모듈에서 콜백 메서드 찾기 callback_invoked = False - for module_name, module_instance in getattr(target_P, 'module_list', {}).items(): + module_list = getattr(target_P, 'module_list', []) + if isinstance(module_list, dict): + modules = module_list.items() + elif isinstance(module_list, list): + modules = [(getattr(m, 'name', str(i)), m) for i, m in enumerate(module_list)] + else: + modules = [] + + for module_name, module_instance in modules: if hasattr(module_instance, 'plugin_callback'): callback_data = { 'callback_id': self.callback_id, @@ -647,4 +665,8 @@ class DownloadTask: 'caller_plugin': self.caller_plugin, 'callback_id': self.callback_id, 'db_id': self.db_id, + 'start_time': self.start_time, + 'end_time': self.end_time, + 'created_time': self.created_time, + 'file_size': self.filesize, } diff --git a/model.py b/model.py index 877dab5..2342f2f 100644 --- a/model.py +++ b/model.py @@ -57,9 +57,10 @@ class ModelDownloadItem(ModelBase): ret['meta'] = {} else: ret['meta'] = {} - # Format created_time for frontend if self.created_time: ret['created_time'] = self.created_time.strftime('%Y-%m-%d %H:%M:%S') + # JS UI expects file_size (with underscore) + ret['file_size'] = self.filesize or 0 return ret @classmethod diff --git a/templates/gommi_downloader_manager_queue_list.html b/templates/gommi_downloader_manager_queue_list.html index a60b070..cf5ecf0 100644 --- a/templates/gommi_downloader_manager_queue_list.html +++ b/templates/gommi_downloader_manager_queue_list.html @@ -149,6 +149,7 @@ letter-spacing: -0.025em; background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%); -webkit-background-clip: text; + background-clip: text; -webkit-text-fill-color: transparent; } @@ -263,6 +264,7 @@ line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; + line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all;