subtitles/dfxp: timecode: examine div tags for timecodes #1136
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.
The current dfxp parser does not examine the contents of
<div
tags for timing information. This causes it to generate an empty manifest for some valid dfxp files. It is valid to have timing information in the<div
, and I can provide more details and examples on request, but here are two files:FILE B currently generates an empty manifest. This change fixes this.
I have made changes to two functions that examine timing information:
dfxp_get_duration
, which traverses the entire XML to compute the ultimate duration of the subtitle's content.dfxp_parse_frames
, which traverses the XML in a similar fashion. It now looks at<p
tags and reverts to the last-visited<div
if there exists no timing information in the<p
tag.Additionally, there is set of helper functions to remove duplicate code, as reconciling my changes to work inline resulted in cruft. The resulting changes allow FILE B to be parsed, as well as combinations of FILE A and FILE B.