Ejemplo n.º 1
0
 def _setup_storage(self):
     storage_folder = self.config.get('general', 'storage_folder')
     if not storage_folder:
         storage_folder = os.path.join(USERDIR, self.DEFAULT_STORAGEDIRNAME)
         self.config.set('general', 'storage_folder', storage_folder)
     self.log.debug("Storage: {0}".format(storage_folder))
     makedirs(storage_folder, exist_ok=True)
     avail_space = format.size(availspace(storage_folder))
     self.log.info(
         self._("Available storage space: {0}").format(avail_space))
Ejemplo n.º 2
0
    def _setup_storage(self):
        self.log.debug('Setup storage...')

        storage_folder = self.config.get('general', 'storage_folder')
        if storage_folder is None:
            storage_folder = os.path.join(builtins.USERDIR,
                                          self.DEFAULT_STORAGENAME)
        self.log.info(self._('Storage: {0}'.format(storage_folder)))
        makedirs(storage_folder, exist_ok=True)
        avail_space = format.size(availspace(storage_folder))
        self.log.info(
            self._('Available storage space: {0}').format(avail_space))
Ejemplo n.º 3
0
    def _setup_storage(self):
        self.log.debug('Setup storage...')

        storage_folder = self.config.get('general', 'storage_folder')
        if storage_folder is None:
            storage_folder = os.path.join(
                builtins.USERDIR, self.DEFAULT_STORAGENAME)
        self.log.info(self._('Storage: {0}'.format(storage_folder)))
        makedirs(storage_folder, exist_ok=True)
        avail_space = format.size(availspace(storage_folder))
        self.log.info(
            self._('Available storage space: {0}').format(avail_space))
Ejemplo n.º 4
0
    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(
                self._('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()
Ejemplo n.º 5
0
 def avail_space(self):
     """Available free space at download directory in bytes."""
     return availspace(self.pyload.config.get('general', 'storage_folder'))