Example #1
0
 def unlink(self, path):
     try:
         if xattr.getxattr(self.db_root + path, 'user.nzbfs.type') == 'nzb':
             with self._attr_lock:
                 self.total_files -= 1
                 self.total_size -= get_nzf_attr(self.db_root + path, 'size')
     finally:
         return os.unlink(self.db_root + path)
Example #2
0
 def unlink(self, path):
     try:
         if xattr.getxattr(self.db_root + path, 'user.nzbfs.type') == 'nzb':
             with self._attr_lock:
                 self.total_files -= 1
                 self.total_size -= get_nzf_attr(self.db_root + path,
                                                 'size')
     finally:
         return os.unlink(self.db_root + path)
Example #3
0
    def getattr(self, path, fh=None):
        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):
            nzf_size = get_nzf_attr(self.db_root + path, 'size')
            if nzf_size is not None:
                d['st_size'] = nzf_size
            nzf_mtime = get_nzf_attr(self.db_root + path, 'mtime')
            if nzf_mtime is not None:
                d['st_mtime'] = nzf_mtime
        d['st_blocks'] = d['st_size'] / 512

        return d
Example #4
0
    def getattr(self, path, fh=None):
        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):
            nzf_size = get_nzf_attr(self.db_root + path, 'size')
            if nzf_size is not None:
                d['st_size'] = nzf_size
            nzf_mtime = get_nzf_attr(self.db_root + path, 'mtime')
            if nzf_mtime is not None:
                d['st_mtime'] = nzf_mtime
        d['st_blocks'] = d['st_size'] / 512

        return d
Example #5
0
 def _get_attr(self):
     return get_nzf_attr(self.db_root, attr)
Example #6
0
 def _get_attr(self):
     return get_nzf_attr(self.db_root, attr)