fix: Download status not updating to completed on list page
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
title: "애니 다운로더"
|
title: "애니 다운로더"
|
||||||
version: "0.4.4"
|
version: "0.4.5"
|
||||||
package_name: "anime_downloader"
|
package_name: "anime_downloader"
|
||||||
developer: "projectdx"
|
developer: "projectdx"
|
||||||
description: "anime downloader"
|
description: "anime downloader"
|
||||||
|
|||||||
@@ -1320,22 +1320,24 @@ class AniLifeQueueEntity(FfmpegQueueEntity):
|
|||||||
tmp["filename"] = self.filename
|
tmp["filename"] = self.filename
|
||||||
return tmp
|
return tmp
|
||||||
|
|
||||||
def donwload_completed(self):
|
def download_completed(self):
|
||||||
|
"""Override to update DB status after download completes."""
|
||||||
|
# Call parent's download_completed first (handles file move)
|
||||||
|
super().download_completed()
|
||||||
|
|
||||||
|
# Update DB status
|
||||||
db_entity = ModelAniLifeItem.get_by_anilife_id(self.info["_id"])
|
db_entity = ModelAniLifeItem.get_by_anilife_id(self.info["_id"])
|
||||||
if db_entity is not None:
|
if db_entity is not None:
|
||||||
db_entity.status = "completed"
|
db_entity.status = "completed"
|
||||||
db_entity.completed_time = datetime.now()
|
db_entity.completed_time = datetime.now()
|
||||||
# 메타데이터 동기화
|
# 메타데이터 동기화
|
||||||
db_entity.filename = self.filename
|
db_entity.filename = self.filename
|
||||||
db_entity.save_fullpath = self.save_fullpath
|
db_entity.save_fullpath = getattr(self, 'save_fullpath', None)
|
||||||
db_entity.filesize = self.filesize
|
db_entity.filesize = getattr(self, 'filesize', None)
|
||||||
db_entity.duration = self.duration
|
db_entity.duration = getattr(self, 'duration', None)
|
||||||
db_entity.quality = self.quality
|
db_entity.quality = getattr(self, 'quality', None)
|
||||||
db_entity.save()
|
db_entity.save()
|
||||||
|
logger.info(f"[Anilife] DB status updated to 'completed': {self.info.get('title', 'Unknown')}")
|
||||||
# Discord 알림 (이미 메인에서 처리될 수도 있으나 명시적으로 필요한 경우)
|
|
||||||
# if self.P.ModelSetting.get_bool('anilife_discord_notification'):
|
|
||||||
# ...
|
|
||||||
|
|
||||||
def prepare_extra(self):
|
def prepare_extra(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ class AnimeQueueEntity(FfmpegQueueEntity):
|
|||||||
self.ffmpeg_status = 7
|
self.ffmpeg_status = 7
|
||||||
self.ffmpeg_status_kor = "완료"
|
self.ffmpeg_status_kor = "완료"
|
||||||
self.end_time = datetime.now()
|
self.end_time = datetime.now()
|
||||||
|
self._update_db_status()
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.filepath and os.path.exists(self.filepath):
|
if self.filepath and os.path.exists(self.filepath):
|
||||||
@@ -126,11 +127,42 @@ class AnimeQueueEntity(FfmpegQueueEntity):
|
|||||||
self.ffmpeg_status = 7
|
self.ffmpeg_status = 7
|
||||||
self.ffmpeg_status_kor = "완료"
|
self.ffmpeg_status_kor = "완료"
|
||||||
self.end_time = datetime.now()
|
self.end_time = datetime.now()
|
||||||
|
self._update_db_status()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.P.logger.error(f"Download completed error: {e}")
|
self.P.logger.error(f"Download completed error: {e}")
|
||||||
self.ffmpeg_status = 4
|
self.ffmpeg_status = 4
|
||||||
self.ffmpeg_status_kor = "이동 실패"
|
self.ffmpeg_status_kor = "이동 실패"
|
||||||
|
|
||||||
|
def _update_db_status(self):
|
||||||
|
"""Update DB status to completed - generic method for all sites."""
|
||||||
|
try:
|
||||||
|
# Get the web_list_model from module_logic
|
||||||
|
model_class = getattr(self.module_logic, 'web_list_model', None)
|
||||||
|
if model_class is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Try to find the DB entity
|
||||||
|
db_entity = None
|
||||||
|
info = getattr(self, 'info', {})
|
||||||
|
|
||||||
|
# Anilife uses _id
|
||||||
|
if hasattr(model_class, 'get_by_anilife_id') and info.get('_id'):
|
||||||
|
db_entity = model_class.get_by_anilife_id(info['_id'])
|
||||||
|
# Linkkf/Ohli24 might use different identifiers
|
||||||
|
elif hasattr(model_class, 'get_by_id') and info.get('db_id'):
|
||||||
|
db_entity = model_class.get_by_id(info['db_id'])
|
||||||
|
elif hasattr(model_class, 'get_by_content_code') and info.get('content_code'):
|
||||||
|
db_entity = model_class.query.filter_by(content_code=info['content_code'], episode_no=info.get('episode_no')).first()
|
||||||
|
|
||||||
|
if db_entity is not None:
|
||||||
|
db_entity.status = "completed"
|
||||||
|
db_entity.completed_time = datetime.now()
|
||||||
|
db_entity.filename = getattr(self, 'filename', None)
|
||||||
|
db_entity.save()
|
||||||
|
logger.info(f"[{self.module_logic.name}] DB status updated to 'completed': {info.get('title', 'Unknown')}")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Failed to update DB status: {e}")
|
||||||
|
|
||||||
def info_dict(self, tmp):
|
def info_dict(self, tmp):
|
||||||
"""Default valid implementation"""
|
"""Default valid implementation"""
|
||||||
return tmp
|
return tmp
|
||||||
|
|||||||
@@ -1229,17 +1229,33 @@ $(document).ready(function(){
|
|||||||
<style>
|
<style>
|
||||||
/* Mobile Margin Fix */
|
/* Mobile Margin Fix */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
body { overflow-x: hidden !important; padding: 0 !important; margin: 0 !important; padding-top: 10px !important; }
|
body { overflow-x: hidden !important; padding: 0 !important; margin: 0 !important; padding-top: 5px !important; }
|
||||||
ul.nav.nav-pills.bg-light {
|
|
||||||
|
/* First nav (main menu) */
|
||||||
|
ul.nav.nav-pills.bg-light:first-of-type {
|
||||||
margin-top: 50px !important;
|
margin-top: 50px !important;
|
||||||
margin-bottom: 10px !important;
|
margin-bottom: 5px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Second nav (sub menu) */
|
||||||
|
ul.nav.nav-pills.bg-light {
|
||||||
|
margin-top: 0 !important;
|
||||||
|
margin-bottom: 8px !important;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
border-radius: 12px !important;
|
flex-wrap: wrap !important;
|
||||||
|
justify-content: center !important;
|
||||||
|
border-radius: 10px !important;
|
||||||
|
padding: 4px !important;
|
||||||
|
gap: 2px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.nav.nav-pills .nav-link {
|
ul.nav.nav-pills .nav-link {
|
||||||
padding: 6px 12px !important;
|
padding: 5px 10px !important;
|
||||||
font-size: 13px;
|
font-size: 12px !important;
|
||||||
|
}
|
||||||
|
ul.nav.nav-pills .nav-item {
|
||||||
|
margin: 1px !important;
|
||||||
}
|
}
|
||||||
.container, .container-fluid, .row, form, #program_list, #program_auto_form, #episode_list, .queue-container, #yommi_wrapper, #main_container {
|
.container, .container-fluid, .row, form, #program_list, #program_auto_form, #episode_list, .queue-container, #yommi_wrapper, #main_container {
|
||||||
width: 100% !important; max-width: 100% !important;
|
width: 100% !important; max-width: 100% !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user