Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styles not being loaded correctly #89

Closed
Ronkiro opened this issue May 2, 2024 · 1 comment
Closed

Styles not being loaded correctly #89

Ronkiro opened this issue May 2, 2024 · 1 comment
Assignees
Labels

Comments

@Ronkiro
Copy link

Ronkiro commented May 2, 2024

For the .ass with this content:

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Alegreya Sans,140.0,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,1,1,0,0,100.0,100.0,0.0,0.0,1,2.0,2.0,2,192,192,108,1

"Bold", "Italic", "Underline" and "StrikeOut" aren't being parsed (always returning the default value, False). Currently, one needs to manually parse them if necessary.

This is what i implemented (i'll always have only one style). Might help someone:

with open(file, 'r') as f:
  lines = f.read().splitlines()
lines = [line.replace("Format: ", "").replace("Style: ", "").split(",") for line in lines if line.startswith("Style:") or line.startswith("Format:")][:-1]
subs_styles = {k.strip().lower().replace("colour", "color"): v[0] for k, *v in zip(*lines)}
@tkarabela tkarabela self-assigned this May 4, 2024
@tkarabela tkarabela added the bug label May 4, 2024
@tkarabela
Copy link
Owner

Fixed in version 1.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants