def guard_pause_on_pp(): """ Callback for change of pause-download-on-pp """ if cfg.pause_on_post_processing(): pass # Not safe to idle downloader, because we don't know # if post-processing is active now else: Downloader.do.resume_from_postproc()
def run(self): """ Postprocessor loop """ # First we do a dircheck complete_dir = sabnzbd.cfg.complete_dir.get_path() if sabnzbd.utils.checkdir.isFAT(complete_dir): logging.warning(T('Completed Download Folder %s is on FAT file system, limiting maximum file size to 4GB') % complete_dir) else: logging.info("Completed Download Folder %s is not on FAT", complete_dir) # Start looping check_eoq = False while not self.__stop: self.__busy = False if self.paused: time.sleep(5) continue try: nzo = self.queue.get(timeout=1) if 0: assert isinstance(nzo, sabnzbd.nzbstuff.NzbObject) except Queue.Empty: if check_eoq: check_eoq = False handle_empty_queue() continue else: nzo = self.queue.get() # Stop job if not nzo: continue # Job was already deleted. if not nzo.work_name: check_eoq = True continue # Flag NZO as being processed nzo.pp_active = True # Pause downloader, if users wants that if cfg.pause_on_post_processing(): sabnzbd.downloader.Downloader.do.wait_for_postproc() self.__busy = True process_job(nzo) if nzo.to_be_removed: history_db = database.HistoryDB() history_db.remove_history(nzo.nzo_id) history_db.close() nzo.purge_data(keep_basic=False, del_files=True) self.remove(nzo) check_eoq = True # Allow download to proceed sabnzbd.downloader.Downloader.do.resume_from_postproc()
def run(self): """ Actual processing """ check_eoq = False while not self.__stop: self.__busy = False if self.paused: time.sleep(5) continue try: nzo = self.queue.get(timeout=1) if 0: assert isinstance(nzo, sabnzbd.nzbstuff.NzbObject) except Queue.Empty: if check_eoq: check_eoq = False handle_empty_queue() continue else: nzo = self.queue.get() # Stop job if not nzo: continue # Job was already deleted. if not nzo.work_name: check_eoq = True continue # Flag NZO as being processed nzo.pp_active = True # Pause downloader, if users wants that if cfg.pause_on_post_processing(): sabnzbd.downloader.Downloader.do.wait_for_postproc() self.__busy = True process_job(nzo) if nzo.to_be_removed: history_db = database.HistoryDB() history_db.remove_history(nzo.nzo_id) history_db.close() nzo.purge_data(keep_basic=False, del_files=True) self.remove(nzo) check_eoq = True # Allow download to proceed sabnzbd.downloader.Downloader.do.resume_from_postproc()
def run(self): """ Actual processing """ check_eoq = False while not self.__stop: self.__busy = False if self.paused: time.sleep(5) continue try: nzo = self.queue.get(timeout=1) except Queue.Empty: if check_eoq: check_eoq = False handle_empty_queue() continue else: nzo = self.queue.get() ## Stop job if not nzo: continue ## Job was already deleted. if not nzo.work_name: check_eoq = True continue ## Flag NZO as being processed nzo.pp_active = True ## Pause downloader, if users wants that if cfg.pause_on_post_processing(): sabnzbd.downloader.Downloader.do.wait_for_postproc() self.__busy = True process_job(nzo) self.remove(nzo) check_eoq = True ## Allow download to proceed sabnzbd.downloader.Downloader.do.resume_from_postproc()
def run(self): """ Postprocessor loop """ # First we do a dircheck complete_dir = sabnzbd.cfg.complete_dir.get_path() if sabnzbd.utils.checkdir.isFAT(complete_dir): logging.warning_helpful( T("Completed Download Folder %s is on FAT file system, limiting maximum file size to 4GB" ) % complete_dir) else: logging.info("Completed Download Folder %s is not on FAT", complete_dir) # Start looping check_eoq = False while not self.__stop: self.__busy = False if self.paused: time.sleep(5) continue # Something in the fast queue? try: # Every few fast-jobs we should check allow a # slow job so that they don't wait forever if self.__fast_job_count >= MAX_FAST_JOB_COUNT and self.slow_queue.qsize( ): raise queue.Empty nzo = self.fast_queue.get(timeout=2) self.__fast_job_count += 1 except queue.Empty: # Try the slow queue try: nzo = self.slow_queue.get(timeout=2) # Reset fast-counter self.__fast_job_count = 0 except queue.Empty: # Check for empty queue if check_eoq: check_eoq = False handle_empty_queue() # No fast or slow jobs, better luck next loop! continue # Stop job if not nzo: continue # Job was already deleted. if not nzo.work_name: check_eoq = True continue # Flag NZO as being processed nzo.pp_active = True # Pause downloader, if users wants that if cfg.pause_on_post_processing(): sabnzbd.downloader.Downloader.do.wait_for_postproc() self.__busy = True process_job(nzo) if nzo.to_be_removed: history_db = database.HistoryDB() history_db.remove_history(nzo.nzo_id) history_db.close() nzo.purge_data() # Processing done nzo.pp_active = False self.remove(nzo) check_eoq = True # Allow download to proceed sabnzbd.downloader.Downloader.do.resume_from_postproc()
def run(self): """ Postprocessor loop """ # First we do a dircheck complete_dir = sabnzbd.cfg.complete_dir.get_path() if sabnzbd.utils.checkdir.isFAT(complete_dir): logging.warning( T('Completed Download Folder %s is on FAT file system, limiting maximum file size to 4GB' ) % complete_dir) else: logging.info("Completed Download Folder %s is not on FAT", complete_dir) # Check on Windows if we have unicode-subprocess if sabnzbd.WIN32: try: import subprocessww except ImportError: logging.warning( T('Module subprocessww missing. Expect problems with Unicoded file and directory names in downloads.' )) # Do a pruge of the history-items if it was set, just to be sure history_db = database.HistoryDB() history_db.auto_history_purge() history_db.close() # Start looping check_eoq = False while not self.__stop: self.__busy = False if self.paused: time.sleep(5) continue # Something in the fast queue? try: # Every few fast-jobs we should check allow a # slow job so that they don't wait forever if self.__fast_job_count >= MAX_FAST_JOB_COUNT and self.slow_queue.qsize( ): raise Queue.Empty nzo = self.fast_queue.get(timeout=2) self.__fast_job_count += 1 except Queue.Empty: # Try the slow queue try: nzo = self.slow_queue.get(timeout=2) # Reset fast-counter self.__fast_job_count = 0 except Queue.Empty: # Check for empty queue if check_eoq: check_eoq = False handle_empty_queue() # No fast or slow jobs, better luck next loop! continue # Stop job if not nzo: continue # Job was already deleted. if not nzo.work_name: check_eoq = True continue # Flag NZO as being processed nzo.pp_active = True # Pause downloader, if users wants that if cfg.pause_on_post_processing(): sabnzbd.downloader.Downloader.do.wait_for_postproc() self.__busy = True process_job(nzo) if nzo.to_be_removed: history_db = database.HistoryDB() history_db.remove_history(nzo.nzo_id) history_db.close() nzo.purge_data(keep_basic=False, del_files=True) # Processing done nzo.pp_active = False self.remove(nzo) check_eoq = True # Allow download to proceed sabnzbd.downloader.Downloader.do.resume_from_postproc()
def run(self): """ Postprocessor loop """ # First we do a dircheck complete_dir = sabnzbd.cfg.complete_dir.get_path() if sabnzbd.utils.checkdir.isFAT(complete_dir): logging.warning(T('Completed Download Folder %s is on FAT file system, limiting maximum file size to 4GB') % complete_dir) else: logging.info("Completed Download Folder %s is not on FAT", complete_dir) # Check on Windows if we have unicode-subprocess if sabnzbd.WIN32: try: import subprocessww except ImportError: logging.warning(T('Module subprocessww missing. Expect problems with Unicoded file and directory names in downloads.')) # Do a pruge of the history-items if it was set, just to be sure history_db = database.HistoryDB() history_db.auto_history_purge() history_db.close() # Start looping check_eoq = False while not self.__stop: self.__busy = False if self.paused: time.sleep(5) continue # Something in the fast queue? try: # Every few fast-jobs we should check allow a # slow job so that they don't wait forever if self.__fast_job_count >= MAX_FAST_JOB_COUNT and self.slow_queue.qsize(): raise Queue.Empty nzo = self.fast_queue.get(timeout=2) self.__fast_job_count += 1 except Queue.Empty: # Try the slow queue try: nzo = self.slow_queue.get(timeout=2) # Reset fast-counter self.__fast_job_count = 0 except Queue.Empty: # Check for empty queue if check_eoq: check_eoq = False handle_empty_queue() # No fast or slow jobs, better luck next loop! continue # Stop job if not nzo: continue # Job was already deleted. if not nzo.work_name: check_eoq = True continue # Flag NZO as being processed nzo.pp_active = True # Pause downloader, if users wants that if cfg.pause_on_post_processing(): sabnzbd.downloader.Downloader.do.wait_for_postproc() self.__busy = True process_job(nzo) if nzo.to_be_removed: history_db = database.HistoryDB() history_db.remove_history(nzo.nzo_id) history_db.close() nzo.purge_data(keep_basic=False, del_files=True) # Processing done nzo.pp_active = False self.remove(nzo) check_eoq = True # Allow download to proceed sabnzbd.downloader.Downloader.do.resume_from_postproc()
def run(self): """ Postprocessor loop """ # First we do a dircheck complete_dir = sabnzbd.cfg.complete_dir.get_path() if sabnzbd.utils.checkdir.isFAT(complete_dir): logging.warning( T('Completed Download Folder %s is on FAT file system, limiting maximum file size to 4GB' ) % complete_dir) else: logging.info("Completed Download Folder %s is not on FAT", complete_dir) # Check on Windows if we have unicode-subprocess if sabnzbd.WIN32: try: import subprocessww except ImportError: logging.warning( T('Module subprocessww missing. Expect problems with Unicoded file and directory names in downloads.' )) # Start looping check_eoq = False while not self.__stop: self.__busy = False if self.paused: time.sleep(5) continue try: nzo = self.queue.get(timeout=1) except Queue.Empty: if check_eoq: check_eoq = False handle_empty_queue() continue else: nzo = self.queue.get() # Stop job if not nzo: continue # Job was already deleted. if not nzo.work_name: check_eoq = True continue # Flag NZO as being processed nzo.pp_active = True # Pause downloader, if users wants that if cfg.pause_on_post_processing(): sabnzbd.downloader.Downloader.do.wait_for_postproc() self.__busy = True process_job(nzo) if nzo.to_be_removed: history_db = database.HistoryDB() history_db.remove_history(nzo.nzo_id) history_db.close() nzo.purge_data(keep_basic=False, del_files=True) # Processing done nzo.pp_active = False self.remove(nzo) check_eoq = True # Allow download to proceed sabnzbd.downloader.Downloader.do.resume_from_postproc()