-
Notifications
You must be signed in to change notification settings - Fork 10
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
Improved EBU-TT-D encoding, including better tests and denester #523
Open
nigelmegitt
wants to merge
21
commits into
release/3.0
Choose a base branch
from
bbc-python3-staging
base: release/3.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
76e37aa
Switch to absolute imports and update PyXB command accordingly
PyvesB d8213a8
Replace usage of reserved async keyword
PyvesB be57ec4
Run 2to3 utility
PyvesB ded5257
Make ComparableMixin hashable
PyvesB 8c6c966
Fix stop event name
PyvesB 4b29396
Switch to special method name for /
PyvesB 7b0dd23
Fix error message assertions
PyvesB 039b0c6
Tweak file mode to accept str
PyvesB 0ebc51b
Try instantiating interface to get TypeError
PyvesB 25147c2
Fix str/byte inconsistencies
PyvesB 39b12f3
Update Readme
PyvesB 9335162
Merge pull request #511 from bbc/python3-migration
nigelmegitt 090e6c0
Don't call fixtures directly
nigelmegitt 13fc3db
Until we fix twisted websocket testing, mark failing tests as failing
nigelmegitt 92b972c
drive-by python3 fixes to comments
nigelmegitt 643b299
Update .travis.yml to use python3.7 and pip 19.2.3
nigelmegitt 19807d4
Use make scripts in .travis.yml so that remote build tracks local bui…
nigelmegitt e1174ea
tt3 to ttd conversion (#41) (#521)
nigelmegitt 095b921
Merge branch 'release/3.0' into bbc-python3-staging
nigelmegitt daad77e
Remove BodyTimingValidationMixin._post_calculate_begin()
nigelmegitt 5d0c24b
Fix typo, addresses review comment
nigelmegitt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,9 @@ coverage.xml | |
*,cover | ||
.hypothesis/ | ||
|
||
# Pytest cache | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Denesting of EBU-TT-Live documents | ||
====================================== | ||
|
||
DenesterNode should be used when a EBU-TT-3 document has a div that contains | ||
other divs, or a span contains another span, and those nested elements need | ||
to be flattened, for example before conversion to EBU-TT-D. These elements | ||
are not able to be nested inside each other in EBU-TT-D documents. | ||
|
||
When documents are Denested, any nested elements must be removed from | ||
their parent elements, while retaining attributes they would have inherited. | ||
To address this, the DenesterNode node processes the | ||
document(s) with the | ||
:py:func:`ebu_tt_live.node.denester.DenesterNode.recurse` and | ||
:py:func:`ebu_tt_live.node.denester.DenesterNode.recurse_span` | ||
functions. These will iterate through the file to locate the deepest | ||
nested element, and create a new copy of it with its content and | ||
expected inherited attributes. The end result is a file containing | ||
these newly created divs/spans in place of the nested ones. | ||
|
||
Once the new divs and spans are created, divs that are sequential in | ||
the list of divs and have the same attributes are combined into a single | ||
div. This is done by the | ||
:py:func:`ebu_tt_live.node.denester.DenesterNode.combine_divs` | ||
function to reduce the number of divs in the resulting file. | ||
|
||
In the combined divs, every p element should have the same region | ||
as its parent div. Any p elements that specify a different region | ||
to their inherited region are removed here: as per TTML semantics, | ||
such p elements are never presented. | ||
The | ||
:py:func:`ebu_tt_live.node.denester.DenesterNode.check_p_regions` | ||
function iterates through the divs that have an assigned region and | ||
removes any p where its region does not match. | ||
It then removes the region attribute from any remaining p, as it will | ||
inhert the region of its parent div and the attribute is unnecessary. | ||
It will also remove any now-empty divs that exist as a result of having | ||
their p elements removed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option is not (yet) supported by the Denester.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, to be fixed by pushing more commits here - we have this fixed in the BBC fork. Apologies!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, no problem! So I will put my review on hold, until I get news from you regarding this MR.