fix download_hash补充逻辑
This commit is contained in:
@ -345,22 +345,25 @@ class DirMonitor(_PluginBase):
|
|||||||
for torrent in qb_torrents:
|
for torrent in qb_torrents:
|
||||||
if str(torrent.get("name")) == str(torrent_name) \
|
if str(torrent.get("name")) == str(torrent_name) \
|
||||||
or str(torrent.get("name")) == str(torrent_name2):
|
or str(torrent.get("name")) == str(torrent_name2):
|
||||||
return torrent.get("hash")
|
files = self.qb.get_files(tid=torrent.get("hash"))
|
||||||
|
if files:
|
||||||
|
for file in files:
|
||||||
|
torrent_file_name = file.get("name")
|
||||||
|
if str(file_name) == str(os.path.basename(torrent_file_name)):
|
||||||
|
return torrent.get("hash")
|
||||||
|
|
||||||
# 处理辅种器 遍历所有种子,按照添加升序升序,第一个种子是初始种子
|
# 处理辅种器 遍历所有种子,按照添加时间升序
|
||||||
mate_torrents = []
|
if len(tr_torrents) > 0:
|
||||||
|
tr_torrents = sorted(tr_torrents, key=lambda x: x.added_date)
|
||||||
for torrent in tr_torrents:
|
for torrent in tr_torrents:
|
||||||
if str(torrent.get("name")) == str(torrent_name) \
|
if str(torrent.get("name")) == str(torrent_name) \
|
||||||
or str(torrent.get("name")) == str(torrent_name2):
|
or str(torrent.get("name")) == str(torrent_name2):
|
||||||
mate_torrents.append(torrent)
|
files = self.tr.get_files(tid=torrent.get("hashString"))
|
||||||
|
if files:
|
||||||
# 匹配上则按照时间升序
|
for file in files:
|
||||||
if mate_torrents:
|
torrent_file_name = file.name
|
||||||
if len(mate_torrents) > 1:
|
if str(file_name) == str(os.path.basename(torrent_file_name)):
|
||||||
mate_torrents = sorted(mate_torrents, key=lambda x: x.added_date)
|
return torrent.get("hashString")
|
||||||
# 最早添加的hash是下载的hash
|
|
||||||
return mate_torrents[0].get("hashString")
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_state(self) -> bool:
|
def get_state(self) -> bool:
|
||||||
@ -375,149 +378,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
|
||||||
|
Reference in New Issue
Block a user