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

def construct_file_name(self, book_id, title, author, extlen):

    extlen = max(extlen, 14)
    l = (((self.PATH_LIMIT - (extlen // 2)) - 2) if iswindows else (((self.PATH_LIMIT - extlen) - 2) // 2))
    if (l < 5):
        raise ValueError((u'Extension    length    too    long:    %d' % extlen))
    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]
    name = ((title + u'    -    ') + author)
    while name.endswith(u'.'):
        name = name[:(-1)]
    if (not name):
        name = ascii_filename(_(u'Unknown')).decode(u'ascii', u'replace')
    return name
