def __init__(self): threading.Thread.__init__(self) self.newdir() try: dir, self.ignored, self.suspected = sabnzbd.load_admin( SCAN_FILE_NAME) if dir != self.dirscan_dir: self.ignored = {} self.suspected = {} except: self.ignored = {} # Will hold all unusable files and the # successfully processed ones that cannot be deleted self.suspected = { } # Will hold name/attributes of suspected candidates self.shutdown = False self.error_reported = False # Prevents mulitple reporting of missing watched folder self.dirscan_dir = cfg.dirscan_dir.get_path() self.dirscan_speed = cfg.dirscan_speed() self.busy = False self.trigger = False cfg.dirscan_dir.callback(self.newdir) cfg.dirscan_speed.callback(self.newspeed) DirScanner.do = self
def __init__(self): super().__init__() self.newdir() try: dirscan_dir, self.ignored, self.suspected = sabnzbd.load_admin( SCAN_FILE_NAME) if dirscan_dir != self.dirscan_dir: self.ignored = {} self.suspected = {} except: self.ignored = {} # Will hold all unusable files and the # successfully processed ones that cannot be deleted self.suspected = { } # Will hold name/attributes of suspected candidates self.loop_condition = threading.Condition(threading.Lock()) self.shutdown = False self.error_reported = False # Prevents multiple reporting of missing watched folder self.dirscan_dir = cfg.dirscan_dir.get_path() self.dirscan_speed = cfg.dirscan_speed( ) or None # If set to 0, use None so the wait() is forever self.busy = False cfg.dirscan_dir.callback(self.newdir) cfg.dirscan_speed.callback(self.newspeed)
def __init__(self): threading.Thread.__init__(self) self.newdir() try: dir, self.ignored, self.suspected = sabnzbd.load_admin(SCAN_FILE_NAME) if dir != self.dirscan_dir: self.ignored = {} self.suspected = {} except: self.ignored = {} # Will hold all unusable files and the # successfully processed ones that cannot be deleted self.suspected = {} # Will hold name/attributes of suspected candidates self.shutdown = False self.error_reported = False # Prevents mulitple reporting of missing watched folder self.dirscan_dir = cfg.dirscan_dir.get_path() self.dirscan_speed = cfg.dirscan_speed() self.busy = False self.trigger = False cfg.dirscan_dir.callback(self.newdir) cfg.dirscan_speed.callback(self.newspeed) DirScanner.do = self
def newspeed(self): """ We're notified of a scan speed change """ self.dirscan_speed = cfg.dirscan_speed() self.trigger = True
def newdir(self): """ We're notified of a dir change """ self.ignored = {} self.suspected = {} self.dirscan_dir = cfg.dirscan_dir.get_path() self.dirscan_speed = cfg.dirscan_speed()
def newspeed(self): """ We're notified of a scan speed change """ # If set to 0, use None so the wait() is forever self.dirscan_speed = cfg.dirscan_speed() or None with self.loop_condition: self.loop_condition.notify()