Merge pull request #198 from thsrite/main

This commit is contained in:
jxxghp 2023-08-20 18:48:26 +08:00 committed by GitHub
commit 3c96f1c687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 171 additions and 149 deletions

View File

@ -1,5 +1,6 @@
import re import re
import threading import threading
import time
import traceback import traceback
from pathlib import Path from pathlib import Path
from typing import List, Tuple, Dict, Any from typing import List, Tuple, Dict, Any
@ -277,7 +278,8 @@ class DirMonitor(_PluginBase):
episodes=file_meta.episode, episodes=file_meta.episode,
image=mediainfo.get_poster_image(), image=mediainfo.get_poster_image(),
download_hash=downloadHis.download_hash if downloadHis else None, download_hash=downloadHis.download_hash if downloadHis else None,
status=1 status=1,
date=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
) )
# 刮削元数据 # 刮削元数据
@ -310,149 +312,149 @@ class DirMonitor(_PluginBase):
def get_form(self) -> Tuple[List[dict], Dict[str, Any]]: def get_form(self) -> Tuple[List[dict], Dict[str, Any]]:
return [ return [
{ {
'component': 'VForm', 'component': 'VForm',
'content': [ 'content': [
{ {
'component': 'VRow', 'component': 'VRow',
'content': [ 'content': [
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
'md': 6 'md': 6
}, },
'content': [ 'content': [
{ {
'component': 'VSwitch', 'component': 'VSwitch',
'props': { 'props': {
'model': 'enabled', 'model': 'enabled',
'label': '启用插件', 'label': '启用插件',
} }
} }
] ]
}, },
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
'md': 6 'md': 6
}, },
'content': [ 'content': [
{ {
'component': 'VSwitch', 'component': 'VSwitch',
'props': { 'props': {
'model': 'notify', 'model': 'notify',
'label': '发送通知', 'label': '发送通知',
} }
} }
] ]
} }
] ]
}, },
{ {
'component': 'VRow', 'component': 'VRow',
'content': [ 'content': [
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
'md': 6 'md': 6
}, },
'content': [ 'content': [
{ {
'component': 'VSelect', 'component': 'VSelect',
'props': { 'props': {
'model': 'mode', 'model': 'mode',
'label': '监控模式', 'label': '监控模式',
'items': [ 'items': [
{'title': '兼容模式', 'value': 'compatibility'}, {'title': '兼容模式', 'value': 'compatibility'},
{'title': '性能模式', 'value': 'fast'} {'title': '性能模式', 'value': 'fast'}
] ]
} }
} }
] ]
}, },
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
'md': 6 'md': 6
}, },
'content': [ 'content': [
{ {
'component': 'VSelect', 'component': 'VSelect',
'props': { 'props': {
'model': 'transfer_type', 'model': 'transfer_type',
'label': '转移方式', 'label': '转移方式',
'items': [ 'items': [
{'title': '移动', 'value': 'move'}, {'title': '移动', 'value': 'move'},
{'title': '复制', 'value': 'copy'}, {'title': '复制', 'value': 'copy'},
{'title': '硬链接', 'value': 'link'}, {'title': '硬链接', 'value': 'link'},
{'title': '软链接', 'value': 'softlink'} {'title': '软链接', 'value': 'softlink'}
] ]
} }
} }
] ]
} }
] ]
}, },
{ {
'component': 'VRow', 'component': 'VRow',
'content': [ 'content': [
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12 'cols': 12
}, },
'content': [ 'content': [
{ {
'component': 'VTextarea', 'component': 'VTextarea',
'props': { 'props': {
'model': 'monitor_dirs', 'model': 'monitor_dirs',
'label': '监控目录', 'label': '监控目录',
'rows': 5, 'rows': 5,
'placeholder': '每一行一个目录,支持两种配置方式:\n' 'placeholder': '每一行一个目录,支持两种配置方式:\n'
'监控目录\n' '监控目录\n'
'监控目录:转移目的目录' '监控目录:转移目的目录'
} }
} }
] ]
} }
] ]
}, },
{ {
'component': 'VRow', 'component': 'VRow',
'content': [ 'content': [
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12 'cols': 12
}, },
'content': [ 'content': [
{ {
'component': 'VTextarea', 'component': 'VTextarea',
'props': { 'props': {
'model': 'exclude_keywords', 'model': 'exclude_keywords',
'label': '排除关键词', 'label': '排除关键词',
'rows': 2, 'rows': 2,
'placeholder': '每一行一个关键词' 'placeholder': '每一行一个关键词'
} }
} }
] ]
} }
] ]
} }
] ]
} }
], { ], {
"enabled": False, "enabled": False,
"notify": False, "notify": False,
"mode": "fast", "mode": "fast",
"transfer_type": settings.TRANSFER_TYPE, "transfer_type": settings.TRANSFER_TYPE,
"monitor_dirs": "", "monitor_dirs": "",
"exclude_keywords": "" "exclude_keywords": ""
} }
def get_page(self) -> List[dict]: def get_page(self) -> List[dict]:
pass pass

View File

@ -46,6 +46,7 @@ class NAStoolSync(_PluginBase):
_site = None _site = None
_downloader = None _downloader = None
_supp = False _supp = False
_transfer = False
qb = None qb = None
tr = None tr = None
@ -61,8 +62,9 @@ class NAStoolSync(_PluginBase):
self._site = config.get("site") self._site = config.get("site")
self._downloader = config.get("downloader") self._downloader = config.get("downloader")
self._supp = config.get("supp") self._supp = config.get("supp")
self._transfer = config.get("transfer")
if self._nt_db_path: if self._nt_db_path and self._transfer:
self.qb = Qbittorrent() self.qb = Qbittorrent()
self.tr = Transmission() self.tr = Transmission()
@ -92,12 +94,13 @@ class NAStoolSync(_PluginBase):
self.update_config( self.update_config(
{ {
"transfer": False,
"clear": False, "clear": False,
"nt_db_path": "", "nt_db_path": self._nt_db_path,
"path": self._path, "path": self._path,
"downloader": self._downloader, "downloader": self._downloader,
"site": self._site, "site": self._site,
"supp": self._supp "supp": self._supp,
} }
) )
@ -527,7 +530,23 @@ class NAStoolSync(_PluginBase):
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
'md': 6 'md': 4
},
'content': [
{
'component': 'VSwitch',
'props': {
'model': 'transfer',
'label': '同步记录'
}
}
]
},
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 4
}, },
'content': [ 'content': [
{ {
@ -543,7 +562,7 @@ class NAStoolSync(_PluginBase):
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
'md': 6 'md': 4
}, },
'content': [ 'content': [
{ {
@ -667,6 +686,7 @@ class NAStoolSync(_PluginBase):
] ]
} }
], { ], {
"transfer": False,
"clear": False, "clear": False,
"supp": False, "supp": False,
"nt_db_path": "", "nt_db_path": "",