@ -272,6 +272,25 @@ class AutoBackup(_PluginBase):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'component': 'VRow',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VAlert',
|
||||||
|
'props': {
|
||||||
|
'text': '备份文件路径默认为本地映射的config/plugins/AutoBackup。'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
], {
|
], {
|
||||||
|
@ -610,7 +610,7 @@ class IYUUAutoSeed(_PluginBase):
|
|||||||
if not history.get("downloader"):
|
if not history.get("downloader"):
|
||||||
continue
|
continue
|
||||||
# 如果本次辅种下载器之前有过记录则继续添加
|
# 如果本次辅种下载器之前有过记录则继续添加
|
||||||
if int(history.get("downloader")) == downloader:
|
if str(history.get("downloader")) == downloader:
|
||||||
history_torrents = history.get("torrents") or []
|
history_torrents = history.get("torrents") or []
|
||||||
history["torrents"] = list(set(history_torrents + success_torrents))
|
history["torrents"] = list(set(history_torrents + success_torrents))
|
||||||
new_history = False
|
new_history = False
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -43,6 +44,7 @@ class NAStoolSync(_PluginBase):
|
|||||||
_transfer = None
|
_transfer = None
|
||||||
_plugin = None
|
_plugin = None
|
||||||
_download = None
|
_download = None
|
||||||
|
_downloader = None
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
self._transferhistory = TransferHistoryOper()
|
self._transferhistory = TransferHistoryOper()
|
||||||
@ -55,6 +57,7 @@ class NAStoolSync(_PluginBase):
|
|||||||
self._site = config.get("site")
|
self._site = config.get("site")
|
||||||
self._transfer = config.get("transfer")
|
self._transfer = config.get("transfer")
|
||||||
self._plugin = config.get("plugin")
|
self._plugin = config.get("plugin")
|
||||||
|
self._downloader = config.get("downloader")
|
||||||
self._download = config.get("download")
|
self._download = config.get("download")
|
||||||
|
|
||||||
if self._nt_db_path and (self._transfer or self._plugin or self._download):
|
if self._nt_db_path and (self._transfer or self._plugin or self._download):
|
||||||
@ -85,18 +88,31 @@ class NAStoolSync(_PluginBase):
|
|||||||
self.update_config(
|
self.update_config(
|
||||||
{
|
{
|
||||||
"clear": False,
|
"clear": False,
|
||||||
"nt_db_path": "",
|
"nt_db_path": self._nt_db_path,
|
||||||
"path": self._path,
|
"path": self._path,
|
||||||
|
"downloader": self._downloader,
|
||||||
"site": self._site,
|
"site": self._site,
|
||||||
"transfer": self._transfer,
|
"transfer": False,
|
||||||
"plugin": self._plugin,
|
"plugin": False,
|
||||||
"download": self._download,
|
"download": False,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def sync_plugin_history(self, plugin_history):
|
def sync_plugin_history(self, plugin_history):
|
||||||
"""
|
"""
|
||||||
导入插件记录
|
导入插件记录
|
||||||
|
|
||||||
|
NAStool
|
||||||
|
{
|
||||||
|
"id": "TorrentTransfer",
|
||||||
|
"key: "1-4bdc22bc1e062803c8686beb2796369c59ee141f",
|
||||||
|
"value": "{"to_download": 2, "to_download_id": "4bdc22bc1e062803c8686beb2796369c59ee141f", "delete_source": true}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "IYUUAutoSeed",
|
||||||
|
"key: "f161efaf008d2e56e7939272e8d95eca58fa71dd",
|
||||||
|
"value": "[{"downloader": "2", "torrents": ["bd64a8edc5afe6b4beb8813bdbf6faedfb1d4cc4"]}]"
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
# 开始计时
|
# 开始计时
|
||||||
start_time = datetime.now()
|
start_time = datetime.now()
|
||||||
@ -111,6 +127,34 @@ class NAStoolSync(_PluginBase):
|
|||||||
plugin_key = history[2]
|
plugin_key = history[2]
|
||||||
plugin_value = history[3]
|
plugin_value = history[3]
|
||||||
|
|
||||||
|
# 处理下载器映射
|
||||||
|
if self._downloader:
|
||||||
|
downloaders = self._downloader.split("\n")
|
||||||
|
for downloader in downloaders:
|
||||||
|
sub_downloaders = downloader.split(":")
|
||||||
|
# 替换转种记录
|
||||||
|
if str(plugin_id) == "TorrentTransfer":
|
||||||
|
keys = str(plugin_key).split("-")
|
||||||
|
if keys[0].isdigit() and int(keys[0]) == int(sub_downloaders[0]):
|
||||||
|
# 替换key
|
||||||
|
plugin_key = plugin_key.replace(keys[0], sub_downloaders[1])
|
||||||
|
|
||||||
|
# 替换value
|
||||||
|
if isinstance(plugin_value, str):
|
||||||
|
plugin_value = json.loads(plugin_value)
|
||||||
|
if str(plugin_value.get("to_download")).isdigit() and int(
|
||||||
|
plugin_value.get("to_download")) == int(sub_downloaders[0]):
|
||||||
|
plugin_value["to_download"] = sub_downloaders[1]
|
||||||
|
|
||||||
|
# 替换辅种记录
|
||||||
|
if str(plugin_id) == "IYUUAutoSeed":
|
||||||
|
if isinstance(plugin_value, str):
|
||||||
|
plugin_value = json.loads(plugin_value)
|
||||||
|
for value in plugin_value:
|
||||||
|
if str(value.get("downloader")).isdigit() and int(value.get("downloader")) == int(
|
||||||
|
sub_downloaders[0]):
|
||||||
|
value["downloader"] = sub_downloaders[1]
|
||||||
|
|
||||||
self._plugindata.save(plugin_id=plugin_id,
|
self._plugindata.save(plugin_id=plugin_id,
|
||||||
key=plugin_key,
|
key=plugin_key,
|
||||||
value=plugin_value)
|
value=plugin_value)
|
||||||
@ -351,7 +395,7 @@ class NAStoolSync(_PluginBase):
|
|||||||
return nt_historys
|
return nt_historys
|
||||||
|
|
||||||
def get_state(self) -> bool:
|
def get_state(self) -> bool:
|
||||||
return True if self._nt_db_path else False
|
return True if self._transfer or self._plugin or self._download else False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_command() -> List[Dict[str, Any]]:
|
def get_command() -> List[Dict[str, Any]]:
|
||||||
@ -471,7 +515,7 @@ class NAStoolSync(_PluginBase):
|
|||||||
'props': {
|
'props': {
|
||||||
'model': 'path',
|
'model': 'path',
|
||||||
'rows': '2',
|
'rows': '2',
|
||||||
'label': '路径映射',
|
'label': '历史记录路径映射',
|
||||||
'placeholder': 'NAStool路径:MoviePilot路径(一行一个)'
|
'placeholder': 'NAStool路径:MoviePilot路径(一行一个)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -479,6 +523,28 @@ class NAStoolSync(_PluginBase):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'component': 'VRow',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VTextarea',
|
||||||
|
'props': {
|
||||||
|
'model': 'downloader',
|
||||||
|
'rows': '2',
|
||||||
|
'label': '插件数据下载器映射',
|
||||||
|
'placeholder': 'NAStool下载器id:qbittorrent|transmission(一行一个)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'component': 'VRow',
|
'component': 'VRow',
|
||||||
'content': [
|
'content': [
|
||||||
@ -492,7 +558,7 @@ class NAStoolSync(_PluginBase):
|
|||||||
'component': 'VTextarea',
|
'component': 'VTextarea',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'site',
|
'model': 'site',
|
||||||
'label': '站点映射',
|
'label': '下载历史站点映射',
|
||||||
'placeholder': 'NAStool站点名:MoviePilot站点名(一行一个)'
|
'placeholder': 'NAStool站点名:MoviePilot站点名(一行一个)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -516,7 +582,6 @@ class NAStoolSync(_PluginBase):
|
|||||||
'开启清空记录时,会在导入历史数据之前删除MoviePilot之前的记录。'
|
'开启清空记录时,会在导入历史数据之前删除MoviePilot之前的记录。'
|
||||||
'如果转移记录很多,同步时间可能会长,'
|
'如果转移记录很多,同步时间可能会长,'
|
||||||
'所以点击确定后页面没反应是正常现象,后台正在处理。'
|
'所以点击确定后页面没反应是正常现象,后台正在处理。'
|
||||||
'路径映射在同步转移记录时有效、站点映射在同步下载记录时有效。'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -532,6 +597,7 @@ class NAStoolSync(_PluginBase):
|
|||||||
"download": False,
|
"download": False,
|
||||||
"nt_db_path": "",
|
"nt_db_path": "",
|
||||||
"path": "",
|
"path": "",
|
||||||
|
"downloader": "",
|
||||||
"site": "",
|
"site": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user