This commit is contained in:
thsrite 2023-08-30 10:26:24 +08:00
parent f8221bb526
commit 85477a4bd3

View File

@ -69,7 +69,23 @@ class NAStoolSync(_PluginBase):
self.tr = Transmission() self.tr = Transmission()
# 读取sqlite数据 # 读取sqlite数据
gradedb = sqlite3.connect(self._nt_db_path) try:
gradedb = sqlite3.connect(self._nt_db_path)
except Exception as e:
self.update_config(
{
"transfer": False,
"clear": False,
"nt_db_path": None,
"path": self._path,
"downloader": self._downloader,
"site": self._site,
"supp": self._supp,
}
)
logger.error(f"无法打开数据库文件 {self._nt_db_path},请检查路径是否正确:{e}")
return
# 创建游标cursor来执行execute语句 # 创建游标cursor来执行execute语句
cursor = gradedb.cursor() cursor = gradedb.cursor()
@ -520,180 +536,180 @@ class NAStoolSync(_PluginBase):
拼装插件配置页面需要返回两块数据1页面配置2数据结构 拼装插件配置页面需要返回两块数据1页面配置2数据结构
""" """
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': 4 'md': 4
}, },
'content': [ 'content': [
{ {
'component': 'VSwitch', 'component': 'VSwitch',
'props': { 'props': {
'model': 'transfer', 'model': 'transfer',
'label': '同步记录' 'label': '同步记录'
} }
} }
] ]
}, },
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
'md': 4 'md': 4
}, },
'content': [ 'content': [
{ {
'component': 'VSwitch', 'component': 'VSwitch',
'props': { 'props': {
'model': 'clear', 'model': 'clear',
'label': '清空记录' 'label': '清空记录'
} }
} }
] ]
}, },
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
'md': 4 'md': 4
}, },
'content': [ 'content': [
{ {
'component': 'VSwitch', 'component': 'VSwitch',
'props': { 'props': {
'model': 'supp', 'model': 'supp',
'label': '补充数据' 'label': '补充数据'
} }
} }
] ]
} }
] ]
}, },
{ {
'component': 'VRow', 'component': 'VRow',
'content': [ 'content': [
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
}, },
'content': [ 'content': [
{ {
'component': 'VTextField', 'component': 'VTextField',
'props': { 'props': {
'model': 'nt_db_path', 'model': 'nt_db_path',
'label': 'NAStool数据库user.db路径', 'label': 'NAStool数据库user.db路径',
} }
} }
] ]
} }
] ]
}, },
{ {
'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': 'path', 'model': 'path',
'rows': '2', 'rows': '2',
'label': '历史记录路径映射', 'label': '历史记录路径映射',
'placeholder': 'NAStool路径:MoviePilot路径一行一个' 'placeholder': 'NAStool路径:MoviePilot路径一行一个'
} }
} }
] ]
} }
] ]
}, },
{ {
'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': 'downloader', 'model': 'downloader',
'rows': '2', 'rows': '2',
'label': '插件数据下载器映射', 'label': '插件数据下载器映射',
'placeholder': 'NAStool下载器id:qbittorrent|transmission一行一个' 'placeholder': 'NAStool下载器id:qbittorrent|transmission一行一个'
} }
} }
] ]
} }
] ]
}, },
{ {
'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': 'site', 'model': 'site',
'label': '下载历史站点映射', 'label': '下载历史站点映射',
'placeholder': 'NAStool站点名:MoviePilot站点名一行一个' 'placeholder': 'NAStool站点名:MoviePilot站点名一行一个'
} }
} }
] ]
} }
] ]
}, },
{ {
'component': 'VRow', 'component': 'VRow',
'content': [ 'content': [
{ {
'component': 'VCol', 'component': 'VCol',
'props': { 'props': {
'cols': 12, 'cols': 12,
}, },
'content': [ 'content': [
{ {
'component': 'VAlert', 'component': 'VAlert',
'props': { 'props': {
'text': '开启清空记录时会在导入历史数据之前删除MoviePilot之前的记录。' 'text': '开启清空记录时会在导入历史数据之前删除MoviePilot之前的记录。'
'如果转移记录很多同步时间可能会长3-10分钟' '如果转移记录很多同步时间可能会长3-10分钟'
'所以点击确定后页面没反应是正常现象,后台正在处理。' '所以点击确定后页面没反应是正常现象,后台正在处理。'
'如果开启补充数据会获取tr、qb种子补充转移记录中download_hash缺失的情况同步删除需要' '如果开启补充数据会获取tr、qb种子补充转移记录中download_hash缺失的情况同步删除需要'
} }
} }
] ]
} }
] ]
} }
] ]
} }
], { ], {
"transfer": False, "transfer": False,
"clear": False, "clear": False,
"supp": False, "supp": False,
"nt_db_path": "", "nt_db_path": "",
"path": "", "path": "",
"downloader": "", "downloader": "",
"site": "", "site": "",
} }
def get_page(self) -> List[dict]: def get_page(self) -> List[dict]:
pass pass