From 62ebecc87f5a1da65dffe084613c4ad39c940700 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Mon, 6 May 2024 19:43:32 +0400 Subject: [PATCH] Remove `path_length` config option I've misunderstood the FS limits, 255 is for filename, not path. Path is limited only by libc, it's 4096. The default outtmpl in musicdlp contains slashes, so it's a path. But YDL considers it to be a filename, so the whole outtmpl formatting result is trimmed to path_length. Do we really need this? I think there are no "malicious" long-named tracks :) --- backend/config.py | 4 ---- backend/ydl_pool.py | 1 - 2 files changed, 5 deletions(-) diff --git a/backend/config.py b/backend/config.py index daba5d4..4cfa230 100644 --- a/backend/config.py +++ b/backend/config.py @@ -13,10 +13,6 @@ class Config: # Cookies are in Netscape CSV format, see yt-dlp docs self.cookies_dir = Path(os.getenv('COOKIES_DIR') or 'cookies') - # Note: yt-dlp's path trimmer also counts album_path_tmpl, not only filename - # Why 235? 255 is the ext4 limit. 255 - len("/var/lib/musicdlp/") = 237, rounded down to 235 - self.path_length = int(os.getenv('PATH_LENGTH') or 235) - self.tmpl = os.path.join( # `artists.0` instead of `artist`, because the latter can contain "feat. ..." os.getenv('ALBUM_PATH_TMPL') or 'music/%(artists.0)s/%(album)s', diff --git a/backend/ydl_pool.py b/backend/ydl_pool.py index 9c06a3e..4cc869b 100644 --- a/backend/ydl_pool.py +++ b/backend/ydl_pool.py @@ -63,7 +63,6 @@ class Downloader: if ydl is None: ydl = create_ydl_fn[site]() - ydl.params['trim_file_name'] = cfg.path_length # Note: not only filename, but path in outtmpl ydl.params['outtmpl']['default'] = cfg.tmpl ydl.add_post_processor(id3pp.ID3TagsPP(), when='post_process')