def ls_music(self):
'''list music using a self._vk object. Use vk.audio.get()'''
get = self.vk.audio.get(uid=self.uid)
self.list_music = {}
for resp in get:
ent = Entry()
ent.id = resp['aid']
ent.url = resp['url']
self.list_music['{aid}.mp3'.format(**resp)] = ent
def readdir(self, path, file_handle):
if path == '/':
self.ls_music()
print ('readdir: Запрошен путь /')
#list_music = {m:self.stat('/' + m) for m in self.list_music}
#return list_music
return ['..','.'] + list(self.list_music.keys())
else:
raise OSError(errno.ENOENT)
данный код не может создать директорию, т.к. filler не заполняет ничего уже на первой итерации.
Код readdir (low-level):
def readdir(self, path, result, filler, offset, file_info):
for path in self.operations.readdir(path.decode('utf-8'), file_info.contents.fh):
print ('Путь ' + path)
if isinstance(path, str):
name, stat, offset = path, None, 0
else:
name, attributes, offset = path
if attributes:
stat = _c_stat()
_stat_set_attributes(stat, attributes)
else:
stat = None
if not filler(result, name.encode('utf-8'), stat, offset):
print ('breaking: filler {}, result {}, name {},stat {}, offset {}'.format(
filler(result, name.encode('utf-8'), stat, offset), result, name, stat, offset))
break
return 0
breaking: filler 0, result 139813869198080, name ..,stat None, offset 0
что делаю не так? Код биндинга fuse отсюда:http://paste.kde.org/538382/