コード例 #1
0
ファイル: filesystem.py プロジェクト: edgiru/yandex.fotki.2
 def _getattr_for_photo(self, photo):
     '''
     Возвращает информацию для фотографии.
     @param photo: Photo
     @return: Stat
     '''
     info = fuse.Stat()
     info.st_mode = stat.S_IFREG | self._get_access_mode(False)
     # Для обычного файла равно 1:
     info.st_nlink = 1
     context = self.GetContext()
     info.st_uid = context['uid']
     info.st_gid = context['gid']
     info.st_size = photo.size
     info.st_atime = to_timestamp(datetime.utcnow())
     info.st_mtime = to_timestamp(photo.updated)
     info.st_ctime = to_timestamp(photo.published)
     return info
コード例 #2
0
ファイル: filesystem.py プロジェクト: edgiru/yandex.fotki.2
 def _getattr_for_album(self, album):
     '''
     Возвращает информацию для альбома.
     @param album: Album
     @return: Stat
     '''
     info = fuse.Stat()
     info.st_mode = stat.S_IFDIR | self._get_access_mode(True)
     # Для директорий высчитывается как 2 + количество поддиректорий:
     info.st_nlink = 2
     context = self.GetContext()
     info.st_uid = context['uid']
     info.st_gid = context['gid']
     info.st_size = album.photo_count
     info.st_atime = to_timestamp(datetime.utcnow())
     info.st_mtime = to_timestamp(album.updated)
     info.st_ctime = to_timestamp(album.published) 
     return info