threefive 3.1.3__tar.gz → 3.1.5__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-3.1.3 → threefive-3.1.5}/PKG-INFO +28 -10
- {threefive-3.1.3 → threefive-3.1.5}/README.md +27 -9
- {threefive-3.1.3 → threefive-3.1.5}/pyproject.toml +1 -1
- {threefive-3.1.3 → threefive-3.1.5}/threefive/aac.py +1 -1
- {threefive-3.1.3 → threefive-3.1.5}/threefive/base.py +22 -13
- {threefive-3.1.3 → threefive-3.1.5}/threefive/bitn.py +1 -8
- {threefive-3.1.3 → threefive-3.1.5}/threefive/cli.py +2 -2
- {threefive-3.1.3 → threefive-3.1.5}/threefive/commands.py +1 -1
- threefive-3.1.5/threefive/crctable.py +258 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/cue.py +6 -7
- {threefive-3.1.3 → threefive-3.1.5}/threefive/descriptors.py +22 -10
- {threefive-3.1.3 → threefive-3.1.5}/threefive/new_reader.py +3 -19
- {threefive-3.1.3 → threefive-3.1.5}/threefive/segment.py +6 -4
- {threefive-3.1.3 → threefive-3.1.5}/threefive/stream.py +13 -20
- {threefive-3.1.3 → threefive-3.1.5}/threefive/stuff.py +2 -1
- {threefive-3.1.3 → threefive-3.1.5}/threefive/version.py +1 -1
- {threefive-3.1.3 → threefive-3.1.5}/threefive/xml.py +221 -45
- threefive-3.1.3/threefive/uxp.py → threefive-3.1.5/threefive/xml2scte35.py +4 -133
- {threefive-3.1.3 → threefive-3.1.5}/threefive.egg-info/PKG-INFO +28 -10
- {threefive-3.1.3 → threefive-3.1.5}/threefive.egg-info/SOURCES.txt +1 -1
- threefive-3.1.3/threefive/crctable.py +0 -34
- {threefive-3.1.3 → threefive-3.1.5}/LICENSE +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/setup.cfg +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/__init__.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/crc.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/encode.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/gums.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/hls.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/hlsprofile.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/hlstags.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/iframes.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/packetdata.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/pmt.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/section.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/segmentation.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/sixfix.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/speedo.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/streamtypes.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/superkabuki.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/throttle.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/udp.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive/upids.py +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive.egg-info/dependency_links.txt +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive.egg-info/entry_points.txt +0 -0
- {threefive-3.1.3 → threefive-3.1.5}/threefive.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: threefive
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.5
|
|
4
4
|
Summary: The Undisputed Heavyweight Champion of SCTE-35.
|
|
5
5
|
Author-email: AdrianofDoom <spam@iodisco.com>
|
|
6
6
|
License-Expression: Sleepycat
|
|
@@ -18,22 +18,40 @@ License-File: LICENSE
|
|
|
18
18
|
Dynamic: license-file
|
|
19
19
|
|
|
20
20
|
# [ threefive ]
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* Decodes SCTE-35 from MPEGTS✔ Base64✔ Bytes✔ DASH✔ Hex✔ HLS✔ Integer✔ JSON✔ XML✔ XML+Binary✔
|
|
22
|
+
* Encodes SCTE-35 to MPEGTS✔ Base64✔ Bytes✔ Hex✔ Integer✔ JSON ✔ XML✔ XML+Binary✔
|
|
23
|
+
* if you need to encode SCTE-35 to HLS, use [x9k3](https://github.com/supeerkabuki/x9k3).
|
|
24
24
|
___
|
|
25
25
|
|
|
26
26
|
## Hey Google, what`s the best SCTE-35 software?
|
|
27
|
-
<img width="
|
|
27
|
+
<img width="734" height="638" alt="image" src="https://github.com/user-attachments/assets/dabc64cf-43a0-4dc4-bbda-add2c0f8df07" />
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
> _I told you, I know what I'm doing,_ ~Adrian
|
|
30
30
|
___
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
# [ version ]
|
|
34
34
|
|
|
35
|
-
### latest threefive version is _v3.1.
|
|
36
|
-
|
|
35
|
+
### latest threefive version is _v3.1.5_
|
|
36
|
+
|
|
37
|
+
* __There are no known issues with threefive v3.1.5__
|
|
38
|
+
|
|
39
|
+
* Average __cyclomatic__ complexity: __A (1.990)__
|
|
40
|
+
|
|
41
|
+
* Pylint: __9.69/10.0__
|
|
42
|
+
|
|
43
|
+
* Here's a list of __what's been fixed.__
|
|
44
|
+
|
|
45
|
+
* __AacParser__ The typo on the call to __AacParser.not_syncsafe()__ has been fixed.
|
|
46
|
+
|
|
47
|
+
* __Property class__ for __SCTE-35-2 Event Descriptors__ now render __JSON__ correctly.
|
|
48
|
+
|
|
49
|
+
* __threefive is dumping mmap__. The way threefive parses packets seems to make mmap consume a lot of memory _( 3GB with mmap and 170MB without mmap )_. Removing mmap slows pypy3 down a little parsing mpegts _(with mmap 1.9 seconds for 3.3GB of mpegts without 2.5 seconds)_, but actually speeds up python v3.14.2 _(with mmap 11.24 seconds for 3.3GB of mpegts, without 8.9 seconds)_
|
|
50
|
+
|
|
51
|
+
* __Segmentation Descriptors without UPIDS__ threefive will no longer throw an exception on SegmentationDescriptors without a UPID if the UPID type is not set to zero, instead threefive will print a warning message and set the type to zero for you.
|
|
52
|
+
|
|
53
|
+
* __threefive.xml.Node__ The Node class has been cleaned up, slots now work correctly when calling __Node.addchild(obj,slot=0)__ _(slots allow you to set the index of a child in Node.children when adding a child). New mthod __Node.a2c()__ converts attributes to children. New method __Node.c2a()__ converts children to attributes.__UltraXmlParser__ has been renamed __XmlP__ and moved from threefive/uxp.py to threefive.xml.py. Update your code.
|
|
54
|
+
|
|
37
55
|
___
|
|
38
56
|
|
|
39
57
|
# [ a really really quick start ]
|
|
@@ -685,8 +703,8 @@ ___
|
|
|
685
703
|
|
|
686
704
|
#### [web]
|
|
687
705
|
* [threefive SCTE-35 __Online Parser__](https://iodisco.com/scte35) __hosted on my server iodisco.com__
|
|
688
|
-
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ Go, Wasm and Super Karate Death Car](https://
|
|
689
|
-
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ threefive.js,javascript, and a little sed](https://
|
|
706
|
+
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ Go, Wasm and Super Karate Death Car](https://iodisco.com/gowasm) __hosted om my server iodisco.com__
|
|
707
|
+
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ threefive.js,javascript, and a little sed](https://iodisco.com/bread) just to keep things interesting. __hosted om my server iodisco.com__
|
|
690
708
|
* [ SCTE-35 __Online Parser__ powered by threefive](http://www.domus1938.com/scte35parser) _another online parser powered by threefive_ not hosted on my servers.
|
|
691
709
|
* [SCTE-35 __As a Service__](sassy.md) _if you can make an http request, you can parse SCTE-35, no install needed._
|
|
692
710
|
__hosted on my server iodisco.com__
|
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
# [ threefive ]
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Decodes SCTE-35 from MPEGTS✔ Base64✔ Bytes✔ DASH✔ Hex✔ HLS✔ Integer✔ JSON✔ XML✔ XML+Binary✔
|
|
3
|
+
* Encodes SCTE-35 to MPEGTS✔ Base64✔ Bytes✔ Hex✔ Integer✔ JSON ✔ XML✔ XML+Binary✔
|
|
4
|
+
* if you need to encode SCTE-35 to HLS, use [x9k3](https://github.com/supeerkabuki/x9k3).
|
|
5
5
|
___
|
|
6
6
|
|
|
7
7
|
## Hey Google, what`s the best SCTE-35 software?
|
|
8
|
-
<img width="
|
|
8
|
+
<img width="734" height="638" alt="image" src="https://github.com/user-attachments/assets/dabc64cf-43a0-4dc4-bbda-add2c0f8df07" />
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
> _I told you, I know what I'm doing,_ ~Adrian
|
|
11
11
|
___
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
# [ version ]
|
|
15
15
|
|
|
16
|
-
### latest threefive version is _v3.1.
|
|
17
|
-
|
|
16
|
+
### latest threefive version is _v3.1.5_
|
|
17
|
+
|
|
18
|
+
* __There are no known issues with threefive v3.1.5__
|
|
19
|
+
|
|
20
|
+
* Average __cyclomatic__ complexity: __A (1.990)__
|
|
21
|
+
|
|
22
|
+
* Pylint: __9.69/10.0__
|
|
23
|
+
|
|
24
|
+
* Here's a list of __what's been fixed.__
|
|
25
|
+
|
|
26
|
+
* __AacParser__ The typo on the call to __AacParser.not_syncsafe()__ has been fixed.
|
|
27
|
+
|
|
28
|
+
* __Property class__ for __SCTE-35-2 Event Descriptors__ now render __JSON__ correctly.
|
|
29
|
+
|
|
30
|
+
* __threefive is dumping mmap__. The way threefive parses packets seems to make mmap consume a lot of memory _( 3GB with mmap and 170MB without mmap )_. Removing mmap slows pypy3 down a little parsing mpegts _(with mmap 1.9 seconds for 3.3GB of mpegts without 2.5 seconds)_, but actually speeds up python v3.14.2 _(with mmap 11.24 seconds for 3.3GB of mpegts, without 8.9 seconds)_
|
|
31
|
+
|
|
32
|
+
* __Segmentation Descriptors without UPIDS__ threefive will no longer throw an exception on SegmentationDescriptors without a UPID if the UPID type is not set to zero, instead threefive will print a warning message and set the type to zero for you.
|
|
33
|
+
|
|
34
|
+
* __threefive.xml.Node__ The Node class has been cleaned up, slots now work correctly when calling __Node.addchild(obj,slot=0)__ _(slots allow you to set the index of a child in Node.children when adding a child). New mthod __Node.a2c()__ converts attributes to children. New method __Node.c2a()__ converts children to attributes.__UltraXmlParser__ has been renamed __XmlP__ and moved from threefive/uxp.py to threefive.xml.py. Update your code.
|
|
35
|
+
|
|
18
36
|
___
|
|
19
37
|
|
|
20
38
|
# [ a really really quick start ]
|
|
@@ -666,8 +684,8 @@ ___
|
|
|
666
684
|
|
|
667
685
|
#### [web]
|
|
668
686
|
* [threefive SCTE-35 __Online Parser__](https://iodisco.com/scte35) __hosted on my server iodisco.com__
|
|
669
|
-
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ Go, Wasm and Super Karate Death Car](https://
|
|
670
|
-
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ threefive.js,javascript, and a little sed](https://
|
|
687
|
+
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ Go, Wasm and Super Karate Death Car](https://iodisco.com/gowasm) __hosted om my server iodisco.com__
|
|
688
|
+
* Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ threefive.js,javascript, and a little sed](https://iodisco.com/bread) just to keep things interesting. __hosted om my server iodisco.com__
|
|
671
689
|
* [ SCTE-35 __Online Parser__ powered by threefive](http://www.domus1938.com/scte35parser) _another online parser powered by threefive_ not hosted on my servers.
|
|
672
690
|
* [SCTE-35 __As a Service__](sassy.md) _if you can make an http request, you can parse SCTE-35, no install needed._
|
|
673
691
|
__hosted on my server iodisco.com__
|
|
@@ -72,7 +72,7 @@ class AacParser:
|
|
|
72
72
|
try:
|
|
73
73
|
pts = float(data.split(self.applehead)[1].split(b"\x00", 2)[1])
|
|
74
74
|
except ERR:
|
|
75
|
-
pts = self.
|
|
75
|
+
pts = self.not_syncsafe(data.split(self.applehead)[1][:9])
|
|
76
76
|
return round((pts % ROLLOVER), 6)
|
|
77
77
|
|
|
78
78
|
def parse(self, media):
|
|
@@ -163,31 +163,40 @@ class SCTE35Base:
|
|
|
163
163
|
return json.dumps(self.get(), indent=4)
|
|
164
164
|
|
|
165
165
|
def _v2v(self, val):
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
bites = (
|
|
167
|
+
bytes,
|
|
168
|
+
bytearray,
|
|
169
|
+
)
|
|
170
|
+
if isinstance(val, bites):
|
|
171
|
+
val = val.decode(errors="ignore")
|
|
169
172
|
if isinstance(val, list):
|
|
170
173
|
val = [self._v2v(v) for v in val]
|
|
171
174
|
if isinstance(val, dict):
|
|
172
175
|
val = {k: self._v2v(v) for k, v in val.items()}
|
|
173
|
-
if isinstance(
|
|
174
|
-
val
|
|
175
|
-
(
|
|
176
|
-
bytes,
|
|
177
|
-
bytearray,
|
|
178
|
-
),
|
|
179
|
-
):
|
|
180
|
-
val = val.decode(errors="ignore")
|
|
176
|
+
if isinstance(val, SCTE35Base):
|
|
177
|
+
val.kv_clean()
|
|
178
|
+
print(val)
|
|
181
179
|
return val
|
|
182
180
|
|
|
183
|
-
def
|
|
181
|
+
def chk_obj(self, obj):
|
|
182
|
+
"""
|
|
183
|
+
chk_obj set object.
|
|
184
|
+
if obj is None, return self,
|
|
185
|
+
else just return obj.
|
|
186
|
+
"""
|
|
187
|
+
if obj is None:
|
|
188
|
+
obj = self
|
|
189
|
+
return obj
|
|
190
|
+
|
|
191
|
+
def kv_clean(self, obj=None):
|
|
184
192
|
"""
|
|
185
193
|
kv_clean recursively removes items
|
|
186
194
|
from a dict if the value is None.
|
|
187
195
|
"""
|
|
196
|
+
obj = self.chk_obj(obj)
|
|
188
197
|
return {
|
|
189
198
|
k: self._v2v(v)
|
|
190
|
-
for k, v in vars(
|
|
199
|
+
for k, v in vars(obj).items()
|
|
191
200
|
if v
|
|
192
201
|
not in [
|
|
193
202
|
None,
|
|
@@ -36,13 +36,6 @@ class Bitn:
|
|
|
36
36
|
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
|
-
class NegShiftError(Exception):
|
|
40
|
-
"""
|
|
41
|
-
NegShiftError inner Exception subclass
|
|
42
|
-
"""
|
|
43
|
-
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
39
|
def __init__(self, bites):
|
|
47
40
|
self.idx = len(bites) << 3 # This is correct, int.bit_length() is Not.
|
|
48
41
|
self.bits = int.from_bytes(bites, byteorder="big")
|
|
@@ -133,7 +126,7 @@ class Bitn:
|
|
|
133
126
|
mesg = (
|
|
134
127
|
f"\n\n\t\t{num_bits} bits requested, but only {self.idx} bits remain.\n"
|
|
135
128
|
)
|
|
136
|
-
|
|
129
|
+
red(mesg)
|
|
137
130
|
return False
|
|
138
131
|
return True
|
|
139
132
|
|
|
@@ -138,7 +138,7 @@ def is_pkt(args, rdr, one):
|
|
|
138
138
|
"""
|
|
139
139
|
two = rdr.read(187)
|
|
140
140
|
strm = Stream(sys.stdin.buffer)
|
|
141
|
-
strm.
|
|
141
|
+
strm.parse(one + two) # dont drop first packet
|
|
142
142
|
strm.decode(func=funk())
|
|
143
143
|
done() # I keep forgetting why I do this
|
|
144
144
|
|
|
@@ -446,7 +446,7 @@ def chk_hls():
|
|
|
446
446
|
if b"#EXTM3U" in packet:
|
|
447
447
|
hlscli()
|
|
448
448
|
done()
|
|
449
|
-
except:
|
|
449
|
+
except ERR:
|
|
450
450
|
pass
|
|
451
451
|
|
|
452
452
|
|
|
@@ -168,7 +168,7 @@ class TimeSignal(SpliceCommand):
|
|
|
168
168
|
if self.time_specified_flag:
|
|
169
169
|
nbin.reserve(6)
|
|
170
170
|
if not self.pts_time:
|
|
171
|
-
|
|
171
|
+
red("pts_time is not set")
|
|
172
172
|
nbin.add_int(self.as_ticks(self.pts_time), 33)
|
|
173
173
|
else:
|
|
174
174
|
self.pts_time = None
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
CRCTABLE = [
|
|
2
|
+
0,
|
|
3
|
+
79764919,
|
|
4
|
+
159529838,
|
|
5
|
+
222504665,
|
|
6
|
+
319059676,
|
|
7
|
+
398814059,
|
|
8
|
+
445009330,
|
|
9
|
+
507990021,
|
|
10
|
+
638119352,
|
|
11
|
+
583659535,
|
|
12
|
+
797628118,
|
|
13
|
+
726387553,
|
|
14
|
+
890018660,
|
|
15
|
+
835552979,
|
|
16
|
+
1015980042,
|
|
17
|
+
944750013,
|
|
18
|
+
1276238704,
|
|
19
|
+
1221641927,
|
|
20
|
+
1167319070,
|
|
21
|
+
1095957929,
|
|
22
|
+
1595256236,
|
|
23
|
+
1540665371,
|
|
24
|
+
1452775106,
|
|
25
|
+
1381403509,
|
|
26
|
+
1780037320,
|
|
27
|
+
1859660671,
|
|
28
|
+
1671105958,
|
|
29
|
+
1733955601,
|
|
30
|
+
2031960084,
|
|
31
|
+
2111593891,
|
|
32
|
+
1889500026,
|
|
33
|
+
1952343757,
|
|
34
|
+
2552477408,
|
|
35
|
+
2632100695,
|
|
36
|
+
2443283854,
|
|
37
|
+
2506133561,
|
|
38
|
+
2334638140,
|
|
39
|
+
2414271883,
|
|
40
|
+
2191915858,
|
|
41
|
+
2254759653,
|
|
42
|
+
3190512472,
|
|
43
|
+
3135915759,
|
|
44
|
+
3081330742,
|
|
45
|
+
3009969537,
|
|
46
|
+
2905550212,
|
|
47
|
+
2850959411,
|
|
48
|
+
2762807018,
|
|
49
|
+
2691435357,
|
|
50
|
+
3560074640,
|
|
51
|
+
3505614887,
|
|
52
|
+
3719321342,
|
|
53
|
+
3648080713,
|
|
54
|
+
3342211916,
|
|
55
|
+
3287746299,
|
|
56
|
+
3467911202,
|
|
57
|
+
3396681109,
|
|
58
|
+
4063920168,
|
|
59
|
+
4143685023,
|
|
60
|
+
4223187782,
|
|
61
|
+
4286162673,
|
|
62
|
+
3779000052,
|
|
63
|
+
3858754371,
|
|
64
|
+
3904687514,
|
|
65
|
+
3967668269,
|
|
66
|
+
881225847,
|
|
67
|
+
809987520,
|
|
68
|
+
1023691545,
|
|
69
|
+
969234094,
|
|
70
|
+
662832811,
|
|
71
|
+
591600412,
|
|
72
|
+
771767749,
|
|
73
|
+
717299826,
|
|
74
|
+
311336399,
|
|
75
|
+
374308984,
|
|
76
|
+
453813921,
|
|
77
|
+
533576470,
|
|
78
|
+
25881363,
|
|
79
|
+
88864420,
|
|
80
|
+
134795389,
|
|
81
|
+
214552010,
|
|
82
|
+
2023205639,
|
|
83
|
+
2086057648,
|
|
84
|
+
1897238633,
|
|
85
|
+
1976864222,
|
|
86
|
+
1804852699,
|
|
87
|
+
1867694188,
|
|
88
|
+
1645340341,
|
|
89
|
+
1724971778,
|
|
90
|
+
1587496639,
|
|
91
|
+
1516133128,
|
|
92
|
+
1461550545,
|
|
93
|
+
1406951526,
|
|
94
|
+
1302016099,
|
|
95
|
+
1230646740,
|
|
96
|
+
1142491917,
|
|
97
|
+
1087903418,
|
|
98
|
+
2896545431,
|
|
99
|
+
2825181984,
|
|
100
|
+
2770861561,
|
|
101
|
+
2716262478,
|
|
102
|
+
3215044683,
|
|
103
|
+
3143675388,
|
|
104
|
+
3055782693,
|
|
105
|
+
3001194130,
|
|
106
|
+
2326604591,
|
|
107
|
+
2389456536,
|
|
108
|
+
2200899649,
|
|
109
|
+
2280525302,
|
|
110
|
+
2578013683,
|
|
111
|
+
2640855108,
|
|
112
|
+
2418763421,
|
|
113
|
+
2498394922,
|
|
114
|
+
3769900519,
|
|
115
|
+
3832873040,
|
|
116
|
+
3912640137,
|
|
117
|
+
3992402750,
|
|
118
|
+
4088425275,
|
|
119
|
+
4151408268,
|
|
120
|
+
4197601365,
|
|
121
|
+
4277358050,
|
|
122
|
+
3334271071,
|
|
123
|
+
3263032808,
|
|
124
|
+
3476998961,
|
|
125
|
+
3422541446,
|
|
126
|
+
3585640067,
|
|
127
|
+
3514407732,
|
|
128
|
+
3694837229,
|
|
129
|
+
3640369242,
|
|
130
|
+
1762451694,
|
|
131
|
+
1842216281,
|
|
132
|
+
1619975040,
|
|
133
|
+
1682949687,
|
|
134
|
+
2047383090,
|
|
135
|
+
2127137669,
|
|
136
|
+
1938468188,
|
|
137
|
+
2001449195,
|
|
138
|
+
1325665622,
|
|
139
|
+
1271206113,
|
|
140
|
+
1183200824,
|
|
141
|
+
1111960463,
|
|
142
|
+
1543535498,
|
|
143
|
+
1489069629,
|
|
144
|
+
1434599652,
|
|
145
|
+
1363369299,
|
|
146
|
+
622672798,
|
|
147
|
+
568075817,
|
|
148
|
+
748617968,
|
|
149
|
+
677256519,
|
|
150
|
+
907627842,
|
|
151
|
+
853037301,
|
|
152
|
+
1067152940,
|
|
153
|
+
995781531,
|
|
154
|
+
51762726,
|
|
155
|
+
131386257,
|
|
156
|
+
177728840,
|
|
157
|
+
240578815,
|
|
158
|
+
269590778,
|
|
159
|
+
349224269,
|
|
160
|
+
429104020,
|
|
161
|
+
491947555,
|
|
162
|
+
4046411278,
|
|
163
|
+
4126034873,
|
|
164
|
+
4172115296,
|
|
165
|
+
4234965207,
|
|
166
|
+
3794477266,
|
|
167
|
+
3874110821,
|
|
168
|
+
3953728444,
|
|
169
|
+
4016571915,
|
|
170
|
+
3609705398,
|
|
171
|
+
3555108353,
|
|
172
|
+
3735388376,
|
|
173
|
+
3664026991,
|
|
174
|
+
3290680682,
|
|
175
|
+
3236090077,
|
|
176
|
+
3449943556,
|
|
177
|
+
3378572211,
|
|
178
|
+
3174993278,
|
|
179
|
+
3120533705,
|
|
180
|
+
3032266256,
|
|
181
|
+
2961025959,
|
|
182
|
+
2923101090,
|
|
183
|
+
2868635157,
|
|
184
|
+
2813903052,
|
|
185
|
+
2742672763,
|
|
186
|
+
2604032198,
|
|
187
|
+
2683796849,
|
|
188
|
+
2461293480,
|
|
189
|
+
2524268063,
|
|
190
|
+
2284983834,
|
|
191
|
+
2364738477,
|
|
192
|
+
2175806836,
|
|
193
|
+
2238787779,
|
|
194
|
+
1569362073,
|
|
195
|
+
1498123566,
|
|
196
|
+
1409854455,
|
|
197
|
+
1355396672,
|
|
198
|
+
1317987909,
|
|
199
|
+
1246755826,
|
|
200
|
+
1192025387,
|
|
201
|
+
1137557660,
|
|
202
|
+
2072149281,
|
|
203
|
+
2135122070,
|
|
204
|
+
1912620623,
|
|
205
|
+
1992383480,
|
|
206
|
+
1753615357,
|
|
207
|
+
1816598090,
|
|
208
|
+
1627664531,
|
|
209
|
+
1707420964,
|
|
210
|
+
295390185,
|
|
211
|
+
358241886,
|
|
212
|
+
404320391,
|
|
213
|
+
483945776,
|
|
214
|
+
43990325,
|
|
215
|
+
106832002,
|
|
216
|
+
186451547,
|
|
217
|
+
266083308,
|
|
218
|
+
932423249,
|
|
219
|
+
861060070,
|
|
220
|
+
1041341759,
|
|
221
|
+
986742920,
|
|
222
|
+
613929101,
|
|
223
|
+
542559546,
|
|
224
|
+
756411363,
|
|
225
|
+
701822548,
|
|
226
|
+
3316196985,
|
|
227
|
+
3244833742,
|
|
228
|
+
3425377559,
|
|
229
|
+
3370778784,
|
|
230
|
+
3601682597,
|
|
231
|
+
3530312978,
|
|
232
|
+
3744426955,
|
|
233
|
+
3689838204,
|
|
234
|
+
3819031489,
|
|
235
|
+
3881883254,
|
|
236
|
+
3928223919,
|
|
237
|
+
4007849240,
|
|
238
|
+
4037393693,
|
|
239
|
+
4100235434,
|
|
240
|
+
4180117107,
|
|
241
|
+
4259748804,
|
|
242
|
+
2310601993,
|
|
243
|
+
2373574846,
|
|
244
|
+
2151335527,
|
|
245
|
+
2231098320,
|
|
246
|
+
2596047829,
|
|
247
|
+
2659030626,
|
|
248
|
+
2470359227,
|
|
249
|
+
2550115596,
|
|
250
|
+
2947551409,
|
|
251
|
+
2876312838,
|
|
252
|
+
2788305887,
|
|
253
|
+
2733848168,
|
|
254
|
+
3165939309,
|
|
255
|
+
3094707162,
|
|
256
|
+
3040238851,
|
|
257
|
+
2985771188,
|
|
258
|
+
]
|
|
@@ -11,8 +11,8 @@ from .crc import crc32
|
|
|
11
11
|
from .descriptors import splice_descriptor, descriptor_map, SpliceDescriptor
|
|
12
12
|
from .section import SpliceInfoSection
|
|
13
13
|
from .segmentation import table22
|
|
14
|
-
from .stuff import clean, red, isjson, isxml, pif,blue
|
|
15
|
-
from .
|
|
14
|
+
from .stuff import clean, red, isjson, isxml, pif, blue, ERR
|
|
15
|
+
from .xml2scte35 import xml2cue
|
|
16
16
|
from .xml import Node
|
|
17
17
|
|
|
18
18
|
|
|
@@ -248,7 +248,7 @@ class Cue(SCTE35Base):
|
|
|
248
248
|
return False
|
|
249
249
|
|
|
250
250
|
def _bits_precheck(self, data):
|
|
251
|
-
return self._bits_int(data)
|
|
251
|
+
return self._bits_int(data) or self._bits__bytes_or_str(data)
|
|
252
252
|
|
|
253
253
|
def _bits_decode(self, data):
|
|
254
254
|
"""
|
|
@@ -287,7 +287,6 @@ class Cue(SCTE35Base):
|
|
|
287
287
|
)
|
|
288
288
|
self.bites += dscptr_bites
|
|
289
289
|
|
|
290
|
-
|
|
291
290
|
def base64(self):
|
|
292
291
|
"""
|
|
293
292
|
base64 returns SCTE35
|
|
@@ -383,8 +382,8 @@ class Cue(SCTE35Base):
|
|
|
383
382
|
"""
|
|
384
383
|
nbin = NBin()
|
|
385
384
|
dbite_chunks = [dsptr.encode() for dsptr in self.descriptors]
|
|
386
|
-
## if False in dbite_chunks:
|
|
387
|
-
## return False
|
|
385
|
+
## if False in dbite_chunks:
|
|
386
|
+
## return False
|
|
388
387
|
for chunk, dsptr in zip(dbite_chunks, self.descriptors):
|
|
389
388
|
dsptr.descriptor_length = len(chunk)
|
|
390
389
|
nbin.add_int(dsptr.tag, EIGHT)
|
|
@@ -479,7 +478,7 @@ class Cue(SCTE35Base):
|
|
|
479
478
|
self._load_descriptors(data)
|
|
480
479
|
try:
|
|
481
480
|
return self.encode()
|
|
482
|
-
except:
|
|
481
|
+
except ERR:
|
|
483
482
|
return False
|
|
484
483
|
|
|
485
484
|
def load(self, data):
|
|
@@ -404,10 +404,12 @@ class SegmentationDescriptor(SpliceDescriptor):
|
|
|
404
404
|
used in decode()
|
|
405
405
|
"""
|
|
406
406
|
upid_type = self.segmentation_upid_type
|
|
407
|
-
if self.segmentation_upid_length==0:
|
|
407
|
+
if self.segmentation_upid_length == 0:
|
|
408
408
|
if self.segmentation_upid_type != 0:
|
|
409
|
-
red(
|
|
410
|
-
|
|
409
|
+
red(
|
|
410
|
+
"set segmentation_upid_type and self.segmentation_upid_length to zero for no upid value"
|
|
411
|
+
)
|
|
412
|
+
upid_type = self.segmentation_upid_type = 0
|
|
411
413
|
if upid_type not in upid_map:
|
|
412
414
|
red("Unknown upid type , setting to 0xFD")
|
|
413
415
|
upid_type = 0xFD
|
|
@@ -548,7 +550,7 @@ class Property(SCTE35Base):
|
|
|
548
550
|
if bitbin is None:
|
|
549
551
|
bitbin = Bitn(self.bites)
|
|
550
552
|
self.property_name_length = bitbin.as_int(8)
|
|
551
|
-
self.property_name = bitbin.as_bytes(self.property_name_length << 3)
|
|
553
|
+
self.property_name = bitbin.as_bytes(self.property_name_length << 3).decode()
|
|
552
554
|
self.property_data_type = bitbin.as_hex(8)
|
|
553
555
|
self.property_data_type_name = self.data_type_map[self.property_data_type]
|
|
554
556
|
self.property_value_length = bitbin.as_int(8)
|
|
@@ -557,12 +559,17 @@ class Property(SCTE35Base):
|
|
|
557
559
|
elif self.property_data_type == "0x01":
|
|
558
560
|
self.property_value = bitbin.as_int(self.property_value_length << 3)
|
|
559
561
|
else:
|
|
560
|
-
self.property_value = bitbin.as_bytes(
|
|
562
|
+
self.property_value = bitbin.as_bytes(
|
|
563
|
+
self.property_value_length << 3
|
|
564
|
+
).decode()
|
|
561
565
|
|
|
562
566
|
def encode(self, nbin=None):
|
|
567
|
+
"""
|
|
568
|
+
encode encode for Property class
|
|
569
|
+
"""
|
|
563
570
|
nbin = self._chk_nbin(nbin)
|
|
564
571
|
self._chk_var(int, nbin.add_int, "property_name_length", 8)
|
|
565
|
-
nbin.add_bites(self.property_name)
|
|
572
|
+
nbin.add_bites(self.property_name.encode())
|
|
566
573
|
self._chk_var(str, nbin.add_hex, "property_data_type", 8)
|
|
567
574
|
self._chk_var(int, nbin.add_int, "property_value_length", 8)
|
|
568
575
|
if self.property_data_type == "0x00":
|
|
@@ -574,7 +581,8 @@ class Property(SCTE35Base):
|
|
|
574
581
|
int, nbin.add_int, "property_value", self.property_value_length << 3
|
|
575
582
|
)
|
|
576
583
|
else:
|
|
577
|
-
nbin.add_bites(self.property_value)
|
|
584
|
+
nbin.add_bites(self.property_value.encode())
|
|
585
|
+
return nbin.bites
|
|
578
586
|
|
|
579
587
|
def xml(self, ns="scte35"):
|
|
580
588
|
"""
|
|
@@ -650,7 +658,7 @@ class EventDescriptor(SpliceDescriptor):
|
|
|
650
658
|
while pc:
|
|
651
659
|
prop = Property()
|
|
652
660
|
prop.decode(bitbin)
|
|
653
|
-
self.properties.append(prop)
|
|
661
|
+
self.properties.append(prop.get())
|
|
654
662
|
pc -= 1
|
|
655
663
|
|
|
656
664
|
def encode(self, nbin=None):
|
|
@@ -669,7 +677,9 @@ class EventDescriptor(SpliceDescriptor):
|
|
|
669
677
|
nbin.add_int(remain, 40)
|
|
670
678
|
nbin.add_int(len(self.properties), 8)
|
|
671
679
|
for prop in self.properties:
|
|
672
|
-
|
|
680
|
+
p = Property()
|
|
681
|
+
p.load(prop)
|
|
682
|
+
p.encode(nbin)
|
|
673
683
|
return nbin.bites
|
|
674
684
|
|
|
675
685
|
def xml(self, ns="scte35"):
|
|
@@ -688,7 +698,9 @@ class EventDescriptor(SpliceDescriptor):
|
|
|
688
698
|
}
|
|
689
699
|
ed = Node("EventDescriptor", attrs=attrs, ns=ns)
|
|
690
700
|
for prop in self.properties:
|
|
691
|
-
|
|
701
|
+
p = Property()
|
|
702
|
+
p.load(prop)
|
|
703
|
+
ed.addchild(p.xml())
|
|
692
704
|
return ed
|
|
693
705
|
|
|
694
706
|
|
|
@@ -6,20 +6,6 @@ Home of the reader function
|
|
|
6
6
|
|
|
7
7
|
from sys import stdin
|
|
8
8
|
from .stuff import blue, pif, print2
|
|
9
|
-
from mmap import mmap
|
|
10
|
-
|
|
11
|
-
class fumap(mmap):
|
|
12
|
-
"""
|
|
13
|
-
fumap
|
|
14
|
-
for new reader to work, I need everything
|
|
15
|
-
to behave the same way.
|
|
16
|
-
fumap give mmap a readlines method
|
|
17
|
-
"""
|
|
18
|
-
def readlines(self):
|
|
19
|
-
"""
|
|
20
|
-
readlines readlines for mmap as fumap
|
|
21
|
-
"""
|
|
22
|
-
return list(iter(self.readline, b""))
|
|
23
9
|
|
|
24
10
|
|
|
25
11
|
CORS = {
|
|
@@ -90,17 +76,15 @@ def reader(uri, headers={}):
|
|
|
90
76
|
# HTTP(S)
|
|
91
77
|
if uri.startswith("http"):
|
|
92
78
|
import urllib.request
|
|
79
|
+
|
|
93
80
|
req = urllib.request.Request(uri, headers=headers)
|
|
94
81
|
return urllib.request.urlopen(req)
|
|
95
82
|
# SRT
|
|
96
83
|
if uri.startswith("srt://"):
|
|
97
84
|
return try_srt(uri, headers=headers)
|
|
98
85
|
# File
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return fumap(f.fileno(), 0)
|
|
102
|
-
except:
|
|
103
|
-
return open(uri, "rb")
|
|
86
|
+
|
|
87
|
+
return open(uri, "rb")
|
|
104
88
|
|
|
105
89
|
|
|
106
90
|
def _do_srt(srt_url, headers={}):
|