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

Issue 485 remote clock #486

Open
wants to merge 14 commits into
base: release/2.1.2
Choose a base branch
from
Open

Conversation

nigelmegitt
Copy link
Collaborator

Fix #485 by allowing a remote URL to be provided, which is dereferenced and the returned ISO date processed and used.

No longer needed because it has been merged into the core.
Track a change to proxy handling in Autobahn / twisted for #477. There's probably a more elegant way, but this works for now... Lacking a test, but have verified it locally.
We don't need the HTTPProxyConfig object at all anymore, just a `dict` will do.
Have seen this error a couple of times during live operation:

```Shell
Unhandled error in Deferred:
[CRITICAL] (2018-05-08 13:43:42,705) in twisted[154] - Unhandled error in Deferred:

[CRITICAL] (2018-05-08 13:43:42,705) in twisted[154] -
Traceback (most recent call last):
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/venv/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/node/consumer.py", line 134, in convert_next_segment
    end=self.last_segment_end + self._segment_length
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/node/consumer.py", line 122, in get_segment
    sequence_number=self._segment_counter
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/documents/ebutt3.py", line 1004, in extract_segment
    document_segments=document_segments
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/documents/ebutt3_splicer.py", line 29, in __init__
    self._do_splice()
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/documents/ebutt3_splicer.py", line 66, in _do_splice
    merged_body = merged_body.merge(current_tt.body, self._dataset)
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/bindings/__init__.py", line 974, in merge
    self._merge_deconflict_ids(element=other_elem, dest=merged_body, ids=ids)
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/bindings/__init__.py", line 949, in _merge_deconflict_ids
    cls._merge_deconflict_ids(item.value, copied_elem, ids)
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/bindings/__init__.py", line 949, in _merge_deconflict_ids
    cls._merge_deconflict_ids(item.value, copied_elem, ids)
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/bindings/__init__.py", line 949, in _merge_deconflict_ids
    cls._merge_deconflict_ids(item.value, copied_elem, ids)
  File "/Users/megitn02/Code/ebu/ebu-tt-live-toolkit/ebu_tt_live/bindings/__init__.py", line 942, in _merge_deconflict_ids
    log.debug('processing child: {} of {}'.format(item.value, element))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 1: ordinal not in range(128)
```

So commenting out that line. No idea how that character can appear in the relevant line, it's a £ sign.
This strips out unencodable characters and if not fixes, at least masks #483 by using `codecs.open` and telling it to ignore errors.
Part of the fix for #481 - allow the filesystem output carriage begin count to be overridden in the ebuttd-encoder using a first document datetime and a document duration. The zeroth document is calculated as the difference between the current datetime and the specified datetime divided by the document duration.
Add config options documentation for `override_begin_count` and `begin_count`.
timezone is ignored, with warning if present and not Z, since UTC is assumed.
Pass a URL through if one is provided.

Fix a problem where the wrong media time was being used when the zero time was being set - needs to be based on a date as well as a time.
If a URL is provided for the clock, make a remote request to get it and process the string, and use it to adjust the media clock.
@coveralls
Copy link

coveralls commented May 9, 2018

Coverage Status

Coverage decreased (-0.3%) to 84.845% when pulling 7e33412 on issue-485-remote-clock into 46c1951 on release/2.1.2.

Form media_time_zero format and for clock url.
The times are provided by the input `real_clock_timedelta`. Fixes a big offset issue.
@nigelmegitt
Copy link
Collaborator Author

I've just re-reviewed this. Some thoughts:

  • No unit tests on this code => not merge-able yet.
  • Otherwise it is somewhat useful for resequencing at known times, but does not in itself ensure that the extracted segments timings are locked to the intended times. All it does is makes the requests for segments at correct times: it does not specify the segment times being requested to match. That in turn creates a buggy behaviour where there are edge effects around the beginning and end of each segment extracted, when converting to EBU-TT-D and serving as live subtitles in fragmented MP4.

Conclusion: more work needed.

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

Successfully merging this pull request may close these issues.

None yet

2 participants