Merge branch 'jxxghp:main' into main
This commit is contained in:
commit
2a47d5f172
@ -489,7 +489,7 @@ class BestFilmVersion(_PluginBase):
|
|||||||
"poster": mediainfo.get_poster_image(),
|
"poster": mediainfo.get_poster_image(),
|
||||||
"overview": mediainfo.overview,
|
"overview": mediainfo.overview,
|
||||||
"tmdbid": mediainfo.tmdb_id,
|
"tmdbid": mediainfo.tmdb_id,
|
||||||
"time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
"time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
})
|
})
|
||||||
# 保存历史记录
|
# 保存历史记录
|
||||||
self.save_data('history', history)
|
self.save_data('history', history)
|
||||||
@ -668,7 +668,7 @@ class BestFilmVersion(_PluginBase):
|
|||||||
"poster": mediainfo.get_poster_image(),
|
"poster": mediainfo.get_poster_image(),
|
||||||
"overview": mediainfo.overview,
|
"overview": mediainfo.overview,
|
||||||
"tmdbid": mediainfo.tmdb_id,
|
"tmdbid": mediainfo.tmdb_id,
|
||||||
"time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
"time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
})
|
})
|
||||||
# 保存历史记录
|
# 保存历史记录
|
||||||
self.save_data('history', history)
|
self.save_data('history', history)
|
||||||
|
@ -50,6 +50,8 @@ class SpeedLimiter(_PluginBase):
|
|||||||
_play_down_speed: float = 0
|
_play_down_speed: float = 0
|
||||||
_noplay_up_speed: float = 0
|
_noplay_up_speed: float = 0
|
||||||
_noplay_down_speed: float = 0
|
_noplay_down_speed: float = 0
|
||||||
|
# 当前限速状态
|
||||||
|
_current_state = ""
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
# 读取配置
|
# 读取配置
|
||||||
@ -330,6 +332,13 @@ class SpeedLimiter(_PluginBase):
|
|||||||
"""
|
"""
|
||||||
if not self._qb and not self._tr:
|
if not self._qb and not self._tr:
|
||||||
return
|
return
|
||||||
|
state = f"U:{upload_limit},D:{download_limit}"
|
||||||
|
if self._current_state == state:
|
||||||
|
# 限速状态没有改变
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
self._current_state = state
|
||||||
|
|
||||||
if upload_limit:
|
if upload_limit:
|
||||||
text = f"上传:{upload_limit} KB/s"
|
text = f"上传:{upload_limit} KB/s"
|
||||||
else:
|
else:
|
||||||
@ -342,23 +351,39 @@ class SpeedLimiter(_PluginBase):
|
|||||||
if self._qb:
|
if self._qb:
|
||||||
self._qb.set_speed_limit(download_limit=download_limit, upload_limit=upload_limit)
|
self._qb.set_speed_limit(download_limit=download_limit, upload_limit=upload_limit)
|
||||||
# 发送通知
|
# 发送通知
|
||||||
if self._notify and (upload_limit or download_limit):
|
if self._notify:
|
||||||
title = f"Qbittorrent 开始{limit_type}限速"
|
title = "【播放限速】"
|
||||||
self.post_message(
|
if upload_limit or download_limit:
|
||||||
mtype=NotificationType.MediaServer,
|
subtitle = f"Qbittorrent 开始{limit_type}限速"
|
||||||
title=title,
|
self.post_message(
|
||||||
text=text
|
mtype=NotificationType.MediaServer,
|
||||||
)
|
title=title,
|
||||||
|
text=f"{subtitle}\n{text}"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.post_message(
|
||||||
|
mtype=NotificationType.MediaServer,
|
||||||
|
title=title,
|
||||||
|
text=f"Qbittorrent 已取消限速"
|
||||||
|
)
|
||||||
if self._tr:
|
if self._tr:
|
||||||
self._tr.set_speed_limit(download_limit=download_limit, upload_limit=upload_limit)
|
self._tr.set_speed_limit(download_limit=download_limit, upload_limit=upload_limit)
|
||||||
# 发送通知
|
# 发送通知
|
||||||
if self._notify and (upload_limit or download_limit):
|
if self._notify:
|
||||||
title = f"Transmission 开始{limit_type}限速"
|
title = "【播放限速】"
|
||||||
self.post_message(
|
if upload_limit or download_limit:
|
||||||
mtype=NotificationType.MediaServer,
|
subtitle = f"Transmission 开始{limit_type}限速"
|
||||||
title=title,
|
self.post_message(
|
||||||
text=text
|
mtype=NotificationType.MediaServer,
|
||||||
)
|
title=title,
|
||||||
|
text=f"{subtitle}\n{text}"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.post_message(
|
||||||
|
mtype=NotificationType.MediaServer,
|
||||||
|
title=title,
|
||||||
|
text=f"Transmission 已取消限速"
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"设置限速失败:{str(e)}")
|
logger.error(f"设置限速失败:{str(e)}")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user