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

Fix subtitle merge of an empty caption #238

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MythodeaLoL
Copy link

@MythodeaLoL MythodeaLoL commented Jul 2, 2021

This fix the error:

AttributeError: 'NoneType' object has no attribute 'start'

Explaining the error:

It is caused because the caption has a blank value, a blank caption with no text, this causes the default code that joins the subtitles to go into error, as it cannot join a received None value, with an existing String value, and ends up breaking the subtitle conversion.

Problem example (DFXP/SMPTE xml):

<p region='pop1' style='basic' begin='01:55:05:08' end='01:55:11:14' tts:origin='17.5% 84.66%' tts:extent='62.5% 5.33%'>Subtitle End</p>
<p region='pop2' style='basic' begin='01:55:05:08' end='01:55:11:14' tts:origin='50% 84.66%' tts:extent='0% 5.33%'></p>

FloridaStream added 2 commits July 1, 2021 20:48
This fix the error: 
AttributeError: 'NoneType' object has no attribute 'start'

Explaining the error:
It is caused because the caption has a blank value, a blank caption with no text, this causes the default code that joins the subtitles to go into error, as it cannot join a received None value, with an existing String value, and ends up breaking the subtitle conversion.

Problem example (DFXP/SMPTE xml):
```<p region='pop1' style='basic' begin='01:55:05:08' end='01:55:11:14' tts:origin='17.5% 84.66%' tts:extent='62.5% 5.33%'>Subtitle End</p>
<p region='pop2' style='basic' begin='01:55:05:08' end='01:55:11:14' tts:origin='50% 84.66%' tts:extent='0% 5.33%'></p>```
Fix merge of an empty caption
Copy link
Contributor

@ana-nichifor ana-nichifor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your contribution! The modifications look good to me. Please add a unit test with the example you provided and it's good to go.

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

Successfully merging this pull request may close these issues.

2 participants