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 :)
This commit is contained in:
DarkCat09 2024-05-06 19:43:32 +04:00
parent e1ef74cc1c
commit 62ebecc87f
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3
2 changed files with 0 additions and 5 deletions

View file

@ -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',

View file

@ -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')