-
Notifications
You must be signed in to change notification settings - Fork 26
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
Handle unknown chars in segmentation_upid #55
Comments
let me check it out, Ill get back to you shortly. |
Passing a charset in is a can of worms I do not wish to open, however, I will do, "descriptors": [
{
"tag": 2,
"descriptor_length": 38,
"name": "Segmentation Descriptor",
"identifier": "CUEI",
"components": [],
"segmentation_event_id": "0x3e9",
"segmentation_event_cancel_indicator": false,
"program_segmentation_flag": true,
"segmentation_duration_flag": true,
"delivery_not_restricted_flag": false,
"web_delivery_allowed_flag": false,
"no_regional_blackout_flag": false,
"archive_allowed_flag": false,
"device_restrictions": "Restrict Group 2",
"segmentation_duration": 180.12,
"segmentation_duration_ticks": 16210800,
"segmentation_message": "Not Indicated",
"segmentation_upid_type": 2,
"segmentation_upid_type_name": "Deprecated",
"segmentation_upid_length": 18,
"segmentation_upid": "bblndpphnD\u0002\u0002\ufffd\ufffd\ufffd\u0002\u0000\u0000",
"segmentation_type_id": 0,
"segment_num": 0,
"segments_expected": 0
}, Can you live with that solution? |
>>>> import threefive
>>>> threefive.version()
'2.3.49' |
On second thought, a charset might be a good idea. |
Thanks @futzu. |
Here's what I'm testing now,
>>> from threefive import Cue,upids
>>> i="/DBKAAAAAAAAAP/wBQb+YtC8/AA0AiZDVUVJAAAD6X/CAAD3W3ACEmJibG5kcHBobkQCAsGDpQIAAAAAAAEKQ1VFSRSAIyowMljRk9c="
>>> upids.charset
'ascii'
>>> cue=Cue(i)
>>> cue.decode()
ascii
True
>>> cue.descriptors[0].segmentation_upid
'bblndpphnD\x02\x02���\x02\x00\x00'
>>> upids.charset="big5"
>>> cue.decode()
big5
True
>>> cue.descriptors[0].segmentation_upid
'bblndpphnD\x02\x02���\x02\x00\x00'
>>> upids.charset="utf16"
>>> cue.decode()
utf16
True
>>> cue.descriptors[0].segmentation_upid
'扢湬灤桰䑮Ȃ菁ʥ\x00' |
threefive.upids.charset is active as of threefive-2.3.51. |
Input
/DBKAAAAAAAAAP/wBQb+YtC8/AA0AiZDVUVJAAAD6X/CAAD3W3ACEmJibG5kcHBobkQCAsGDpQIAAAAAAAEKQ1VFSRSAIyowMljRk9c=
Actual behaviour:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc1 in position 12: invalid start byte
at https://github.com/futzu/scte35-threefive/blob/f41c8a614abc1c866c5ddb48caf54368c235145a/threefive/bitn.py#L55Expected behaviour:
The text was updated successfully, but these errors were encountered: