fix 插件兼容V2最新版本

This commit is contained in:
jxxghp
2024-10-12 11:54:49 +08:00
parent 0f37800689
commit b89a947369
5 changed files with 29 additions and 37 deletions

View File

@@ -15,12 +15,13 @@
"name": "站点刷流",
"description": "自动托管刷流,将会提高对应站点的访问频率。",
"labels": "刷流,仪表板",
"version": "3.9",
"version": "3.9.1",
"icon": "brush.jpg",
"author": "jxxghp,InfinityPacer",
"level": 2,
"history": {
"v3.9": "MoviePilot V2 版本站点刷流插件"
"v3.9": "MoviePilot V2 版本站点刷流插件",
"v3.9.1": "修复兼容性问题"
}
},
"AutoSignIn": {
@@ -51,12 +52,13 @@
"name": "媒体库服务器刷新",
"description": "入库后自动刷新Emby/Jellyfin/Plex服务器海报墙。",
"labels": "媒体库",
"version": "1.3",
"version": "1.3.1",
"icon": "refresh2.png",
"author": "jxxghp",
"level": 1,
"history": {
"v1.3": "MoviePilot V2 版本媒体库服务器刷新插件"
"v1.3": "MoviePilot V2 版本媒体库服务器刷新插件",
"v1.3.1": "修复兼容性问题"
}
},
"MediaServerMsg": {
@@ -87,12 +89,13 @@
"name": "自动转移做种",
"description": "定期转移下载器中的做种任务到另一个下载器。",
"labels": "做种",
"version": "1.7",
"version": "1.7.1",
"icon": "seed.png",
"author": "jxxghp",
"level": 2,
"history": {
"v1.7": "MoviePilot V2 版本自动转移做种插件"
"v1.7": "MoviePilot V2 版本自动转移做种插件",
"v1.7.1": "修复兼容性问题"
}
}
}

View File

@@ -246,7 +246,7 @@ class BrushFlow(_PluginBase):
# 插件图标
plugin_icon = "brush.jpg"
# 插件版本
plugin_version = "3.9"
plugin_version = "3.9.1"
# 插件作者
plugin_author = "jxxghp,InfinityPacer"
# 作者主页
@@ -2312,7 +2312,7 @@ class BrushFlow(_PluginBase):
if need_delete_hashes:
# 如果是QB则重新汇报Tracker
if self.downloader_helper.is_qbittorrent(service=self.service_info):
if self.downloader_helper.is_downloader("qbittorrent", service=self.service_info):
self.__qb_torrents_reannounce(torrent_hashes=need_delete_hashes)
# 删除种子
if downloader.delete_torrents(ids=need_delete_hashes, delete_file=True):
@@ -2354,7 +2354,7 @@ class BrushFlow(_PluginBase):
seeding_torrents_dict: Dict[str, Any]):
brush_config = self.__get_brush_config()
if not self.downloader_helper.is_qbittorrent(service=self.service_info):
if not self.downloader_helper.is_downloader("qbittorrent", service=self.service_info):
logger.info("同步种子刷流标签记录目前仅支持qbittorrent")
return
@@ -2508,7 +2508,6 @@ class BrushFlow(_PluginBase):
"""
根据条件删除种子并获取已删除列表
"""
brush_config = self.__get_brush_config()
delete_hashes = []
for torrent in torrents:
@@ -2543,7 +2542,6 @@ class BrushFlow(_PluginBase):
"""
根据动态删除前置条件排除H&R种子后删除种子并获取已删除列表
"""
brush_config = self.__get_brush_config()
delete_hashes = []
for torrent in torrents:
@@ -3043,7 +3041,7 @@ class BrushFlow(_PluginBase):
if not downloader:
return None
if self.downloader_helper.is_qbittorrent(service=self.service_info):
if self.downloader_helper.is_downloader("qbittorrent", service=self.service_info):
# 限速值转为bytes
up_speed = up_speed * 1024 if up_speed else None
down_speed = down_speed * 1024 if down_speed else None
@@ -3077,7 +3075,7 @@ class BrushFlow(_PluginBase):
return torrent_hash
return None
elif self.downloader_helper.is_transmission(service=self.service_info):
elif self.downloader_helper.is_downloader("transmission", service=self.service_info):
# 如果开启代理下载以及种子地址不是磁力地址,则请求种子到内存再传入下载器
if not torrent_content.startswith("magnet"):
response = RequestUtils(cookies=cookies,
@@ -3125,7 +3123,7 @@ class BrushFlow(_PluginBase):
获取种子hash
"""
try:
return torrent.get("hash") if self.downloader_helper.is_qbittorrent(service=self.service_info) \
return torrent.get("hash") if self.downloader_helper.is_downloader("qbittorrent", service=self.service_info) \
else torrent.hashString
except Exception as e:
print(str(e))
@@ -3142,7 +3140,8 @@ class BrushFlow(_PluginBase):
all_hashes = []
for torrent in torrents:
# 根据下载器类型获取Hash值
hash_value = torrent.get("hash") if self.downloader_helper.is_qbittorrent(service=self.service_info) \
hash_value = torrent.get("hash") if self.downloader_helper.is_downloader("qbittorrent",
service=self.service_info) \
else torrent.hashString
if hash_value:
all_hashes.append(hash_value)
@@ -3157,7 +3156,8 @@ class BrushFlow(_PluginBase):
"""
try:
return [str(tag).strip() for tag in torrent.get("tags").split(',')] \
if self.downloader_helper.is_qbittorrent(service=self.service_info) else torrent.labels or []
if self.downloader_helper.is_downloader("qbittorrent",
service=self.service_info) else torrent.labels or []
except Exception as e:
print(str(e))
return []
@@ -3168,7 +3168,7 @@ class BrushFlow(_PluginBase):
"""
date_now = int(time.time())
# QB
if self.downloader_helper.is_qbittorrent(service=self.service_info):
if self.downloader_helper.is_downloader("qbittorrent", service=self.service_info):
"""
{
"added_on": 1693359031,

View File

@@ -338,17 +338,6 @@ class DownloadSiteTag(_PluginBase):
_cat = self._category_tv
return _cat
def _get_downloader(self, dtype: str):
"""
根据类型返回下载器实例
"""
if dtype == "qbittorrent":
return self.downloader_qb
elif dtype == "transmission":
return self.downloader_tr
else:
return None
@staticmethod
def _torrent_key(torrent: Any, dl_type: str) -> Optional[Tuple[int, str]]:
"""

View File

@@ -19,7 +19,7 @@ class MediaServerRefresh(_PluginBase):
# 插件图标
plugin_icon = "refresh2.png"
# 插件版本
plugin_version = "1.3"
plugin_version = "1.3.1"
# 插件作者
plugin_author = "jxxghp"
# 作者主页
@@ -204,16 +204,16 @@ class MediaServerRefresh(_PluginBase):
for name, service in self.service_infos.items():
# Emby
if self.mediaserver_helper.is_emby(service=service):
if self.mediaserver_helper.is_media_server("emby", service=service):
service.instance.refresh_library_by_items(items)
# Jeyllyfin
if self.mediaserver_helper.is_jellyfin(service=service):
if self.mediaserver_helper.is_media_server("jellyfin", service=service):
# FIXME Jellyfin未找到刷新单个项目的API
service.instance.refresh_root_library()
# Plex
if self.mediaserver_helper.is_plex(service=service):
if self.mediaserver_helper.is_media_server("plex", service=service):
service.instance.refresh_library_by_items(items)
def stop_service(self):

View File

@@ -28,7 +28,7 @@ class TorrentTransfer(_PluginBase):
# 插件图标
plugin_icon = "seed.png"
# 插件版本
plugin_version = "1.7"
plugin_version = "1.7.1"
# 插件作者
plugin_author = "jxxghp"
# 作者主页
@@ -566,7 +566,7 @@ class TorrentTransfer(_PluginBase):
if not service or not service.instance:
return
downloader = service.instance
if self.downloader_helper.is_qbittorrent(service):
if self.downloader_helper.is_downloader("qbittorrent", service=service):
# 生成随机Tag
tag = StringUtils.generate_random_str(10)
state = downloader.add_torrent(content=content,
@@ -582,7 +582,7 @@ class TorrentTransfer(_PluginBase):
logger.error(f"{downloader} 下载任务添加成功,但获取任务信息失败!")
return None
return torrent_hash
elif self.downloader_helper.is_transmission(service):
elif self.downloader_helper.is_downloader("transmission", service=service):
# 添加任务
torrent = downloader.add_torrent(content=content,
download_dir=save_path,
@@ -739,7 +739,7 @@ class TorrentTransfer(_PluginBase):
continue
# 如果源下载器是QB检查是否有Tracker没有的话额外获取
if self.downloader_helper.is_qbittorrent(from_service):
if self.downloader_helper.is_downloader("qbittorrent", service=from_service):
# 读取种子内容、解析种子文件
content = torrent_file.read_bytes()
if not content:
@@ -802,7 +802,7 @@ class TorrentTransfer(_PluginBase):
logger.info(f"成功添加转移做种任务,种子文件:{torrent_file}")
# TR会自动校验QB需要手动校验
if self.downloader_helper.is_qbittorrent(to_service):
if self.downloader_helper.is_downloader("qbittorrent", service=to_service):
logger.info(f"qbittorrent 开始校验 {download_id} ...")
to_downloader.recheck_torrents(ids=[download_id])