'Construct the directory name for this book based on its metadata.'

def construct_path_name(self, book_id, title, author):

    book_id = (u'    (%d)' % book_id)
    l = ((self.PATH_LIMIT - (len(book_id) // 2)) - 2)
    author = ascii_filename(author)[:l].decode(u'ascii', u'replace')
    title = ascii_filename(title.lstrip())[:l].decode(u'ascii', u'replace').rstrip()
    if (not title):
        title = u'Unknown'[:l]
    try:
        while (author[(-1)] in (u'    ', u'.')):
            author = author[:(-1)]
    except IndexError:
        author = u''
    if (not author):
        author = ascii_filename(_(u'Unknown')).decode(u'ascii', u'replace')
    if (author.upper() in WINDOWS_RESERVED_NAMES):
        author += u'w'
    return (u'%s/%s%s' % (author, title, book_id))
