threefive3 3.0.41__tar.gz → 3.0.45__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.
Files changed (41) hide show
  1. {threefive3-3.0.41 → threefive3-3.0.45}/PKG-INFO +114 -38
  2. {threefive3-3.0.41 → threefive3-3.0.45}/README.md +113 -37
  3. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/__init__.py +6 -1
  4. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/commands.py +6 -6
  5. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/crc.py +6 -7
  6. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/cue.py +67 -33
  7. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/descriptors.py +7 -8
  8. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/hls.py +35 -23
  9. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/pmt.py +49 -29
  10. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/sixfix.py +24 -30
  11. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/stream.py +12 -37
  12. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/stuff.py +80 -18
  13. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/superkabuki.py +6 -22
  14. threefive3-3.0.45/threefive3/uxp.py +368 -0
  15. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/version.py +1 -1
  16. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/xml.py +179 -99
  17. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3.egg-info/PKG-INFO +114 -38
  18. threefive3-3.0.41/threefive3/uxp.py +0 -337
  19. {threefive3-3.0.41 → threefive3-3.0.45}/LICENSE +0 -0
  20. {threefive3-3.0.41 → threefive3-3.0.45}/bin/threefive3 +0 -0
  21. {threefive3-3.0.41 → threefive3-3.0.45}/setup.cfg +0 -0
  22. {threefive3-3.0.41 → threefive3-3.0.45}/setup.py +0 -0
  23. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/aac.py +0 -0
  24. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/base.py +0 -0
  25. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/bitn.py +0 -0
  26. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/encode.py +0 -0
  27. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/gums.py +0 -0
  28. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/hlstags.py +0 -0
  29. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/iframes.py +0 -0
  30. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/new_reader.py +0 -0
  31. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/packetdata.py +0 -0
  32. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/section.py +0 -0
  33. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/segment.py +0 -0
  34. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/segmentation.py +0 -0
  35. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/streamtypes.py +0 -0
  36. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/upids.py +0 -0
  37. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3/words.py +0 -0
  38. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3.egg-info/SOURCES.txt +0 -0
  39. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3.egg-info/dependency_links.txt +0 -0
  40. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3.egg-info/requires.txt +0 -0
  41. {threefive3-3.0.41 → threefive3-3.0.45}/threefive3.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: threefive3
3
- Version: 3.0.41
3
+ Version: 3.0.45
4
4
  Summary: SCTE-35 decoder and encoder with MPEGTS and HLS and XML support.
5
5
  Home-page: https://github.com/superkabuki/threefive3
6
6
  Author: Adrian of Doom
@@ -19,40 +19,108 @@ Requires-Python: >=3.6
19
19
  Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
21
 
22
- [__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
23
- | [__SCTE-35 XML__](https://github.com/superkabuki/SCTE-35/blob/main/xml.md)
22
+
24
23
 
25
- # threefive3 is better than you.
26
- ✅ SCTE-35 __Parser__ ✅ SCTE-35 __Encoder__ ✅ SCTE-35 __HLS__ ✅ SCTE-35 __Xml+binary__ ✅ SCTE-35 __Cli__ ✅ SCTE-35 __library__
24
+ I've spent the last five years doing nothing but SCTE-35, a lot of people consider me a subject matter expert, other people describe me with adjectives. ~Adrian
27
25
 
28
26
 
29
- * Parses __SCTE-35__ from MPEGTS, HLS, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
30
- * Encode __SCTE-35__ to Base64, Bytes, Hex, Int, JSON,XML, or Xml+binary.
31
- * Built-in network support for HTTP(S), UDP, and Multicast.
32
- * Automatic AES decryption for HLS.
33
- * All HLS __SCTE-35__ Tags are Supported.
34
-
35
- # Heads up.
36
- <pre>
37
- The Super Kabuki MPEGTS SCTE-35 Packet Injection Engine is working really really well.
38
- I've tested the SuperKabuki output with ffmpeg and tsduck and everything works.
39
- I was going to wait until I finished The Sideways HLS tag Injector,
40
- but I'm thinking I'm going to go ahead and do a new build with
41
- Super Kabuki, probably tomorrow.
42
-
43
- It's workinng perfectly for me,
44
- so I want to get it out there and see if y'all break it. :)
45
- </pre>
27
+
28
+ # threefive3 is SCTE-35.
29
+ ## The Most Advanced SCTE-35 Parser on the Planet.
30
+ ### If you're working with SCTE-35, this is the tool you want.
31
+
32
+ [__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
33
+ | [__SCTE-35 XML__ updated 05/01/2025](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) | [__threefive3 runs Four Times Faster on pypy3__](https://pypy.org/)
46
34
 
35
+ ✅ SCTE-35 __Parser__ <br>
36
+ ✅ SCTE-35 __Decoder__ <br>
37
+ ✅ SCTE-35 __Encoder__ <br>
38
+ ✅ SCTE-35 __HLS__ ( All SCTE-35 HLS tag formats) <br>
39
+ ✅ SCTE-35 __DASH__ ( All SCTE-35 Xml formats) <br>
40
+ ✅ SCTE-35 __XML__ <br>
41
+ ✅ SCTE-35 __Cli__ <br>
42
+ ✅ SCTE-35 __library__ <br>
43
+
44
+ * Parses __SCTE-35__ from MPEGTS, HLS, XML, MPD, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
45
+ * Encode __SCTE-35__ to Base64, Bytes, Hex, Int, JSON,XML, or Xml+binary.
46
+ * __All HLS SCTE-35 Tags__ are Supported.
47
+ * __Automatic AES decryption__ for HLS.
48
+ * Built-in __Multicast Sender and Receiver__ _hell yes!_
49
+ * The __SuperKabuki SCTE-35 MPEGTS Packet Injection Engine__ was added to __threefive3__ v3.0.39
47
50
 
48
- # Latest release is v3.0.39
49
- _Released Thursday April 18th, 2025
50
- * just 4300 lines of code.
51
- * cyclomatic complexity __2.05__
52
- > Stay up to date, only the latest release is supported.
51
+ #### `Q.` What is SCTE-35?
53
52
 
53
+ #### `A.` SCTE-35 is just encoded binary data, that decodes into about 100 different vars. This blob of data is used to signal when to splice in Ad Breaks with commercials and such. The variables are used to facillitate this action and to help determine the type and length of commercials. As with most things related to streaming video, it's way more complicated than it needs to be, and there are way too many options.
54
54
 
55
55
 
56
+ <br>
57
+
58
+ ### Heads up, v3.0.45 is ready to roll.
59
+ * I'm trying to break anything that will break tonight, so I can fix it later today.
60
+ * if you have an issue, post it.
61
+ * I spent last night tricking out the Node class.
62
+ ### [Super Cool new xml stuff in threefive v3.0.45](node.md)
63
+ ### The new xml stuff is really sweet, you can even pass an DASH MPD directly to a Cue instance, and it will parse the first EVent with SCTE-35 it finds. Let me show you.
64
+ ```py3
65
+ a@fu:~/threefive3$ pypy3
66
+
67
+ Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
68
+ [PyPy 7.3.11 with GCC 12.2.0] on linux
69
+ Type "help", "copyright", "credits" or "license" for more information.
70
+ >>>>
71
+ >>>> from threefive3 import Cue,reader
72
+ >>>> data = reader('https://demo.unified-streaming.com/k8s/live/stable/scte35-n\
73
+ o-splicing.isml/.mpd').read().strip().decode() # use reader to pull the mpd over a network.
74
+ >>>> cue=Cue(data) # pass in to a Cue instance
75
+ >>>> cue.show()
76
+ {
77
+ "info_section": {
78
+ "table_id": "0xfc",
79
+ "section_syntax_indicator": false,
80
+ "private": false,
81
+ "sap_type": "0x03",
82
+ "sap_details": "No Sap Type",
83
+ "section_length": 32,
84
+ "protocol_version": 0,
85
+ "encrypted_packet": false,
86
+ "encryption_algorithm": 0,
87
+ "pts_adjustment": 0.0,
88
+ "cw_index": "0x00",
89
+ "tier": "0x0fff",
90
+ "splice_command_length": 15,
91
+ "splice_command_type": 5,
92
+ "descriptor_loop_length": 0,
93
+ "crc": "0xe4612424"
94
+ },
95
+ "command": {
96
+ "command_length": 15,
97
+ "command_type": 5,
98
+ "name": "Splice Insert",
99
+ "break_auto_return": true,
100
+ "break_duration": 38.4,
101
+ "splice_event_id": 14432855,
102
+ "splice_event_cancel_indicator": false,
103
+ "out_of_network_indicator": true,
104
+ "program_splice_flag": true,
105
+ "duration_flag": true,
106
+ "splice_immediate_flag": true,
107
+ "event_id_compliance_flag": true,
108
+ "unique_program_id": 49152,
109
+ "avail_num": 0,
110
+ "avails_expected": 0
111
+ },
112
+ "descriptors": []
113
+ }
114
+ ```
115
+ # Latest release is v3.0.45
116
+
117
+ * cyclomatic complexity __2.01__ ,__That's a kickass score.__
118
+
119
+ * pylint score is __9.65/10__, _this needs a liitle work_.
120
+
121
+ > Stay up to date, only the latest release is supported.
122
+ >
123
+
56
124
  ## MPEGTS streams can be parsed for SCTE-35 with three lines of code.
57
125
 
58
126
  ```py3
@@ -63,30 +131,37 @@ a@fu:~/build5/scte35/scte35$ pypy3
63
131
  >>>> strm.decode()
64
132
  ```
65
133
 
134
+ ### `Q.` Come on man, python is a damn scripting language, how fast can it be parsing MPEGTS?
135
+
136
+ ### `A.` 3.7GB in 2.7 Seconds runnng on pypy3, it's almost as fast as tsduck written in C++
137
+
138
+ ## Here's a test of tsduck, the old threefive, threefive3, and SuperKarate DeathCar.
139
+
140
+
141
+ ![image](https://github.com/user-attachments/assets/6ce0376d-1ac3-4bbb-8c06-8d76443238de)
142
+
143
+
144
+
66
145
  # Checkout the Super Cool SCTE-35 [__Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
67
146
  <br>
68
147
 
69
- # threefive3 v3.0.39 is ready
70
148
 
71
149
  * Xml is back and better than ever. __The new Ultra Xml Parser Supreme__ replaces the Super Xml Parser.
72
150
 
73
151
 
74
152
  # `Documentation`
75
-
153
+ ### Install
76
154
  * [Install](#install)
77
155
 
78
- * [XML](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) __New__!
79
-
80
-
156
+ ### Examples
157
+ * [__Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
158
+ ### XML
159
+ * [XML](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) __New__! _updated 05/01/2025_
81
160
  ### Cli
82
-
83
161
  * [SCTE-35 Cli Super Tool](#the-cli-tool) Encodes, Decodes, and Recodes. This is pretty cool, it does SCTE-35 seven different ways.
84
162
  * The cli tool comes with builtin documentation just type `threefive3 help`
85
-
86
163
  ### HLS
87
164
  * [Advanced Parsing of SCTE-35 in HLS with threefive3](https://github.com/superkabuki/threefive3/blob/main/hls.md) All HLS SCTE-35 tags, Sidecar Files, AAC ID3 Header Timestamps, SCTE-35 filters... Who loves you baby?
88
-
89
-
90
165
  ### `Classes`
91
166
  * The python built in help is always the most up to date docs for the library.
92
167
 
@@ -568,5 +643,6 @@ a@fu:~$
568
643
 
569
644
 
570
645
  ___
571
-
572
- [Install threefive3](#install) | [SCTE-35 HLS](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [Cue Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [Stream Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [Online SCTE-35 Parser](https://iodisco.com/scte35) | [Encode SCTE-35](https://github.com/superkabuki/threefive3/blob/main/encode.md)
646
+ [__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
647
+ | [__SCTE-35 XML__ updated 04/24/2025](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) | [__threefive3 runs Four Times Faster on pypy3__](https://pypy.org/)
648
+
@@ -1,37 +1,105 @@
1
- [__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
2
- | [__SCTE-35 XML__](https://github.com/superkabuki/SCTE-35/blob/main/xml.md)
1
+
3
2
 
4
- # threefive3 is better than you.
5
- ✅ SCTE-35 __Parser__ ✅ SCTE-35 __Encoder__ ✅ SCTE-35 __HLS__ ✅ SCTE-35 __Xml+binary__ ✅ SCTE-35 __Cli__ ✅ SCTE-35 __library__
3
+ I've spent the last five years doing nothing but SCTE-35, a lot of people consider me a subject matter expert, other people describe me with adjectives. ~Adrian
6
4
 
7
5
 
8
- * Parses __SCTE-35__ from MPEGTS, HLS, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
9
- * Encode __SCTE-35__ to Base64, Bytes, Hex, Int, JSON,XML, or Xml+binary.
10
- * Built-in network support for HTTP(S), UDP, and Multicast.
11
- * Automatic AES decryption for HLS.
12
- * All HLS __SCTE-35__ Tags are Supported.
13
-
14
- # Heads up.
15
- <pre>
16
- The Super Kabuki MPEGTS SCTE-35 Packet Injection Engine is working really really well.
17
- I've tested the SuperKabuki output with ffmpeg and tsduck and everything works.
18
- I was going to wait until I finished The Sideways HLS tag Injector,
19
- but I'm thinking I'm going to go ahead and do a new build with
20
- Super Kabuki, probably tomorrow.
21
-
22
- It's workinng perfectly for me,
23
- so I want to get it out there and see if y'all break it. :)
24
- </pre>
6
+
7
+ # threefive3 is SCTE-35.
8
+ ## The Most Advanced SCTE-35 Parser on the Planet.
9
+ ### If you're working with SCTE-35, this is the tool you want.
10
+
11
+ [__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
12
+ | [__SCTE-35 XML__ updated 05/01/2025](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) | [__threefive3 runs Four Times Faster on pypy3__](https://pypy.org/)
25
13
 
14
+ ✅ SCTE-35 __Parser__ <br>
15
+ ✅ SCTE-35 __Decoder__ <br>
16
+ ✅ SCTE-35 __Encoder__ <br>
17
+ ✅ SCTE-35 __HLS__ ( All SCTE-35 HLS tag formats) <br>
18
+ ✅ SCTE-35 __DASH__ ( All SCTE-35 Xml formats) <br>
19
+ ✅ SCTE-35 __XML__ <br>
20
+ ✅ SCTE-35 __Cli__ <br>
21
+ ✅ SCTE-35 __library__ <br>
22
+
23
+ * Parses __SCTE-35__ from MPEGTS, HLS, XML, MPD, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
24
+ * Encode __SCTE-35__ to Base64, Bytes, Hex, Int, JSON,XML, or Xml+binary.
25
+ * __All HLS SCTE-35 Tags__ are Supported.
26
+ * __Automatic AES decryption__ for HLS.
27
+ * Built-in __Multicast Sender and Receiver__ _hell yes!_
28
+ * The __SuperKabuki SCTE-35 MPEGTS Packet Injection Engine__ was added to __threefive3__ v3.0.39
26
29
 
27
- # Latest release is v3.0.39
28
- _Released Thursday April 18th, 2025
29
- * just 4300 lines of code.
30
- * cyclomatic complexity __2.05__
31
- > Stay up to date, only the latest release is supported.
30
+ #### `Q.` What is SCTE-35?
32
31
 
32
+ #### `A.` SCTE-35 is just encoded binary data, that decodes into about 100 different vars. This blob of data is used to signal when to splice in Ad Breaks with commercials and such. The variables are used to facillitate this action and to help determine the type and length of commercials. As with most things related to streaming video, it's way more complicated than it needs to be, and there are way too many options.
33
33
 
34
34
 
35
+ <br>
36
+
37
+ ### Heads up, v3.0.45 is ready to roll.
38
+ * I'm trying to break anything that will break tonight, so I can fix it later today.
39
+ * if you have an issue, post it.
40
+ * I spent last night tricking out the Node class.
41
+ ### [Super Cool new xml stuff in threefive v3.0.45](node.md)
42
+ ### The new xml stuff is really sweet, you can even pass an DASH MPD directly to a Cue instance, and it will parse the first EVent with SCTE-35 it finds. Let me show you.
43
+ ```py3
44
+ a@fu:~/threefive3$ pypy3
45
+
46
+ Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
47
+ [PyPy 7.3.11 with GCC 12.2.0] on linux
48
+ Type "help", "copyright", "credits" or "license" for more information.
49
+ >>>>
50
+ >>>> from threefive3 import Cue,reader
51
+ >>>> data = reader('https://demo.unified-streaming.com/k8s/live/stable/scte35-n\
52
+ o-splicing.isml/.mpd').read().strip().decode() # use reader to pull the mpd over a network.
53
+ >>>> cue=Cue(data) # pass in to a Cue instance
54
+ >>>> cue.show()
55
+ {
56
+ "info_section": {
57
+ "table_id": "0xfc",
58
+ "section_syntax_indicator": false,
59
+ "private": false,
60
+ "sap_type": "0x03",
61
+ "sap_details": "No Sap Type",
62
+ "section_length": 32,
63
+ "protocol_version": 0,
64
+ "encrypted_packet": false,
65
+ "encryption_algorithm": 0,
66
+ "pts_adjustment": 0.0,
67
+ "cw_index": "0x00",
68
+ "tier": "0x0fff",
69
+ "splice_command_length": 15,
70
+ "splice_command_type": 5,
71
+ "descriptor_loop_length": 0,
72
+ "crc": "0xe4612424"
73
+ },
74
+ "command": {
75
+ "command_length": 15,
76
+ "command_type": 5,
77
+ "name": "Splice Insert",
78
+ "break_auto_return": true,
79
+ "break_duration": 38.4,
80
+ "splice_event_id": 14432855,
81
+ "splice_event_cancel_indicator": false,
82
+ "out_of_network_indicator": true,
83
+ "program_splice_flag": true,
84
+ "duration_flag": true,
85
+ "splice_immediate_flag": true,
86
+ "event_id_compliance_flag": true,
87
+ "unique_program_id": 49152,
88
+ "avail_num": 0,
89
+ "avails_expected": 0
90
+ },
91
+ "descriptors": []
92
+ }
93
+ ```
94
+ # Latest release is v3.0.45
95
+
96
+ * cyclomatic complexity __2.01__ ,__That's a kickass score.__
97
+
98
+ * pylint score is __9.65/10__, _this needs a liitle work_.
99
+
100
+ > Stay up to date, only the latest release is supported.
101
+ >
102
+
35
103
  ## MPEGTS streams can be parsed for SCTE-35 with three lines of code.
36
104
 
37
105
  ```py3
@@ -42,30 +110,37 @@ a@fu:~/build5/scte35/scte35$ pypy3
42
110
  >>>> strm.decode()
43
111
  ```
44
112
 
113
+ ### `Q.` Come on man, python is a damn scripting language, how fast can it be parsing MPEGTS?
114
+
115
+ ### `A.` 3.7GB in 2.7 Seconds runnng on pypy3, it's almost as fast as tsduck written in C++
116
+
117
+ ## Here's a test of tsduck, the old threefive, threefive3, and SuperKarate DeathCar.
118
+
119
+
120
+ ![image](https://github.com/user-attachments/assets/6ce0376d-1ac3-4bbb-8c06-8d76443238de)
121
+
122
+
123
+
45
124
  # Checkout the Super Cool SCTE-35 [__Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
46
125
  <br>
47
126
 
48
- # threefive3 v3.0.39 is ready
49
127
 
50
128
  * Xml is back and better than ever. __The new Ultra Xml Parser Supreme__ replaces the Super Xml Parser.
51
129
 
52
130
 
53
131
  # `Documentation`
54
-
132
+ ### Install
55
133
  * [Install](#install)
56
134
 
57
- * [XML](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) __New__!
58
-
59
-
135
+ ### Examples
136
+ * [__Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
137
+ ### XML
138
+ * [XML](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) __New__! _updated 05/01/2025_
60
139
  ### Cli
61
-
62
140
  * [SCTE-35 Cli Super Tool](#the-cli-tool) Encodes, Decodes, and Recodes. This is pretty cool, it does SCTE-35 seven different ways.
63
141
  * The cli tool comes with builtin documentation just type `threefive3 help`
64
-
65
142
  ### HLS
66
143
  * [Advanced Parsing of SCTE-35 in HLS with threefive3](https://github.com/superkabuki/threefive3/blob/main/hls.md) All HLS SCTE-35 tags, Sidecar Files, AAC ID3 Header Timestamps, SCTE-35 filters... Who loves you baby?
67
-
68
-
69
144
  ### `Classes`
70
145
  * The python built in help is always the most up to date docs for the library.
71
146
 
@@ -547,5 +622,6 @@ a@fu:~$
547
622
 
548
623
 
549
624
  ___
550
-
551
- [Install threefive3](#install) | [SCTE-35 HLS](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [Cue Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [Stream Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [Online SCTE-35 Parser](https://iodisco.com/scte35) | [Encode SCTE-35](https://github.com/superkabuki/threefive3/blob/main/encode.md)
625
+ [__Install__](#install) |[__SCTE-35 Cli__](#the-cli-tool) | [__SCTE-35 HLS__](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [__Cue__ Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [__Stream__ Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [__Online SCTE-35 Parser__](https://iodisco.com/scte35) | [__Encode SCTE-35__](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [__SCTE-35 Examples__](https://github.com/superkabuki/threefive3/tree/main/examples)
626
+ | [__SCTE-35 XML__ updated 04/24/2025](https://github.com/superkabuki/SCTE-35/blob/main/xml.md) | [__threefive3 runs Four Times Faster on pypy3__](https://pypy.org/)
627
+
@@ -11,9 +11,14 @@ from .iframes import IFramer
11
11
  from .new_reader import reader
12
12
  from .section import SpliceInfoSection
13
13
  from .segment import Segment
14
+ from .sixfix import SixFix
14
15
  from .stream import Stream
15
- from .stuff import print2, iso8601, atohif, red, blue, ERR
16
+ from .stuff import print2, iso8601, atohif, red, blue, ERR, clean, rmap
17
+ from .superkabuki import SuperKabuki
18
+ from .upids import AirId, Atsc, Eidr, Isan, Mid, Mpu, NoUpid, Umid, Upid, upid_map
19
+ from .uxp import UltraXmlParser
16
20
  from .version import version
21
+ from .xml import Node
17
22
 
18
23
  from .commands import (
19
24
  SpliceCommand,
@@ -92,7 +92,7 @@ class PrivateCommand(SpliceCommand):
92
92
  """
93
93
  attrs = {"identifier": self.identifier}
94
94
  pc = Node("PrivateCommand", attrs=attrs)
95
- pc.add_child(Node("PrivateBytes", value=self.private_bytes.hex(), ns=ns))
95
+ pc.addchild(Node("PrivateBytes", value=self.private_bytes.hex(), ns=ns))
96
96
  return pc
97
97
 
98
98
 
@@ -164,7 +164,7 @@ class TimeSignal(SpliceCommand):
164
164
  nbin.reserve(6)
165
165
  if not isinstance(self.pts_time, float):
166
166
  blue("converting pts_time from ticks")
167
- self.pts_time= self.as_90k(self.pts_time)
167
+ self.pts_time = self.as_90k(self.pts_time)
168
168
  self.pts_time = round(self.pts_time, 6)
169
169
  nbin.add_int(int(self.as_ticks(self.pts_time)), 33)
170
170
  else:
@@ -183,7 +183,7 @@ class TimeSignal(SpliceCommand):
183
183
  attrs={"pts_time": self.as_ticks(self.pts_time)},
184
184
  ns=ns,
185
185
  )
186
- ts.add_child(st)
186
+ ts.addchild(st)
187
187
  return ts
188
188
 
189
189
 
@@ -301,15 +301,15 @@ class SpliceInsert(TimeSignal):
301
301
  st = Node(
302
302
  "SpliceTime", attrs={"ptsTime": self.as_ticks(self.pts_time)}, ns=ns
303
303
  )
304
- prgm.add_child(st)
305
- si.add_child(prgm)
304
+ prgm.addchild(st)
305
+ si.addchild(prgm)
306
306
  if self.break_duration:
307
307
  bd_attrs = {
308
308
  "auto_return": self.break_auto_return,
309
309
  "duration": self.as_ticks(self.break_duration),
310
310
  }
311
311
  bd = Node("BreakDuration", attrs=bd_attrs, ns=ns)
312
- si.add_child(bd)
312
+ si.addchild(bd)
313
313
  return si
314
314
 
315
315
 
@@ -2,24 +2,23 @@
2
2
  crc.py crc32 function for encoding.
3
3
  """
4
4
 
5
- from .words import zero, one, eight, twentyfour, thirtytwo, twofiftyfive, twofiftysix
5
+ from .words import zero, one, eight, twentyfour, twofiftyfive, twofiftysix
6
6
 
7
+ BC_MASK= 0x80000000
7
8
  POLY = 0x104C11DB7
8
9
  INIT_VALUE = 0xFFFFFFFF
9
-
10
+ GONZO = INIT_VALUE - 0xFF
10
11
 
11
12
  def _bytecrc(crc, poly):
12
- mask = one << (thirtytwo - one)
13
13
  i = eight
14
14
  while i:
15
- crc = (crc << one, crc << one ^ poly)[crc & mask != zero]
15
+ crc = (crc << one, crc << one ^ poly)[crc & BC_MASK != zero]
16
16
  i -= one
17
17
  return crc & INIT_VALUE
18
18
 
19
19
 
20
20
  def _mk_table():
21
- mask = (one << thirtytwo) - one
22
- poly = POLY & mask
21
+ poly = POLY & INIT_VALUE
23
22
  return [_bytecrc((i << twentyfour), poly) for i in range(twofiftysix)]
24
23
 
25
24
 
@@ -32,7 +31,7 @@ def crc32(data):
32
31
  crc = INIT_VALUE
33
32
  for bite in data:
34
33
  crc = table[bite ^ ((crc >> twentyfour) & twofiftyfive)] ^ (
35
- (crc << eight) & (INIT_VALUE - twofiftyfive)
34
+ (crc << eight) & (GONZO)
36
35
  )
37
36
  return crc
38
37
 
@@ -12,7 +12,20 @@ from .commands import command_map
12
12
  from .descriptors import splice_descriptor, descriptor_map
13
13
  from .crc import crc32
14
14
  from .segmentation import table22
15
- from .words import minusone,zero,one,two,three,four,eight,eleven,fourteen, sixteen,equalsign
15
+ from .words import (
16
+ minusone,
17
+ zero,
18
+ one,
19
+ two,
20
+ three,
21
+ four,
22
+ eight,
23
+ eleven,
24
+ fourteen,
25
+ sixteen,
26
+ equalsign,
27
+ )
28
+ from .xml import Node
16
29
  from .uxp import xml2cue
17
30
 
18
31
 
@@ -64,7 +77,7 @@ class Cue(SCTE35Base):
64
77
  """
65
78
  Cue.decode() parses for SCTE35 data
66
79
 
67
- * decode doesn't need to be called directly
80
+ *decode doesn't need to be called directly
68
81
  unless you initialize a Cue without data.
69
82
  """
70
83
  bites = self.bites
@@ -157,12 +170,12 @@ class Cue(SCTE35Base):
157
170
  return red("Bad Base64")
158
171
 
159
172
  def _str_bits(self, data):
160
- if ishex(data):
161
- return self._hex_bits(clean(data))
162
173
  if isxml(data) or isjson(data):
163
174
  self.load(data)
164
175
  return self.bites
165
- data=data.strip()
176
+ if ishex(data):
177
+ return self._hex_bits(clean(data))
178
+ data = data.strip()
166
179
  if data.isdigit():
167
180
  return self._int_bits(int(data))
168
181
  return self._b64_bits(data)
@@ -175,30 +188,51 @@ class Cue(SCTE35Base):
175
188
  return data.split(b"\x00\x00\x01\xfc", one)[minusone]
176
189
  return data
177
190
 
178
- def _byte_bits(self,data):
179
- data = self._pkt_bits(data)
180
- self.bites = self.idxsplit(data, b"\xfc")
191
+ def _byte_bits(self, data):
192
+ if isxml(data) or isjson(data):
193
+ self.load(data)
194
+ else:
195
+ data = self._pkt_bits(data)
196
+ self.bites = self.idxsplit(data, b"\xfc")
197
+ return self.bites
198
+
199
+ def _node_bits(self, data):
200
+ data = data.mk()
201
+ self._from_xml(data)
202
+ return self.bites
203
+
204
+ def _dict_bits(self, data):
205
+ self.load(data)
181
206
  return self.bites
182
207
 
183
208
  def _mk_bits(self, data):
184
209
  """
185
- cue._mk_bits Converts
186
- Hex and Base64 strings into bytes.
187
- """
188
- if isinstance(data, dict):
189
- self.load(data)
190
- return self.bites
191
- if isinstance(data, str):
192
- return self._str_bits(data)
193
- if isinstance(data, bytes):
194
- if isxml(data) or isjson(data):
195
- self.load(data)
196
- return self.bites
197
- return self._byte_bits(data)
198
- if isinstance(data, int):
199
- return self._int_bits(data)
200
-
201
- return False
210
+ cue._mk_bits converts
211
+ several SCTE-35 formats into bytes.
212
+ """
213
+ type_map = {
214
+ Node: self._node_bits,
215
+ dict: self._dict_bits,
216
+ str: self._str_bits,
217
+ bytes: self._byte_bits,
218
+ int: self._int_bits,
219
+ }
220
+
221
+ td = type(data)
222
+ if td in type_map.keys():
223
+ return type_map[td](data)
224
+
225
+ ## if isinstance(data,Node):
226
+ ## return self._node_bits(data)
227
+ ## if isinstance(data, dict):
228
+ ## return self.dict_bits(data)
229
+ ## if isinstance(data, str):
230
+ ## return self._str_bits(data)
231
+ ## if isinstance(data, bytes):
232
+ ## return self._byte_bits(data)
233
+ ## if isinstance(data, int):
234
+ ## return self._int_bits(data)
235
+ ## return self.bites
202
236
 
203
237
  def _mk_descriptors(self, bites):
204
238
  """
@@ -390,7 +424,7 @@ class Cue(SCTE35Base):
390
424
  if isinstance(gonzo, bytes):
391
425
  gonzo = clean(gonzo)
392
426
  if isinstance(gonzo, str):
393
- if isxml(gonzo) :
427
+ if isxml(gonzo):
394
428
  self._from_xml(gonzo)
395
429
  return self.bites
396
430
  gonzo = json.loads(gonzo)
@@ -405,9 +439,9 @@ class Cue(SCTE35Base):
405
439
  _from_xml converts xml to data that can
406
440
  be loaded by a Cue instance.
407
441
  """
408
- gonzo=clean(gonzo)
409
- if "<scte35:Binary>" in gonzo:
410
- dat = gonzo.split("<scte35:Binary>")[1].split("</scte35:Binary>")[0]
442
+ gonzo = clean(gonzo)
443
+ if "Binary" in gonzo:
444
+ dat = gonzo.split("Binary>", 1)[1].split("<", 1)[0]
411
445
  self.bites = self._mk_bits(dat)
412
446
  self.decode()
413
447
  elif "SpliceInfoSection" in gonzo:
@@ -423,7 +457,7 @@ class Cue(SCTE35Base):
423
457
  comment = (
424
458
  f"Segmentation type id {dscptr.segmentation_type_id} is not in table 22"
425
459
  )
426
- sis.add_comment(comment)
460
+ sis.addcomment(comment)
427
461
 
428
462
  def _xml_mk_descriptor(self, sis, ns):
429
463
  """
@@ -432,7 +466,7 @@ class Cue(SCTE35Base):
432
466
  for dscptr in self.descriptors:
433
467
  if dscptr.has("segmentation_type_id"):
434
468
  self._xml_segmentation_comment(dscptr, sis)
435
- sis.add_child(dscptr.xml(ns=ns))
469
+ sis.addchild(dscptr.xml(ns=ns))
436
470
  return sis
437
471
 
438
472
  def xml(self, ns="scte35"):
@@ -443,9 +477,9 @@ class Cue(SCTE35Base):
443
477
  """
444
478
  sis = self.info_section.xml(ns=ns)
445
479
  cmd = self.command.xml(ns=ns)
446
- sis.add_child(cmd)
480
+ sis.addchild(cmd)
447
481
  sis = self._xml_mk_descriptor(sis, ns)
448
- return sis.mk() # xml returns a string NOT a Node instance.
482
+ return sis # xml retuns a Node instance. now
449
483
 
450
484
  def xmlbin(self, ns="scte35"):
451
485
  """