def _init_storage(self): storage_folder = self.config.get('general', 'storage_folder') if not storage_folder: storage_folder = os.path.join(USERDIR, 'Downloads') self.log.debug("Storage: {0}".format(storage_folder)) makedirs(storage_folder) space_size = format.size(availspace(storage_folder)) self.log.info(_("Available storage space: {0}").format(space_size))
def work(self): """ Main routine that does the periodical work. """ self.try_reconnect() if (availspace(self.pyload.config.get('general', 'storage_folder')) < self.pyload.config.get('general', 'min_storage_size') << 20): self.pyload.log.warning(_("Not enough space left on device")) self.pause = True # if self.pause or not self.pyload.api.is_time_download(): # return False if self.pause: return False # at least one thread want reconnect and we are supposed to wait if self.pyload.config.get('reconnect', 'wait') and self.want_reconnect() > 1: return False self.assign_jobs()
def work(self): """ Main routine that does the periodical work. """ self.try_reconnect() if (availspace(self.pyload.config.get('general', 'storage_folder')) < self.pyload.config.get('general', 'min_storage_size') << 20): self.pyload.log.warning(_("Not enough space left on device")) self.pause = True # if self.pause or not self.pyload.api.is_time_download(): # return False if self.pause: return False # at least one thread want reconnect and we are supposed to wait if self.pyload.config.get( 'reconnect', 'wait') and self.want_reconnect() > 1: return False self.assign_jobs()
def avail_space(self): """ Available free space at download directory in bytes. """ return availspace(self.pyload.config.get('general', 'storage_folder'))