fix: use keyword arguments for Attachment constructor in font attachment

Fixes #24

When attaching fonts for ASS/SSA subtitles, the Attachment class was being
called with positional arguments instead of keyword arguments. This caused
the font Path object to be incorrectly interpreted, leading to an error:
"Invalid URL 'Arial (arial)': No scheme supplied."

Changed Attachment(font, name) to Attachment(path=font, name=name) to
explicitly pass arguments by keyword, ensuring proper parameter handling.
This commit is contained in:
Andy
2025-10-13 16:43:31 +00:00
parent 170a427af0
commit 45902bba13

View File

@@ -1106,11 +1106,11 @@ class dl:
if family_dir.exists(): if family_dir.exists():
fonts = family_dir.glob("*.*tf") fonts = family_dir.glob("*.*tf")
for font in fonts: for font in fonts:
title.tracks.add(Attachment(font, f"{font_name} ({font.stem})")) title.tracks.add(Attachment(path=font, name=f"{font_name} ({font.stem})"))
font_count += 1 font_count += 1
elif fonts_from_system: elif fonts_from_system:
for font in fonts_from_system: for font in fonts_from_system:
title.tracks.add(Attachment(font, f"{font_name} ({font.stem})")) title.tracks.add(Attachment(path=font, name=f"{font_name} ({font.stem})"))
font_count += 1 font_count += 1
else: else:
self.log.warning(f"Subtitle uses font [text2]{font_name}[/] but it could not be found...") self.log.warning(f"Subtitle uses font [text2]{font_name}[/] but it could not be found...")