'Return array containing fileinfo dictionaries (name, length, path)'

def get_filelist(self):

    files = []
    if (u'length' in self.content[u'info']):
        t = {u'name': self.content[u'info'][u'name'], u'size': self.content[u'info'][u'length'], u'path': u''}
        files.append(t)
    else:
        for item in self.content[u'info'][u'files']:
            t = {u'path': u'/'.join(item[u'path'][:(-1)]), u'name': item[u'path'][(-1)], u'size': item[u'length']}
            files.append(t)
    for item in files:
        for field in (u'name', u'path'):
            if (not isinstance(item[field], str)):
                try:
                    item[field] = item[field].decode(self.content.get(u'encoding', u'cp1252'))
                except UnicodeError:
                    fallback = item[field].decode(u'utf-8', u'replace').replace(u'\ufffd', u'_')
                    log.warning((u'%s=%r    field    in    torrent    %r    is    wrongly    encoded,    falling    back    to    `%s`' % (field, item[field], self.content[u'info'][u'name'], fallback)))
                    item[field] = fallback
    return files
