threefive 2.4.97__tar.gz → 2.4.99__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {threefive-2.4.97 → threefive-2.4.99}/PKG-INFO +2 -3
- {threefive-2.4.97 → threefive-2.4.99}/README.md +1 -2
- {threefive-2.4.97 → threefive-2.4.99}/bin/threefive +68 -47
- {threefive-2.4.97 → threefive-2.4.99}/threefive/base.py +5 -3
- {threefive-2.4.97 → threefive-2.4.99}/threefive/cue.py +14 -10
- {threefive-2.4.97 → threefive-2.4.99}/threefive/descriptors.py +14 -13
- threefive-2.4.99/threefive/hls.py +1142 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/stream.py +7 -4
- {threefive-2.4.97 → threefive-2.4.99}/threefive/upids.py +4 -4
- {threefive-2.4.97 → threefive-2.4.99}/threefive/version.py +1 -1
- {threefive-2.4.97 → threefive-2.4.99}/threefive/xml.py +155 -104
- {threefive-2.4.97 → threefive-2.4.99}/threefive.egg-info/PKG-INFO +2 -3
- {threefive-2.4.97 → threefive-2.4.99}/threefive.egg-info/SOURCES.txt +1 -0
- {threefive-2.4.97 → threefive-2.4.99}/setup.cfg +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/setup.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/__init__.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/bitn.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/commands.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/crc.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/decode.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/encode.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/packetdata.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/section.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/segment.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/segmentation.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/showcues.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/sixfix.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/smoketest.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/streamtypes.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/stuff.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive/superkabuki.py +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive.egg-info/dependency_links.txt +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive.egg-info/requires.txt +0 -0
- {threefive-2.4.97 → threefive-2.4.99}/threefive.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: threefive
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.99
|
|
4
4
|
Summary: The Undisputed Heavyweight Champion of SCTE-35. The Belts have been Unified.
|
|
5
5
|
Home-page: https://github.com/futzu/threefive
|
|
6
6
|
Author: Adrian of Doom, and the Fine Folks at Fu Corp.
|
|
@@ -11,7 +11,6 @@ Description: | [cli](#cli) | [lib](#lib) | [examples](#examples) | [hls](https:
|
|
|
11
11
|
# threefive is SCTE-35.
|
|
12
12
|
##### SCTE-35 Parser. SCTE-35 Decoder. SCTE-35 Encoder. MPEGTS SCTE-35 Packet Injection. HLS Manifest and Segment SCTE-35 Parser. HLS SCTE-35 Injection. SCTE-35 Xml and Xml+bin Decoder/ Encoder for DASH.
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
## Latest version is v2.4.97
|
|
16
15
|
* Updated to latest version of new_reader for Zero packet loss Multicast _(tested on OpenBSD and Debian)_.
|
|
17
16
|
* [The cli has been Upgraded and tuned.]((https://github.com/futzu/threefive/blob/master/latest-cli.md))
|
|
@@ -23,7 +22,7 @@ Description: | [cli](#cli) | [lib](#lib) | [examples](#examples) | [hls](https:
|
|
|
23
22
|
* MPEGTS Packet Injection added to the __threefive cli.__.
|
|
24
23
|
* [Sidecar files explained](https://github.com/futzu/SCTE35_threefive/blob/master/sidecar.md)
|
|
25
24
|
* [sixfix](https://github.com/futzu/SCTE35_threefive/blob/master/newcli.md) : __ffmpeg__ turns SCTE-35 streams to __bin data (0x06)__, sixfix switches them back to SCTE-35 (0x86).
|
|
26
|
-
* [Xml](https://github.com/futzu/SCTE35-threefive/blob/master/
|
|
25
|
+
* [Xml](https://github.com/futzu/SCTE35-threefive/blob/master/latest-cli.md): Experimental support for [SCTE-35 xml as an input and output](https://github.com/futzu/SCTE35_threefive/blob/master/xml.md) ( DASH SCTE-214)
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
# Documentation
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
# threefive is SCTE-35.
|
|
4
4
|
##### SCTE-35 Parser. SCTE-35 Decoder. SCTE-35 Encoder. MPEGTS SCTE-35 Packet Injection. HLS Manifest and Segment SCTE-35 Parser. HLS SCTE-35 Injection. SCTE-35 Xml and Xml+bin Decoder/ Encoder for DASH.
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
## Latest version is v2.4.97
|
|
8
7
|
* Updated to latest version of new_reader for Zero packet loss Multicast _(tested on OpenBSD and Debian)_.
|
|
9
8
|
* [The cli has been Upgraded and tuned.]((https://github.com/futzu/threefive/blob/master/latest-cli.md))
|
|
@@ -15,7 +14,7 @@
|
|
|
15
14
|
* MPEGTS Packet Injection added to the __threefive cli.__.
|
|
16
15
|
* [Sidecar files explained](https://github.com/futzu/SCTE35_threefive/blob/master/sidecar.md)
|
|
17
16
|
* [sixfix](https://github.com/futzu/SCTE35_threefive/blob/master/newcli.md) : __ffmpeg__ turns SCTE-35 streams to __bin data (0x06)__, sixfix switches them back to SCTE-35 (0x86).
|
|
18
|
-
* [Xml](https://github.com/futzu/SCTE35-threefive/blob/master/
|
|
17
|
+
* [Xml](https://github.com/futzu/SCTE35-threefive/blob/master/latest-cli.md): Experimental support for [SCTE-35 xml as an input and output](https://github.com/futzu/SCTE35_threefive/blob/master/xml.md) ( DASH SCTE-214)
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
# Documentation
|
|
@@ -6,12 +6,13 @@ threefive command line SCTE35 decoder.
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
import select
|
|
9
10
|
import sys
|
|
10
11
|
from new_reader import reader
|
|
11
12
|
from threefive import Cue, Stream, print2, decode, version
|
|
13
|
+
from threefive.hls import cli as hlscli
|
|
12
14
|
from threefive.sixfix import sixfix
|
|
13
15
|
from threefive.superkabuki import SuperKabuki
|
|
14
|
-
from threefive.showcues import cli as hlscli
|
|
15
16
|
from sideways import cli as sidecli
|
|
16
17
|
|
|
17
18
|
REV = "\033[7;1m"
|
|
@@ -31,6 +32,7 @@ class SupaStream(Stream):
|
|
|
31
32
|
|
|
32
33
|
def _parse_scte35(self, pkt, pid):
|
|
33
34
|
print2(pkt)
|
|
35
|
+
print2("")
|
|
34
36
|
super()._parse_scte35(pkt, pid)
|
|
35
37
|
|
|
36
38
|
|
|
@@ -48,50 +50,60 @@ def mk_sidecar(cue):
|
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
HELP = f"""
|
|
51
|
-
|
|
53
|
+
threefive {U}
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
\tSCTE-35 outputs are {BLUE}base64, bytes, hex, int, json, xml, and xmlbin.{U}
|
|
55
|
+
{B} Default {U} {BLUE}The default action is to read a input and write a SCTE-35 output.{U}
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
\t{U}{BLUE} mpegts {U} {U}{BLUE} base64 {NORM} threefive https://example.com/video.ts {BLUE} base64 {U}
|
|
58
|
-
\t{U}{BLUE} xml {U} {U}{BLUE} bytes {NORM} threefive {BLUE} bytes {U} < xml.xml
|
|
59
|
-
\t{U}{BLUE} base64 {U} {U}{BLUE} hex {NORM} threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' {BLUE} hex {U}
|
|
60
|
-
\t{U}{BLUE} xmlbin {U} {U}{BLUE} int {NORM} threefive {BLUE} int {U} < xml.xml
|
|
61
|
-
\t{U}{BLUE} mpegts {U} {U}{BLUE} json {NORM} threefive video.ts
|
|
62
|
-
\t{U}{BLUE} json {U} {U}{BLUE} xml {NORM} threefive < json.json {BLUE} xml {U}
|
|
63
|
-
\t{U}{BLUE} hex {U} {U}{BLUE} xmlbin {NORM} threefive 0xfc301600000000000000fff00506fe00a98ac700000b3baed9 {BLUE} xmlbin {U}
|
|
57
|
+
{BLUE}inputs {U} mpegts, base64, hex, json, xml, and xmlbin{U}.
|
|
64
58
|
|
|
65
|
-
{
|
|
66
|
-
\t\t\t\t threefive hls help
|
|
67
|
-
{BLUE}HLS encode SCTE-35:{U} threefive hls encode -i https://example.com/master.m3u8 -s sidecar.txt -o output_dir
|
|
68
|
-
\t\t\t\t threefive hls encode help
|
|
59
|
+
{BLUE}outputs{U} base64, bytes, hex, int, json, xml, and xmlbin.{U}
|
|
69
60
|
|
|
70
|
-
{
|
|
61
|
+
{BLUE}threefive can read from {U} strings, files, stdin, http(s), multicast, and Udp.
|
|
71
62
|
|
|
72
|
-
{U}
|
|
63
|
+
Input:{U} Output:{U}
|
|
64
|
+
{U}{BLUE} mpegts {U} {U}{BLUE} base64 {NORM} threefive https://example.com/video.ts base64
|
|
65
|
+
{U}{BLUE} xml {U} {U}{BLUE} bytes {NORM} threefive bytes < xml.xml
|
|
66
|
+
{U}{BLUE} base64 {U} {U}{BLUE} hex {NORM} threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' hex
|
|
67
|
+
{U}{BLUE} xmlbin {U} {U}{BLUE} int {NORM} threefive int < xml.xml
|
|
68
|
+
{U}{BLUE} mpegts {U} {U}{BLUE} json {NORM} threefive video.ts
|
|
69
|
+
{U}{BLUE} json {U} {U}{BLUE} xml {NORM} threefive < json.json xml
|
|
70
|
+
{U}{BLUE} hex {U} {U}{BLUE} xmlbin {NORM} threefive 0xfc301600000000000000fff00506fe00a98ac700000b3baed9 xmlbin
|
|
73
71
|
|
|
74
|
-
{
|
|
72
|
+
{B} hls {U}{NORM} {BLUE} SCTE-35 hls decode help:{U} threefive hls help
|
|
75
73
|
|
|
76
|
-
|
|
74
|
+
threefive hls https://example.com/master.m3u8
|
|
77
75
|
|
|
78
|
-
{
|
|
76
|
+
{B} hls encode {U} {BLUE} SCTE-35 hls encode help:{U}threefive hls encode help
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
threefive hls encode -i https://example.com/master.m3u8 -s sidecar.txt -o output_dir
|
|
81
79
|
|
|
82
|
-
{
|
|
80
|
+
{B} inject {U}{NORM}{BLUE} Inject an mpegts stream with a SCTE-35 sidecar file at pid:{NORM}
|
|
83
81
|
|
|
84
|
-
|
|
82
|
+
threefive inject video.ts with sidecar.txt at 333
|
|
85
83
|
|
|
86
|
-
{
|
|
84
|
+
{B} packets {U}{NORM}{BLUE} Print raw SCTE-35 packets from multicast mpegts video:{NORM}
|
|
87
85
|
|
|
88
|
-
|
|
86
|
+
threefive packets udp://@235.35.3.5:3535
|
|
87
|
+
|
|
88
|
+
{B} proxy {U}{NORM}{BLUE} Parse a https stream and write raw video to stdout:{NORM}
|
|
89
|
+
|
|
90
|
+
threefive proxy video.ts
|
|
91
|
+
|
|
92
|
+
{B} pts {U}{NORM}{BLUE} Print PTS from mpegts video:{NORM} threefive pts video.ts
|
|
93
|
+
|
|
94
|
+
{B} sidecar {U}{NORM}{BLUE} Parse a stream, write pts,write SCTE-35 Cues to sidecar.txt:{NORM}
|
|
89
95
|
|
|
96
|
+
threefive sidecar video.ts
|
|
90
97
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
{B} sixfix {U}{NORM}{BLUE} Fix SCTE-35 data mangled by ffmpeg:{NORM} threefive sixfix video.ts
|
|
99
|
+
|
|
100
|
+
{B} show {U}{NORM}{BLUE} Probe mpegts video:{NORM} threefive show video.ts
|
|
101
|
+
|
|
102
|
+
{B} version {U}{NORM}{BLUE} Show version:{NORM} threefive version
|
|
103
|
+
|
|
104
|
+
{B} help {U}{NORM} {BLUE}Help:{NORM} threefive help
|
|
105
|
+
|
|
106
|
+
"""
|
|
95
107
|
|
|
96
108
|
|
|
97
109
|
def mk_args(keys):
|
|
@@ -100,14 +112,10 @@ def mk_args(keys):
|
|
|
100
112
|
if no args are present,read from sys.stdin.buffer
|
|
101
113
|
"""
|
|
102
114
|
args = [arg for arg in sys.argv[1:] if arg not in keys]
|
|
103
|
-
if not args:
|
|
104
|
-
args.append(read_buff())
|
|
105
115
|
return args
|
|
106
116
|
|
|
107
117
|
|
|
108
118
|
# print_map functions
|
|
109
|
-
|
|
110
|
-
|
|
111
119
|
def hls():
|
|
112
120
|
sys.argv.remove("hls")
|
|
113
121
|
if "encode" in sys.argv:
|
|
@@ -279,14 +287,14 @@ def xml_out(cue):
|
|
|
279
287
|
"""
|
|
280
288
|
xml_out prints cue as xml
|
|
281
289
|
"""
|
|
282
|
-
print2(cue.xml())
|
|
290
|
+
print2(cue.xml(xmlbin=False))
|
|
283
291
|
|
|
284
292
|
|
|
285
293
|
def xmlbin_out(cue):
|
|
286
294
|
"""
|
|
287
295
|
xml_out prints cue as xml
|
|
288
296
|
"""
|
|
289
|
-
print2(cue.xml(
|
|
297
|
+
print2(cue.xml())
|
|
290
298
|
|
|
291
299
|
|
|
292
300
|
funk_map = {
|
|
@@ -306,16 +314,20 @@ def funk():
|
|
|
306
314
|
if a key in out_map
|
|
307
315
|
is also in sys.argv
|
|
308
316
|
"""
|
|
309
|
-
func =json_out
|
|
317
|
+
func = json_out
|
|
310
318
|
for k, v in funk_map.items():
|
|
311
319
|
if k in sys.argv:
|
|
312
|
-
func=v
|
|
320
|
+
func = v
|
|
313
321
|
return func
|
|
314
322
|
|
|
323
|
+
|
|
315
324
|
def to_funk(this):
|
|
316
325
|
"""
|
|
317
326
|
to_funk prints a cue in a variety of formats.
|
|
318
327
|
"""
|
|
328
|
+
if this == "":
|
|
329
|
+
return
|
|
330
|
+
|
|
319
331
|
try:
|
|
320
332
|
# mpegts streams handled here.
|
|
321
333
|
strm = Stream(this)
|
|
@@ -323,7 +335,7 @@ def to_funk(this):
|
|
|
323
335
|
strm.decode(func=func)
|
|
324
336
|
except: # try to load json or xml
|
|
325
337
|
try:
|
|
326
|
-
cue=Cue()
|
|
338
|
+
cue = Cue()
|
|
327
339
|
cue.load(this)
|
|
328
340
|
except:
|
|
329
341
|
try: # handle base64, bytes, and hex.
|
|
@@ -331,11 +343,11 @@ def to_funk(this):
|
|
|
331
343
|
cue.decode()
|
|
332
344
|
except:
|
|
333
345
|
pass
|
|
334
|
-
if cue:
|
|
346
|
+
if cue:
|
|
335
347
|
cue.encode()
|
|
336
348
|
func = funk()
|
|
337
349
|
func(cue)
|
|
338
|
-
|
|
350
|
+
|
|
339
351
|
|
|
340
352
|
def chk_funk_map():
|
|
341
353
|
"""
|
|
@@ -343,20 +355,29 @@ def chk_funk_map():
|
|
|
343
355
|
"""
|
|
344
356
|
funk_keys = list(funk_map.keys())
|
|
345
357
|
args = mk_args(funk_keys)
|
|
358
|
+
readable, _, _ = select.select([sys.stdin], [], [], 0)
|
|
359
|
+
if sys.stdin in readable:
|
|
360
|
+
one = reader(sys.stdin.buffer).read(1)
|
|
361
|
+
if one in [b"{", b"<"]:
|
|
362
|
+
two = reader(sys.stdin.buffer).read()
|
|
363
|
+
args.append((one + two).decode())
|
|
364
|
+
else:
|
|
365
|
+
reader(sys.stdin.buffer).read(187)
|
|
366
|
+
Stream(sys.stdin.buffer).decode()
|
|
367
|
+
sys.exit()
|
|
368
|
+
if b"" in args:
|
|
369
|
+
args.remove(b"")
|
|
346
370
|
superfunk = decode
|
|
347
371
|
if [fkey for fkey in funk_keys if fkey in sys.argv]:
|
|
348
372
|
superfunk = to_funk
|
|
349
|
-
|
|
350
|
-
superfunk
|
|
351
|
-
[superfunk(arg) for arg in args]
|
|
373
|
+
if args:
|
|
374
|
+
[superfunk(arg) for arg in args]
|
|
352
375
|
sys.exit()
|
|
353
376
|
|
|
354
377
|
|
|
355
378
|
if __name__ == "__main__":
|
|
356
379
|
if len(sys.argv) < 2:
|
|
357
|
-
sys.argv.append(
|
|
380
|
+
sys.argv.append("json")
|
|
358
381
|
chk_print_map()
|
|
359
382
|
chk_mpegts_map()
|
|
360
383
|
chk_funk_map()
|
|
361
|
-
# else:
|
|
362
|
-
# decode(sys.stdin.buffer)
|
|
@@ -122,7 +122,8 @@ class SCTE35Base:
|
|
|
122
122
|
has runs hasattr with self and what
|
|
123
123
|
"""
|
|
124
124
|
if hasattr(self, what):
|
|
125
|
-
|
|
125
|
+
if vars(self)[what]:
|
|
126
|
+
return True
|
|
126
127
|
return False
|
|
127
128
|
|
|
128
129
|
def xml(self, ns="scte35"):
|
|
@@ -159,7 +160,8 @@ class SCTE35Base:
|
|
|
159
160
|
if isinstance(stuff, str):
|
|
160
161
|
stuff = json.loads(stuff)
|
|
161
162
|
if isinstance(stuff, dict):
|
|
163
|
+
prevars= vars(self)
|
|
162
164
|
for k, v in stuff.items():
|
|
163
|
-
if
|
|
165
|
+
if k in prevars:
|
|
164
166
|
self.__dict__[k] = v
|
|
165
|
-
|
|
167
|
+
#self.__dict__.update(stuff)
|
|
@@ -189,12 +189,15 @@ class Cue(SCTE35Base):
|
|
|
189
189
|
data. Encode is called to set missing fields
|
|
190
190
|
when possible and re-calc the length vars and crc.
|
|
191
191
|
"""
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
# pass
|
|
193
|
+
# print2("_mk_load")
|
|
194
|
+
# if self.load(data):
|
|
195
|
+
#bites = self.bites
|
|
196
|
+
# self.encode()
|
|
197
|
+
#return bites
|
|
196
198
|
return data
|
|
197
199
|
|
|
200
|
+
|
|
198
201
|
def _mk_bits(self, data):
|
|
199
202
|
"""
|
|
200
203
|
cue._mk_bits Converts
|
|
@@ -464,9 +467,9 @@ class Cue(SCTE35Base):
|
|
|
464
467
|
# Self.encode() will calculate lengths and types and such
|
|
465
468
|
self.encode()
|
|
466
469
|
|
|
467
|
-
def
|
|
470
|
+
def _xmlbin(self, ns):
|
|
468
471
|
sig_attrs = {"xmlns": "https://scte.org/schemas/35"}
|
|
469
|
-
sig_node = Node("Signal", attrs=sig_attrs,ns=ns)
|
|
472
|
+
sig_node = Node("Signal", attrs=sig_attrs, ns=ns)
|
|
470
473
|
bin_node = Node("Binary", value=self.encode(), ns=ns)
|
|
471
474
|
sig_node.add_child(bin_node)
|
|
472
475
|
return sig_node
|
|
@@ -476,19 +479,20 @@ class Cue(SCTE35Base):
|
|
|
476
479
|
_mk_descriptor_xml make xml nodes for descriptors.
|
|
477
480
|
"""
|
|
478
481
|
for d in self.descriptors:
|
|
479
|
-
if d.has("segmentation_type_id"):
|
|
482
|
+
if d.has("segmentation_type_id") and d.segmentation_type_id in table22:
|
|
480
483
|
comment = f"{table22[d.segmentation_type_id]}"
|
|
481
484
|
sis.add_comment(comment)
|
|
482
485
|
sis.add_child(d.xml(ns=ns))
|
|
483
486
|
return sis
|
|
484
487
|
|
|
485
|
-
def xml(self, ns="scte35",
|
|
488
|
+
def xml(self, ns="scte35", xmlbin=True):
|
|
486
489
|
"""
|
|
487
490
|
xml returns a threefive.Node instance
|
|
488
491
|
which can be edited as needed or printed.
|
|
492
|
+
xmlbin
|
|
489
493
|
"""
|
|
490
|
-
if
|
|
491
|
-
return self.
|
|
494
|
+
if xmlbin:
|
|
495
|
+
return self._xmlbin(ns=ns)
|
|
492
496
|
sis = self.info_section.xml(ns=ns)
|
|
493
497
|
# if not self.command:
|
|
494
498
|
# raise Exception("\033[7mA Splice Command is Required\033[27m")
|
|
@@ -329,8 +329,8 @@ class SegmentationDescriptor(SpliceDescriptor):
|
|
|
329
329
|
self.device_restrictions = None
|
|
330
330
|
self.segmentation_duration = None
|
|
331
331
|
self.segmentation_message = None
|
|
332
|
-
self.segmentation_upid_length = None
|
|
333
332
|
self.segmentation_type_id = None
|
|
333
|
+
self.segmentation_upid_length = None
|
|
334
334
|
self.segmentation_upid_type = None
|
|
335
335
|
self.segmentation_upid_type_name = None
|
|
336
336
|
self.segmentation_upid = None
|
|
@@ -540,17 +540,16 @@ class SegmentationDescriptor(SpliceDescriptor):
|
|
|
540
540
|
self.segmentation_upid_type_name, self.segmentation_upid = the_upid.decode()
|
|
541
541
|
|
|
542
542
|
def _upid_from_xml(self, stuff):
|
|
543
|
-
if "SegmentationUpid" in stuff:
|
|
544
|
-
|
|
543
|
+
if "SegmentationUpid" in stuff['SegmentationDescriptor']:
|
|
544
|
+
sdsu=stuff['SegmentationDescriptor']["SegmentationUpid"]
|
|
545
|
+
if "segmentation_upid" not in sdsu:
|
|
545
546
|
self.segmentation_upid_type = 0
|
|
546
547
|
self.segmentation_upid_length = 0
|
|
547
548
|
self.segmentation_upid = ""
|
|
548
549
|
else:
|
|
549
|
-
seg_upid =
|
|
550
|
-
if "segmentation_upid_type" in
|
|
551
|
-
self.segmentation_upid_type =
|
|
552
|
-
"segmentation_upid_type"
|
|
553
|
-
]
|
|
550
|
+
seg_upid = sdsu["segmentation_upid"]
|
|
551
|
+
if "segmentation_upid_type" in sdsu:
|
|
552
|
+
self.segmentation_upid_type = sdsu["segmentation_upid_type"]
|
|
554
553
|
self.segmentation_upid_type_name = upid_map[
|
|
555
554
|
self.segmentation_upid_type
|
|
556
555
|
][0]
|
|
@@ -560,18 +559,20 @@ class SegmentationDescriptor(SpliceDescriptor):
|
|
|
560
559
|
"""
|
|
561
560
|
Load a SegmentationDescriptor from XML
|
|
562
561
|
"""
|
|
563
|
-
|
|
562
|
+
ssd = stuff["SegmentationDescriptor"]
|
|
563
|
+
self.load(ssd)
|
|
564
564
|
self.segmentation_event_id_compliance_indicator = True
|
|
565
565
|
self.program_segmentation_flag = True
|
|
566
566
|
self.segmentation_duration_flag = False
|
|
567
|
-
if "segmentationDuration" in
|
|
567
|
+
if "segmentationDuration" in ssd:
|
|
568
568
|
self.segmentation_duration_flag = True
|
|
569
569
|
self.delivery_not_restricted_flag = True
|
|
570
570
|
if "DeliveryRestrictions" in stuff:
|
|
571
|
+
sdr = stuff["DeliveryRestrictions"]
|
|
571
572
|
self.delivery_not_restricted_flag = False
|
|
572
|
-
self.load(
|
|
573
|
-
self.device_restrictions = table20[
|
|
574
|
-
self.segmentation_event_id = hex(
|
|
573
|
+
self.load(sdr)
|
|
574
|
+
self.device_restrictions = table20[sdr["device_restrictions"]]
|
|
575
|
+
self.segmentation_event_id = hex(ssd["segmentation_event_id"])
|
|
575
576
|
if self.segmentation_type_id in table22:
|
|
576
577
|
self.segmentation_message = table22[self.segmentation_type_id]
|
|
577
578
|
self._upid_from_xml(stuff)
|