Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: interfaces/Plush/language/us-en.txt
- ===================================================================
- --- interfaces/Plush/language/us-en.txt (revision 3079)
- +++ interfaces/Plush/language/us-en.txt (working copy)
- @@ -4,6 +4,7 @@
- # Menu
- maxSpeed Max Speed
- +maxbytes Max Bytes
- options Plush Options
- refreshRate Refresh Rate
- confirmDeleteQueue Confirm Queue Deletions
- Index: interfaces/Plush/templates/config_general.tmpl
- ===================================================================
- --- interfaces/Plush/templates/config_general.tmpl (revision 3079)
- +++ interfaces/Plush/templates/config_general.tmpl (working copy)
- @@ -133,6 +133,11 @@
- <input type="text" name="bandwidth_limit" value="$bandwidth_limit" size=8 />
- <br/><br/>
- + <strong>$T('opt-byte_limit'):</strong><br/>
- + <small>$T('explain-byte_limit')</small><br/>
- + <input type="text" name="byte_limit" value="$byte_limit" size=8 />
- +
- + <br/><br/>
- <strong>$T('opt-cache_limitstr'):</strong><br/>
- <small>$T('explain-cache_limitstr')</small><br/>
- <input type="text" name="cache_limit" value="$cache_limit" size=8 />
- Index: language/us-en.txt
- ===================================================================
- --- language/us-en.txt (revision 3079)
- +++ language/us-en.txt (working copy)
- @@ -113,6 +113,7 @@
- hibernatePc Hibernate PC
- shutdownSab Shutdown SABnzbd
- speedLimit Speed Limit
- +bytelimit Byte Limit
- pauseFor Pause for
- mode Processing
- order Order
- @@ -214,6 +215,9 @@
- explain-rss_rate Checking interval (in minutes, at least 15).
- opt-bandwidth_limit Download Speed Limit
- explain-bandwidth_limit Download rate limit (in KB/s - kilobytes per second).
- +opt-byte_limit Byte Limit
- +explain-byte_limit Download byte limit before connection reset (in KB/s - kilobytes). \n\
- + <i>Helpful when throughput is increased durring initial download session.</i>
- opt-cache_limitstr Article Cache Limit
- explain-cache_limitstr Cache articles in memory to reduce disk access.\n\
- <i>In bytes, optionally follow with K,M,G. For example: "64M" or "128M"</i>
- Index: sabnzbd/cfg.py
- ===================================================================
- --- sabnzbd/cfg.py (revision 3079)
- +++ sabnzbd/cfg.py (working copy)
- @@ -150,6 +150,9 @@
- USERNAME = OptionStr('misc', 'username')
- PASSWORD = OptionPassword('misc', 'password')
- BANDWIDTH_LIMIT = OptionNumber('misc', 'bandwidth_limit', 0)
- +# BYTE_LIMIT Test Code - Begin
- +BYTE_LIMIT = OptionNumber('misc', 'byte_limit', 0)
- +# BYTE_LIMIT Test Code - End
- REFRESH_RATE = OptionNumber('misc', 'refresh_rate', 0)
- RSS_RATE = OptionNumber('misc', 'rss_rate', 60, 15, 24*60)
- CACHE_LIMIT = OptionStr('misc', 'cache_limit')
- Index: sabnzbd/downloader.py
- ===================================================================
- --- sabnzbd/downloader.py (revision 3079)
- +++ sabnzbd/downloader.py (working copy)
- @@ -135,6 +135,14 @@
- if __DOWNLOADER: __DOWNLOADER.limit_speed(int(value))
- logging.info("Bandwidth limit set to %s", value)
- +# Byte_Limit - Test Code - Begin
- +@synchronized_CV
- +def limit_byte(value):
- + global __DOWNLOADER
- + if __DOWNLOADER: __DOWNLOADER.limit_byte(int(value))
- + logging.info("Byte limit set to %s", value)
- +# Byte_Limit - Test Code - End
- +
- def update_server(oldserver, newserver):
- global __DOWNLOADER
- try:
- @@ -157,6 +165,12 @@
- global __DOWNLOADER
- if __DOWNLOADER: return __DOWNLOADER.get_limit()
- +# Byte_Limit - Test Code - Begin
- +def get_byte_limit():
- + global __DOWNLOADER
- + if __DOWNLOADER: return __DOWNLOADER.get_byte_limit()
- +# Byte Limit - Test Code - End
- +
- def disconnect():
- global __DOWNLOADER
- if __DOWNLOADER: __DOWNLOADER.disconnect()
- @@ -233,6 +247,11 @@
- self.bandwidth_limit = cfg.BANDWIDTH_LIMIT.get()
- cfg.BANDWIDTH_LIMIT.callback(self.speed_set)
- + #Byte_Limit Test Code - Begin
- + self.byte_limit = cfg.BYTE_LIMIT.get() * 1024
- + cfg.BYTE_LIMIT.callback(self.byte_limit_set)
- + #Byte_Limit Test Code - End
- +
- # Used for reducing speed
- self.delayed = False
- @@ -348,6 +367,17 @@
- def speed_set(self):
- self.bandwidth_limit = cfg.BANDWIDTH_LIMIT.get()
- + # Byte_Limit Test Code - Begin
- + def limit_bytes(self, value):
- + self.byte_limit = value
- +
- + def get_byte_limit(self):
- + return self.byte_limit
- +
- + def byte_limit_set(self):
- + self.byte_limit = cfg.BYTE_LIMIT.get() * 1024
- + # Byte_Limit Test Code - End
- +
- def is_paused(self):
- if not self.paused:
- return False
- @@ -519,6 +549,20 @@
- self.__reset_nw(nw, "server closed connection", warn=False, wait=False)
- continue
- + # Begin Thread Byte Limit Code
- + if self.byte_limit > 0:
- + bpsmeter.method.update(bytes)
- + try:
- + bytecount = bytecount + bytes
- + # logging.info("Byte Limit: %s, Byte Count: %s, Bytes: %s, NW: %s", self.byte_limit, bytecount, bytes, nw)
- + if bytecount > self.byte_limit:
- + self.__reset_nw(nw, "byte limit reached for thread", warn=False, wait=False, destroy=False)
- + bytecount = 0
- + continue
- + except NameError:
- + bytecount = 0
- + # End Thread Byte Limit Code
- +
- else:
- if self.bandwidth_limit:
- bps = bpsmeter.method.get_bps()
- Index: sabnzbd/interface.py
- ===================================================================
- --- sabnzbd/interface.py (revision 3079)
- +++ sabnzbd/interface.py (working copy)
- @@ -1683,6 +1683,9 @@
- conf['username'] = cfg.USERNAME.get()
- conf['password'] = cfg.PASSWORD.get_stars()
- conf['bandwidth_limit'] = cfg.BANDWIDTH_LIMIT.get()
- +# Byte_Limit Test Code - Begin
- + conf['byte_limit'] = cfg.BYTE_LIMIT.get()
- +# Byte_Limit Test Code - End
- conf['refresh_rate'] = cfg.REFRESH_RATE.get()
- conf['rss_rate'] = cfg.RSS_RATE.get()
- conf['cache_limit'] = cfg.CACHE_LIMIT.get()
- @@ -1739,6 +1742,13 @@
- bandwidth_limit = IntConv(bandwidth_limit)
- cfg.BANDWIDTH_LIMIT.set(bandwidth_limit)
- +# Byte_Limit Test Code - Begin
- + byte_limit = kwargs.get('byte_limit')
- + if byte_limit != None:
- + byte_limit = IntConv(byte_limit)
- + cfg.BYTE_LIMIT.set(byte_limit)
- +# Byte_Limit Test Code - End
- +
- config.save_config()
- # Update CherryPy authentication
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement