limit_rate -> limit.bandwidth.enabled

This commit is contained in:
auouymous 2022-12-08 14:45:24 -07:00
parent 39f0376c81
commit 8eb60b8ccf
3 changed files with 6 additions and 7 deletions

View File

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

View File

@ -723,7 +723,7 @@ class DownloadTask(object):
self.__start_time = 0
self.__start_blocks = 0
self.__limit_rate_value = self._config.limit.bandwidth.kbps
self.__limit_rate = self._config.limit_rate
self.__limit_rate = self._config.limit.bandwidth.enabled
# Progress update functions
self._progress_updated = None
@ -805,12 +805,12 @@ class DownloadTask(object):
now = time.time()
if self.__start_time > 0:
# Has rate limiting been enabled or disabled?
if self.__limit_rate != self._config.limit_rate:
if self.__limit_rate != self._config.limit.bandwidth.enabled:
# If it has been enabled then reset base time and block count
if self._config.limit_rate:
if self._config.limit.bandwidth.enabled:
self.__start_time = now
self.__start_blocks = count
self.__limit_rate = self._config.limit_rate
self.__limit_rate = self._config.limit.bandwidth.enabled
# Has the rate been changed and are we currently limiting?
if self.__limit_rate_value != self._config.limit.bandwidth.kbps and self.__limit_rate:
@ -831,7 +831,7 @@ class DownloadTask(object):
self.speed = float(speed)
if self._config.limit_rate and speed > self._config.limit.bandwidth.kbps:
if self._config.limit.bandwidth.enabled 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.bandwidth.kbps * 1024.0)

View File

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