limit_rate_value -> limit.bandwidth.kbps

This commit is contained in:
auouymous 2022-12-08 14:41:32 -07:00
parent 47aa09199d
commit 39f0376c81
3 changed files with 6 additions and 7 deletions

View File

@ -229,7 +229,6 @@ defaults = {
# The sooner this goes away, the better
gPodderSettings_LegacySupport = {
'limit_rate': 'limit.bandwidth.enabled',
'limit_rate_value': 'limit.bandwidth.kbps',
'max_downloads_enabled': 'limit.downloads.enabled',
'max_downloads': 'limit.downloads.concurrent',
'episode_old_age': 'auto.cleanup.days',

View File

@ -722,7 +722,7 @@ class DownloadTask(object):
# Variables for speed limit and speed calculation
self.__start_time = 0
self.__start_blocks = 0
self.__limit_rate_value = self._config.limit_rate_value
self.__limit_rate_value = self._config.limit.bandwidth.kbps
self.__limit_rate = self._config.limit_rate
# Progress update functions
@ -813,10 +813,10 @@ class DownloadTask(object):
self.__limit_rate = self._config.limit_rate
# Has the rate been changed and are we currently limiting?
if self.__limit_rate_value != self._config.limit_rate_value and self.__limit_rate:
if self.__limit_rate_value != self._config.limit.bandwidth.kbps and self.__limit_rate:
self.__start_time = now
self.__start_blocks = count
self.__limit_rate_value = self._config.limit_rate_value
self.__limit_rate_value = self._config.limit.bandwidth.kbps
passed = now - self.__start_time
if passed > 0:
@ -831,10 +831,10 @@ class DownloadTask(object):
self.speed = float(speed)
if self._config.limit_rate and speed > self._config.limit_rate_value:
if self._config.limit_rate and speed > self._config.limit.bandwidth.kbps:
# calculate the time that should have passed to reach
# the desired download rate and wait if necessary
should_have_passed = (count - self.__start_blocks) * blockSize / (self._config.limit_rate_value * 1024.0)
should_have_passed = (count - self.__start_blocks) * blockSize / (self._config.limit.bandwidth.kbps * 1024.0)
if should_have_passed > passed:
# sleep a maximum of 10 seconds to not cause time-outs
delay = min(10.0, float(should_have_passed - passed))

View File

@ -152,7 +152,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
self.config.connect_gtk_spinbutton('limit.downloads.concurrent', self.spinMaxDownloads,
self.config.limit.downloads.concurrent_max)
self.config.connect_gtk_togglebutton('max_downloads_enabled', self.cbMaxDownloads)
self.config.connect_gtk_spinbutton('limit_rate_value', self.spinLimitDownloads)
self.config.connect_gtk_spinbutton('limit.bandwidth.kbps', self.spinLimitDownloads)
self.config.connect_gtk_togglebutton('limit_rate', self.cbLimitDownloads)
self.spinMaxDownloads.set_sensitive(self.cbMaxDownloads.get_active())