diff --git a/app/api/endpoints/history.py b/app/api/endpoints/history.py index 3c110876..c71800a4 100644 --- a/app/api/endpoints/history.py +++ b/app/api/endpoints/history.py @@ -74,7 +74,8 @@ def delete_transfer_history(history_in: schemas.TransferHistory, if not history: return schemas.Response(success=False, msg="记录不存在") # 册除文件 - TransferChain(db).delete_files(Path(history.dest)) + if history.dest: + TransferChain(db).delete_files(Path(history.dest)) # 删除记录 TransferHistory.delete(db, history_in.id) return schemas.Response(success=True) diff --git a/app/core/context.py b/app/core/context.py index 702848a6..a1877433 100644 --- a/app/core/context.py +++ b/app/core/context.py @@ -252,6 +252,12 @@ class MediaInfo: """ setattr(self, f"{name}_path", image) + def get_image(self, name: str): + """ + 获取图片地址 + """ + return getattr(self, f"{name}_path") + def set_category(self, cat: str): """ 设置二级分类 diff --git a/app/modules/fanart/__init__.py b/app/modules/fanart/__init__.py index 2b2f9109..a783174f 100644 --- a/app/modules/fanart/__init__.py +++ b/app/modules/fanart/__init__.py @@ -47,7 +47,10 @@ class FanartModule(_ModuleBase): continue # 按欢迎程度倒排 images.sort(key=lambda x: int(x.get('likes', 0)), reverse=True) - mediainfo.set_image(self.__name(name), images[0].get('url')) + # 图片属性xx_path + image_name = self.__name(name) + if not mediainfo.get_image(image_name): + mediainfo.set_image(image_name, images[0].get('url')) return mediainfo diff --git a/version.py b/version.py index 81922b1e..34f2fd14 100644 --- a/version.py +++ b/version.py @@ -1 +1 @@ -APP_VERSION = 'v1.0.10' +APP_VERSION = 'v1.1.0'