ping / odmpy

A simple command line manager for OverDrive/Libby loans. Download your library loans from the command line.
GNU General Public License v3.0
277 stars 19 forks source link

OSError: [Errno 36] File name too long #72

Open ahxxm opened 4 months ago

ahxxm commented 4 months ago

Problem and Reproduce

In rare cases, e.g. Lonely Planet series, there might be more than 10 authors, making the filename exceed limit of ext4

Lonely Planet Great Britain - Kerry Walker, Lauren Keith, Emily Luxton, Hugh McNaughtan, Lorna Parkes, Joseph Reaney, Tasmin Waby, Neil Wilson, Isabel Albiston, Oliver Berry, Joe Bindloss, Keith Drew, Dan Fahey, Kay Gillespie, Laurie Goodlad, Sarah Irving.epub

Version/Environment

latest master, regular linux

Workaround

In extract_authors_from_openbook, remove the last ones by

def extract_authors_from_openbook(openbook: Dict) -> List[str]:
    """
    Extract list of author names from openbook

    :param openbook:
    :return:
    """
    creators = [
        c["name"]
        for c in openbook.get("creator", []) if c.get("role", "") in {"author", "editor"}
    ]
    while len(", ".join(creators)) > 100:  # 100 is arbitrary
        creators.pop()
    return creators
joshuatly commented 4 months ago

There is also --bookfileformat and --bookfolderformat which can help with the rare case