~hristoast/mousikofidi

e4b8603520daea923c7403973788baccec34fe94 — Hristos N. Triantafillou 8 months ago 2a0f83e
Sometimes parts of file names or titles are big

Names were previously truncated if they were one big continuous
string, but parts of file names or titles can be really big too.  This
causes overflows on mobile, so those are now truncated as well.
1 files changed, 10 insertions(+), 0 deletions(-)

M mousikofidi/mousikofidi.py
M mousikofidi/mousikofidi.py => mousikofidi/mousikofidi.py +10 -0
@@ 647,10 647,20 @@ def file_dict(path: str, metadata: dict, ftype: str, title_limit=17) -> dict:
    if len(file_name.split()) == 1 and len(file_name) > title_limit:
        file_name_mobile = file_name[:title_limit] + "…"

    if len(file_name.split()) > 1 and len(file_name) > title_limit:
        for chunk in file_name.split():
            if len(chunk) > title_limit:
                file_name_mobile = file_name[:title_limit] + "…"

    if title:
        if len(title.split()) == 1 and len(title) > title_limit:
            title_mobile = title[:title_limit] + "…"

        if len(title.split()) > 1 and len(title) > title_limit:
            for chunk in title.split():
                if len(chunk) > title_limit:
                    title_mobile = title[:title_limit] + "…"

    return {
        "album": metadata["album"],
        "artist": metadata["artist"],