diff --git a/package.json b/package.json index f5b36a6..cc2c1f0 100644 --- a/package.json +++ b/package.json @@ -182,11 +182,12 @@ "name": "播放限速", "description": "外网播放媒体库视频时,自动对下载器进行限速。", "labels": "网络", - "version": "1.2.1", + "version": "1.3", "icon": "Librespeed_A.png", "author": "Shurelol", "level": 1, "history": { + "v1.3": "修复bug;增加预留带宽设置", "v1.2.1": "修复多下载器时限速比例计算错误问题", "v1.2": "增加不限速路径配置,以应对网盘直链播放的情况" } diff --git a/plugins/speedlimiter/__init__.py b/plugins/speedlimiter/__init__.py index dd1d829..62db177 100644 --- a/plugins/speedlimiter/__init__.py +++ b/plugins/speedlimiter/__init__.py @@ -23,7 +23,7 @@ class SpeedLimiter(_PluginBase): # 插件图标 plugin_icon = "Librespeed_A.png" # 插件版本 - plugin_version = "1.2.1" + plugin_version = "1.3" # 插件作者 plugin_author = "Shurelol" # 作者主页 @@ -48,6 +48,7 @@ class SpeedLimiter(_PluginBase): _noplay_up_speed: float = 0 _noplay_down_speed: float = 0 _bandwidth: float = 0 + _reserved_bandwidth: float = 0 _allocation_ratio: str = "" _auto_limit: bool = False _limit_enabled: bool = False @@ -72,6 +73,10 @@ class SpeedLimiter(_PluginBase): try: # 总带宽 self._bandwidth = int(float(config.get("bandwidth") or 0)) * 1000000 + self._reserved_bandwidth = int(float(config.get("reserved_bandwidth") or 0)) * 1000000 + # 减去预留带宽 + if self._reserved_bandwidth: + self._bandwidth -= self._reserved_bandwidth # 自动限速开关 if self._bandwidth > 0: self._auto_limit = True @@ -319,6 +324,23 @@ class SpeedLimiter(_PluginBase): } } ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ + { + 'component': 'VTextField', + 'props': { + 'model': 'reserved_bandwidth', + 'label': '预留带宽(应对突发流量和额外开销)', + 'placeholder': 'Mbps' + } + } + ] } ] },