mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
refactor: 移除多余的空行,优化类型导入及方法为静态方法
This commit is contained in:
@@ -4,7 +4,7 @@ import asyncio
|
|||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Optional, Type, List
|
from typing import Optional, Type
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|||||||
@@ -160,4 +160,3 @@ class QueryPopularSubscribesTool(MoviePilotTool):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"查询热门订阅失败: {e}", exc_info=True)
|
logger.error(f"查询热门订阅失败: {e}", exc_info=True)
|
||||||
return f"查询热门订阅时发生错误: {str(e)}"
|
return f"查询热门订阅时发生错误: {str(e)}"
|
||||||
|
|
||||||
|
|||||||
@@ -62,4 +62,3 @@ class QueryRuleGroupsTool(MoviePilotTool):
|
|||||||
"message": error_message,
|
"message": error_message,
|
||||||
"rule_groups": []
|
"rule_groups": []
|
||||||
}, ensure_ascii=False)
|
}, ensure_ascii=False)
|
||||||
|
|
||||||
|
|||||||
@@ -52,4 +52,3 @@ class QuerySchedulersTool(MoviePilotTool):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"查询定时服务失败: {e}", exc_info=True)
|
logger.error(f"查询定时服务失败: {e}", exc_info=True)
|
||||||
return f"查询定时服务时发生错误: {str(e)}"
|
return f"查询定时服务时发生错误: {str(e)}"
|
||||||
|
|
||||||
|
|||||||
@@ -114,4 +114,3 @@ class QuerySubscribeHistoryTool(MoviePilotTool):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"查询订阅历史失败: {e}", exc_info=True)
|
logger.error(f"查询订阅历史失败: {e}", exc_info=True)
|
||||||
return f"查询订阅历史时发生错误: {str(e)}"
|
return f"查询订阅历史时发生错误: {str(e)}"
|
||||||
|
|
||||||
|
|||||||
@@ -110,4 +110,3 @@ class QuerySubscribeSharesTool(MoviePilotTool):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"查询订阅分享失败: {e}", exc_info=True)
|
logger.error(f"查询订阅分享失败: {e}", exc_info=True)
|
||||||
return f"查询订阅分享时发生错误: {str(e)}"
|
return f"查询订阅分享时发生错误: {str(e)}"
|
||||||
|
|
||||||
|
|||||||
@@ -125,4 +125,3 @@ class QueryWorkflowsTool(MoviePilotTool):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"查询工作流失败: {e}", exc_info=True)
|
logger.error(f"查询工作流失败: {e}", exc_info=True)
|
||||||
return f"查询工作流时发生错误: {str(e)}"
|
return f"查询工作流时发生错误: {str(e)}"
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ class RecognizeMediaTool(MoviePilotTool):
|
|||||||
"message": error_message
|
"message": error_message
|
||||||
}, ensure_ascii=False)
|
}, ensure_ascii=False)
|
||||||
|
|
||||||
def _format_context_result(self, context: Context, source_type: str) -> str:
|
@staticmethod
|
||||||
|
def _format_context_result(context: Context, source_type: str) -> str:
|
||||||
"""格式化识别结果为JSON字符串"""
|
"""格式化识别结果为JSON字符串"""
|
||||||
if not context:
|
if not context:
|
||||||
return json.dumps({
|
return json.dumps({
|
||||||
@@ -160,4 +161,3 @@ class RecognizeMediaTool(MoviePilotTool):
|
|||||||
}
|
}
|
||||||
|
|
||||||
return json.dumps(result, ensure_ascii=False, indent=2)
|
return json.dumps(result, ensure_ascii=False, indent=2)
|
||||||
|
|
||||||
|
|||||||
@@ -47,4 +47,3 @@ class TestSiteTool(MoviePilotTool):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"测试站点连通性失败: {e}", exc_info=True)
|
logger.error(f"测试站点连通性失败: {e}", exc_info=True)
|
||||||
return f"测试站点连通性时发生错误: {str(e)}"
|
return f"测试站点连通性时发生错误: {str(e)}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user