Ejemplo n.º 1
0
 def unlink(self, path):
     try:
         if is_nzbfs_file(self.db_root + path, 'user.nzbfs.type'):
             with self._attr_lock:
                 file_size = get_nzbfs_attr(self.db_root + path, 'size')
                 self.total_files -= 1
                 self.total_size -= file_size
     finally:
         return os.unlink(self.db_root + path)
Ejemplo n.º 2
0
    def getattr(self, path, fh=None):
        path, israw = self._raw_path(path)

        st = os.lstat(self.db_root + path)

        d = {
            key: getattr(st, key)
            for key in ('st_atime', 'st_ctime', 'st_gid', 'st_mode',
                        'st_mtime', 'st_nlink', 'st_size', 'st_uid')
        }

        if stat.S_ISREG(st.st_mode):
            file_size = get_nzbfs_attr(self.db_root + path, 'size')
            if file_size is not None:
                d['st_size'] = file_size
            file_mtime = get_nzbfs_attr(self.db_root + path, 'mtime')
            if file_mtime is not None:
                d['st_mtime'] = file_mtime
        d['st_blocks'] = d['st_size'] / 512

        return d
Ejemplo n.º 3
0
 def _get_attr(self):
     return get_nzbfs_attr(self.db_root, attr)