Disable watched folder when scheduled
Posted: November 19th, 2012, 7:48 am
Hi,
I suggest to disable watched folder scan speed when a scan is scheduled. Useful on a server (NAS), when you want use the watched folder features and allow hdd to sleep.
I made a little patch that will do the job (use the scan speed value with 0 to disable watched folder scan speed):
But I want to be auto-disable when a scan is scheduled (not have to put 0 in scan speed). So I read sabnzbd/scheduler.py but I don't understand when init() function is called and how to have the information of a schedule in Dirscanner class
.
Can someone help me ?
I suggest to disable watched folder scan speed when a scan is scheduled. Useful on a server (NAS), when you want use the watched folder features and allow hdd to sleep.
I made a little patch that will do the job (use the scan speed value with 0 to disable watched folder scan speed):
Code: Select all
--- SABnzbd-0.7.6_original/sabnzbd/dirscanner.py 2012-11-17 15:58:37.000000000 +0100
+++ SABnzbd-0.7.6/sabnzbd/dirscanner.py 2012-11-19 10:41:19.316211000 +0100
@@ -266,15 +266,19 @@
self.shutdown = False
while not self.shutdown:
- # Use variable scan delay
- x = max(self.dirscan_speed, 1)
- while (x > 0) and not self.shutdown and not self.trigger:
- time.sleep(1.0)
- x = x - 1
- self.trigger = False
- if self.dirscan_speed and not self.shutdown:
- self.scan()
+ if self.dirscan_speed = 0
+ time.sleep(60.0)
+ else:
+ # Use variable scan delay
+ x = max(self.dirscan_speed, 1)
+ while (x > 0) and not self.shutdown and not self.trigger:
+ time.sleep(1.0)
+ x = x - 1
+
+ self.trigger = False
+ if self.dirscan_speed and not self.shutdown:
+ self.scan()
def scan(self):
""" Do one scan of the watched folder """
Can someone help me ?