mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-03-18 17:17:30 +00:00
fix(subs): strip whitespace from ASS font names
Use removeprefix instead of removesuffix and add strip() to handle ASS subtitle files that have spaces after commas in Style definitions. Fixes #57
This commit is contained in:
@@ -1567,7 +1567,7 @@ class dl:
|
|||||||
if subtitle.codec == Subtitle.Codec.SubStationAlphav4:
|
if subtitle.codec == Subtitle.Codec.SubStationAlphav4:
|
||||||
for line in subtitle.path.read_text("utf8").splitlines():
|
for line in subtitle.path.read_text("utf8").splitlines():
|
||||||
if line.startswith("Style: "):
|
if line.startswith("Style: "):
|
||||||
font_names.append(line.removesuffix("Style: ").split(",")[1])
|
font_names.append(line.removeprefix("Style: ").split(",")[1].strip())
|
||||||
|
|
||||||
font_count, missing_fonts = self.attach_subtitle_fonts(
|
font_count, missing_fonts = self.attach_subtitle_fonts(
|
||||||
font_names, title, temp_font_files
|
font_names, title, temp_font_files
|
||||||
|
|||||||
Reference in New Issue
Block a user