mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-05-18 05:57:35 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -416,14 +416,6 @@ class FileTransferModule(_ModuleBase):
|
||||
rename_dict=self.__get_naming_dict(meta=in_meta,
|
||||
mediainfo=mediainfo)
|
||||
).parent
|
||||
# 目录已存在时不处理
|
||||
if new_path.exists():
|
||||
logger.warn(f"目标目录已存在:{new_path}")
|
||||
return TransferInfo(success=False,
|
||||
message=f"目标目录已存在:{new_path}",
|
||||
path=in_path,
|
||||
target_path=new_path,
|
||||
is_bluray=bluray_flag)
|
||||
# 转移蓝光原盘
|
||||
retcode = self.__transfer_dir(file_path=in_path,
|
||||
new_path=new_path,
|
||||
|
||||
@@ -12,6 +12,7 @@ from app.core.config import settings
|
||||
from app.core.context import MediaInfo, Context
|
||||
from app.core.metainfo import MetaInfo
|
||||
from app.log import logger
|
||||
from app.utils.common import retry
|
||||
from app.utils.http import RequestUtils
|
||||
from app.utils.singleton import Singleton
|
||||
from app.utils.string import StringUtils
|
||||
@@ -174,6 +175,7 @@ class Telegram(metaclass=Singleton):
|
||||
logger.error(f"发送消息失败:{msg_e}")
|
||||
return False
|
||||
|
||||
@retry(Exception, logger=logger)
|
||||
def __send_request(self, userid: str = None, image="", caption="") -> bool:
|
||||
"""
|
||||
向Telegram发送报文
|
||||
@@ -181,7 +183,9 @@ class Telegram(metaclass=Singleton):
|
||||
|
||||
if image:
|
||||
req = RequestUtils(proxies=settings.PROXY).get_res(image)
|
||||
if req and req.content:
|
||||
if req is None:
|
||||
raise Exception("获取图片失败")
|
||||
if req.content:
|
||||
image_file = Path(settings.TEMP_PATH) / Path(image).name
|
||||
image_file.write_bytes(req.content)
|
||||
photo = InputFile(image_file)
|
||||
@@ -189,12 +193,15 @@ class Telegram(metaclass=Singleton):
|
||||
photo=photo,
|
||||
caption=caption,
|
||||
parse_mode="Markdown")
|
||||
if ret is None:
|
||||
raise Exception("发送图片消息失败")
|
||||
if ret:
|
||||
return True
|
||||
ret = self._bot.send_message(chat_id=userid or self._telegram_chat_id,
|
||||
text=caption,
|
||||
parse_mode="Markdown")
|
||||
|
||||
if ret is None:
|
||||
raise Exception("发送文本消息失败")
|
||||
return True if ret else False
|
||||
|
||||
def register_commands(self, commands: Dict[str, dict]):
|
||||
|
||||
Reference in New Issue
Block a user