Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
46f0cfe517
@ -122,11 +122,11 @@ class FileTransferModule(_ModuleBase):
|
|||||||
r"|chinese|(cn|ch[si]|sg|zho?|eng)[-_&](cn|ch[si]|sg|zho?|eng)" \
|
r"|chinese|(cn|ch[si]|sg|zho?|eng)[-_&](cn|ch[si]|sg|zho?|eng)" \
|
||||||
r"|简[体中]?)[.\])])" \
|
r"|简[体中]?)[.\])])" \
|
||||||
r"|([\u4e00-\u9fa5]{0,3}[中双][\u4e00-\u9fa5]{0,2}[字文语][\u4e00-\u9fa5]{0,3})" \
|
r"|([\u4e00-\u9fa5]{0,3}[中双][\u4e00-\u9fa5]{0,2}[字文语][\u4e00-\u9fa5]{0,3})" \
|
||||||
r"|简体|简中" \
|
r"|简体|简中|JPSC" \
|
||||||
r"|(?<![a-z0-9])gb(?![a-z0-9])"
|
r"|(?<![a-z0-9])gb(?![a-z0-9])"
|
||||||
_zhtw_sub_re = r"([.\[(](((zh[-_])?(hk|tw|cht|tc))" \
|
_zhtw_sub_re = r"([.\[(](((zh[-_])?(hk|tw|cht|tc))" \
|
||||||
r"|繁[体中]?)[.\])])" \
|
r"|繁[体中]?)[.\])])" \
|
||||||
r"|繁体中[文字]|中[文字]繁体|繁体" \
|
r"|繁体中[文字]|中[文字]繁体|繁体|JPTC" \
|
||||||
r"|(?<![a-z0-9])big5(?![a-z0-9])"
|
r"|(?<![a-z0-9])big5(?![a-z0-9])"
|
||||||
_eng_sub_re = r"[.\[(]eng[.\])]"
|
_eng_sub_re = r"[.\[(]eng[.\])]"
|
||||||
|
|
||||||
@ -162,12 +162,12 @@ class FileTransferModule(_ModuleBase):
|
|||||||
continue
|
continue
|
||||||
new_file_type = ""
|
new_file_type = ""
|
||||||
# 兼容jellyfin字幕识别(多重识别), emby则会识别最后一个后缀
|
# 兼容jellyfin字幕识别(多重识别), emby则会识别最后一个后缀
|
||||||
if re.search(_zhcn_sub_re, file_item.stem, re.I):
|
if re.search(_zhcn_sub_re, file_item.name, re.I):
|
||||||
new_file_type = ".chi.zh-cn"
|
new_file_type = ".chi.zh-cn"
|
||||||
elif re.search(_zhtw_sub_re, file_item.stem,
|
elif re.search(_zhtw_sub_re, file_item.name,
|
||||||
re.I):
|
re.I):
|
||||||
new_file_type = ".zh-tw"
|
new_file_type = ".zh-tw"
|
||||||
elif re.search(_eng_sub_re, file_item.stem, re.I):
|
elif re.search(_eng_sub_re, file_item.name, re.I):
|
||||||
new_file_type = ".eng"
|
new_file_type = ".eng"
|
||||||
# 通过对比字幕文件大小 尽量转移所有存在的字幕
|
# 通过对比字幕文件大小 尽量转移所有存在的字幕
|
||||||
file_ext = file_item.suffix
|
file_ext = file_item.suffix
|
||||||
|
@ -4,13 +4,12 @@ from typing import Any, List, Dict, Tuple
|
|||||||
|
|
||||||
from app.chain import ChainBase
|
from app.chain import ChainBase
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.core.event import EventManager, eventmanager, Event
|
from app.core.event import EventManager
|
||||||
from app.db.models import Base
|
from app.db.models import Base
|
||||||
from app.db.plugindata_oper import PluginDataOper
|
from app.db.plugindata_oper import PluginDataOper
|
||||||
from app.db.systemconfig_oper import SystemConfigOper
|
from app.db.systemconfig_oper import SystemConfigOper
|
||||||
from app.helper.message import MessageHelper
|
from app.helper.message import MessageHelper
|
||||||
from app.schemas import Notification, NotificationType, MessageChannel
|
from app.schemas import Notification, NotificationType, MessageChannel
|
||||||
from app.schemas.types import EventType
|
|
||||||
|
|
||||||
|
|
||||||
class PluginChian(ChainBase):
|
class PluginChian(ChainBase):
|
||||||
@ -183,16 +182,3 @@ class _PluginBase(metaclass=ABCMeta):
|
|||||||
channel=channel, mtype=mtype, title=title, text=text,
|
channel=channel, mtype=mtype, title=title, text=text,
|
||||||
image=image, link=link, userid=userid
|
image=image, link=link, userid=userid
|
||||||
))
|
))
|
||||||
|
|
||||||
@eventmanager.register(EventType.PluginReload)
|
|
||||||
def reload(self, event: Event):
|
|
||||||
"""
|
|
||||||
重新加载插件
|
|
||||||
"""
|
|
||||||
plugin_id = event.event_data.get("plugin_id")
|
|
||||||
if not plugin_id:
|
|
||||||
return
|
|
||||||
conf = self.get_config(plugin_id)
|
|
||||||
if not conf:
|
|
||||||
return
|
|
||||||
self.init_plugin(conf)
|
|
||||||
|
@ -152,6 +152,7 @@ class AutoBackup(_PluginBase):
|
|||||||
backup_path = bk_path / backup_file
|
backup_path = bk_path / backup_file
|
||||||
backup_path.mkdir(parents=True)
|
backup_path.mkdir(parents=True)
|
||||||
# 把现有的相关文件进行copy备份
|
# 把现有的相关文件进行copy备份
|
||||||
|
if settings.LIBRARY_CATEGORY:
|
||||||
shutil.copy(f'{config_path}/category.yaml', backup_path)
|
shutil.copy(f'{config_path}/category.yaml', backup_path)
|
||||||
shutil.copy(f'{config_path}/user.db', backup_path)
|
shutil.copy(f'{config_path}/user.db', backup_path)
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
from typing import List, Tuple, Dict, Any
|
from typing import List, Tuple, Dict, Any
|
||||||
|
|
||||||
from python_hosts import Hosts, HostsEntry
|
from python_hosts import Hosts, HostsEntry
|
||||||
|
|
||||||
|
from app.core.event import eventmanager
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.plugins import _PluginBase
|
from app.plugins import _PluginBase
|
||||||
|
from app.schemas.types import EventType
|
||||||
from app.utils.ip import IpUtils
|
from app.utils.ip import IpUtils
|
||||||
from app.utils.system import SystemUtils
|
from app.utils.system import SystemUtils
|
||||||
|
|
||||||
@ -221,3 +224,15 @@ class CustomHosts(_PluginBase):
|
|||||||
退出插件
|
退出插件
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@eventmanager.register(EventType.PluginReload)
|
||||||
|
def reload(self, event):
|
||||||
|
"""
|
||||||
|
响应插件重载事件
|
||||||
|
"""
|
||||||
|
plugin_id = event.event_data.get("plugin_id")
|
||||||
|
if not plugin_id:
|
||||||
|
return
|
||||||
|
if plugin_id != self.__class__.__name__:
|
||||||
|
return
|
||||||
|
return self.init_plugin(self.get_config())
|
||||||
|
@ -492,7 +492,7 @@ class MediaSyncDel(_PluginBase):
|
|||||||
try:
|
try:
|
||||||
# 判断种子是否被删除完
|
# 判断种子是否被删除完
|
||||||
self.handle_torrent(history_id=transferhis.id,
|
self.handle_torrent(history_id=transferhis.id,
|
||||||
src=history.src,
|
src=transferhis.src,
|
||||||
torrent_hash=history.download_hash)
|
torrent_hash=history.download_hash)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("删除种子失败,尝试删除源文件:%s" % str(e))
|
logger.error("删除种子失败,尝试删除源文件:%s" % str(e))
|
||||||
@ -640,7 +640,7 @@ class MediaSyncDel(_PluginBase):
|
|||||||
try:
|
try:
|
||||||
# 判断种子是否被删除完
|
# 判断种子是否被删除完
|
||||||
self.handle_torrent(history_id=transferhis.id,
|
self.handle_torrent(history_id=transferhis.id,
|
||||||
src=history.src,
|
src=transferhis.src,
|
||||||
torrent_hash=history.download_hash)
|
torrent_hash=history.download_hash)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("删除种子失败,尝试删除源文件:%s" % str(e))
|
logger.error("删除种子失败,尝试删除源文件:%s" % str(e))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user