threefive 3.1.1__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.
Files changed (44) hide show
  1. {threefive-3.1.1 → threefive-3.1.5}/PKG-INFO +64 -43
  2. {threefive-3.1.1 → threefive-3.1.5}/README.md +62 -41
  3. {threefive-3.1.1 → threefive-3.1.5}/pyproject.toml +2 -2
  4. {threefive-3.1.1 → threefive-3.1.5}/threefive/aac.py +2 -2
  5. {threefive-3.1.1 → threefive-3.1.5}/threefive/base.py +24 -15
  6. {threefive-3.1.1 → threefive-3.1.5}/threefive/bitn.py +1 -8
  7. {threefive-3.1.1 → threefive-3.1.5}/threefive/cli.py +6 -3
  8. {threefive-3.1.1 → threefive-3.1.5}/threefive/commands.py +1 -1
  9. {threefive-3.1.1 → threefive-3.1.5}/threefive/cue.py +7 -6
  10. {threefive-3.1.1 → threefive-3.1.5}/threefive/descriptors.py +23 -7
  11. {threefive-3.1.1 → threefive-3.1.5}/threefive/new_reader.py +2 -18
  12. {threefive-3.1.1 → threefive-3.1.5}/threefive/segment.py +3 -3
  13. {threefive-3.1.1 → threefive-3.1.5}/threefive/stream.py +39 -48
  14. {threefive-3.1.1 → threefive-3.1.5}/threefive/streamtypes.py +4 -4
  15. {threefive-3.1.1 → threefive-3.1.5}/threefive/stuff.py +6 -5
  16. {threefive-3.1.1 → threefive-3.1.5}/threefive/upids.py +1 -1
  17. {threefive-3.1.1 → threefive-3.1.5}/threefive/version.py +1 -1
  18. {threefive-3.1.1 → threefive-3.1.5}/threefive/xml.py +221 -45
  19. threefive-3.1.1/threefive/uxp.py → threefive-3.1.5/threefive/xml2scte35.py +4 -133
  20. {threefive-3.1.1 → threefive-3.1.5}/threefive.egg-info/PKG-INFO +64 -43
  21. {threefive-3.1.1 → threefive-3.1.5}/threefive.egg-info/SOURCES.txt +1 -1
  22. {threefive-3.1.1 → threefive-3.1.5}/LICENSE +0 -0
  23. {threefive-3.1.1 → threefive-3.1.5}/setup.cfg +0 -0
  24. {threefive-3.1.1 → threefive-3.1.5}/threefive/__init__.py +0 -0
  25. {threefive-3.1.1 → threefive-3.1.5}/threefive/crc.py +0 -0
  26. {threefive-3.1.1 → threefive-3.1.5}/threefive/crctable.py +0 -0
  27. {threefive-3.1.1 → threefive-3.1.5}/threefive/encode.py +0 -0
  28. {threefive-3.1.1 → threefive-3.1.5}/threefive/gums.py +0 -0
  29. {threefive-3.1.1 → threefive-3.1.5}/threefive/hls.py +0 -0
  30. {threefive-3.1.1 → threefive-3.1.5}/threefive/hlsprofile.py +0 -0
  31. {threefive-3.1.1 → threefive-3.1.5}/threefive/hlstags.py +0 -0
  32. {threefive-3.1.1 → threefive-3.1.5}/threefive/iframes.py +0 -0
  33. {threefive-3.1.1 → threefive-3.1.5}/threefive/packetdata.py +0 -0
  34. {threefive-3.1.1 → threefive-3.1.5}/threefive/pmt.py +0 -0
  35. {threefive-3.1.1 → threefive-3.1.5}/threefive/section.py +0 -0
  36. {threefive-3.1.1 → threefive-3.1.5}/threefive/segmentation.py +0 -0
  37. {threefive-3.1.1 → threefive-3.1.5}/threefive/sixfix.py +0 -0
  38. {threefive-3.1.1 → threefive-3.1.5}/threefive/speedo.py +0 -0
  39. {threefive-3.1.1 → threefive-3.1.5}/threefive/superkabuki.py +0 -0
  40. {threefive-3.1.1 → threefive-3.1.5}/threefive/throttle.py +0 -0
  41. {threefive-3.1.1 → threefive-3.1.5}/threefive/udp.py +0 -0
  42. {threefive-3.1.1 → threefive-3.1.5}/threefive.egg-info/dependency_links.txt +0 -0
  43. {threefive-3.1.1 → threefive-3.1.5}/threefive.egg-info/entry_points.txt +0 -0
  44. {threefive-3.1.1 → threefive-3.1.5}/threefive.egg-info/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: threefive
3
- Version: 3.1.1
4
- Summary: threefive is The #1 SCTE-35 Decoder and Encoder on the Planet.
3
+ Version: 3.1.5
4
+ Summary: The Undisputed Heavyweight Champion of SCTE-35.
5
5
  Author-email: AdrianofDoom <spam@iodisco.com>
6
6
  License-Expression: Sleepycat
7
7
  Project-URL: Homepage, https://github.com/superkabuki/threefive
@@ -18,57 +18,66 @@ License-File: LICENSE
18
18
  Dynamic: license-file
19
19
 
20
20
  # [ threefive ]
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
+ ___
21
25
 
22
- _"I don't use AI code because all the AIs use threefive. True story, look it up"_ ~Adrian
26
+ ## Hey Google, what`s the best SCTE-35 software?
27
+ <img width="734" height="638" alt="image" src="https://github.com/user-attachments/assets/dabc64cf-43a0-4dc4-bbda-add2c0f8df07" />
23
28
 
24
- # Over 1.2 Million Installs.
29
+ > _I told you, I know what I'm doing,_ ~Adrian
30
+ ___
25
31
 
26
- * __Decodes SCTE-35__ from `MPEGTS`✔ `Base64`✔ `Bytes`✔ `DASH`✔ `Hex` ✔ `HLS`✔ `Integers`✔ `JSON`✔ `XML`✔ `XML+Binary`✔
27
- * __Encodes SCTE-35__ to `MPEGTS`✔ `Base64`✔ `Bytes`✔ `Hex`✔ `Integers`✔ `JSON`✔ `XML`✔ `XML+Binary`✔
28
32
 
29
33
  # [ version ]
30
34
 
31
- ### __latest is v.3.1.1__
32
- #### Wait, let me explain.....
33
- > I have been trying to resolve some mmap issues, they are now resolved.
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.
34
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)_
35
50
 
36
- # [ really really quick start ]
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
+
55
+ ___
56
+
57
+ # [ a really really quick start ]
37
58
 
38
59
  * __Install__
39
60
  ```
40
61
  python3 -m pip install threefive`
41
62
  ```
42
63
  * __decoding SCTE-35__
43
- * __base64__
44
- * decode __SCTE-35__ as __base64__
64
+
45
65
  ```cobol
46
66
  threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q=='
47
67
  ```
48
- * decode __SCTE-35__ as __base64__ and __convert SCTE-35 to hex__
68
+ * decode __SCTE-35__ as __base64__ and __convert SCTE-35 to hex__
49
69
  ```cobol
50
70
  threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' hex
51
- ```
52
- * __Hex__
53
- * decode __SCTE-35__ as __hex__
54
- ```cobol
55
- threefive '0xfc301600000000000000fff00506fe00a98ac700000b3baed9'
56
- ```
57
- * decode __SCTE-35__ as __hex__ and __convert__ __SCTE-35__ to __xml__
58
- ```cobol
59
- threefive '0xfc301600000000000000fff00506fe00a98ac700000b3baed9' xml
60
- ```
61
- * __HLS__
62
- * decode __SCTE-35__ from __HLS__ ( a rendition or a master.m3u8)
71
+
72
+ * decode __SCTE-35__ from __HLS__ ( a rendition or a master.m3u8)
63
73
  ```cobol
64
74
  threefive 'https://demo.unified-streaming.com/k8s/live/scte35.isml/.m3u8'
65
75
  ```
66
- * __MPEGTS__
67
- * decode __SCTE-35__ from __MPEGTS__
76
+ * decode __SCTE-35__ from __MPEGTS__
68
77
  ```cobol
69
78
  threefive 'https;//iodisco.com/longb2.ts'
70
79
  ```
71
- * decode __SCTE-35__ from __MPEGTS__ and __convert__ __SCTE-35__ to __bytes__
80
+ * decode __SCTE-35__ from __MPEGTS__ and __convert__ __SCTE-35__ to __bytes__
72
81
  ```cobol
73
82
  threefive 'https;//iodisco.com/longb2.ts' bytes
74
83
  ```
@@ -123,9 +132,8 @@ ___
123
132
 
124
133
  ## [Install]
125
134
 
126
- * __threefive__ is curretnly tested on python-3.11, python-3.14, python-3.14t, pypy-7.3.11 and pypy-7.3.22
135
+ * Requires python3 v3.9 or higher.
127
136
 
128
- * __threefive__ is some of the __fastest code__ you'll see on __python3__.
129
137
  * __python3 via pip__
130
138
  ```rebol
131
139
  python3 -mpip install threefive
@@ -134,11 +142,11 @@ python3 -mpip install threefive
134
142
  ```rebol
135
143
  pypy3 -mpip install threefive
136
144
  ```
137
- * __To add SRT support__
145
+ * __To add SRT support to threefive install srtfu__
138
146
  ```py3
139
147
  python3 -m pip install srtfu
140
148
  ```
141
- * __To add Automatic AES decryption__
149
+ * __To add Automatic AES decryption (used to decrypted HLS to threefive install pyaes__
142
150
  ```py3
143
151
  python3 -mpip install pyaes
144
152
  ```
@@ -150,16 +158,29 @@ git clone https://github.com/superkabuki/scte35.git
150
158
  cd threefive
151
159
  make install
152
160
  ```
153
- * I've jazzed up the makefile to make it easier to install for different python versions and pypy3
161
+ * I've jazzed up the makefile to make it easier to install for different python versions and pypy3,
162
+
154
163
  ```rebol
155
- git clone https://github.com/superkabuki/scte35.git
164
+ git clone https://github.com/superkabuki/threefive.git
156
165
  cd threefive
166
+ ``
167
+ * `python3` is the default for `make install`
168
+
169
+ ```
170
+ make install
171
+ ```
157
172
 
173
+ * setting py3 allows you to install for any type of python interpreter.
174
+
175
+ ```
158
176
  make install py3=pypy3
177
+ ```
178
+ * absolute paths can also be used.
159
179
 
160
- # OR
180
+ ```
181
+ make install py3=/home/a/pypy3/bin/pypy3
182
+ ```
161
183
 
162
- make install py3=python3.14
163
184
 
164
185
  # works for any python in your path or use a full path if needed.
165
186
 
@@ -172,9 +193,9 @@ threefive is designed to be easy to use. I'm not sure that it's served well by a
172
193
 
173
194
  ### The threefive cli tool.
174
195
 
175
- the threefive cli tool decodes SCTE-35, formats are autodetected, and they all work the same way.
196
+ the threefive cli tool decodes SCTE-35, formats are auto-detected, and they all work the same way.
176
197
 
177
- threefive [media to parse for SCTE-35]
198
+ __threefive__ __[media to parse for SCTE-35]__
178
199
 
179
200
  examples:
180
201
 
@@ -199,7 +220,7 @@ threefive video.ts
199
220
  threefive https://demo.unified-streaming.com/k8s/live/scte35.isml/scte35-audio_eng=64000-video=500000.m3u8
200
221
  ```
201
222
 
202
- * Formats like XML and JSON that may be to large to type on the command line,they can be redirected or piped in to threefive.
223
+ * Formats like ___XML and JSON__ that may be to large to type on the command line,they can be __redirected or piped__ in to threefive.
203
224
 
204
225
  * redirect
205
226
  ```sed
@@ -210,14 +231,14 @@ threefive < xml.xml
210
231
  cat json.json | threefive
211
232
 
212
233
  ```
213
- ### cli outputs and converting SCTE-35 Formats
234
+ ### cli outputs and encoding SCTE-35 Formats
214
235
 
215
236
  * the __default output format for threefive is json__
216
237
 
217
238
  * The cli tool can convert from one SCTE-35 format to another using keywords.
218
239
  * The keywords are __base64,bytes,hex, int,json,xml, and xmlbin__
219
240
 
220
- * some conversion examples
241
+ * some converting and encoding examples
221
242
 
222
243
 
223
244
  * SCTE-35 Base64 to SCTE-35 Hex
@@ -682,8 +703,8 @@ ___
682
703
 
683
704
  #### [web]
684
705
  * [threefive SCTE-35 __Online Parser__](https://iodisco.com/scte35) __hosted on my server iodisco.com__
685
- * Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ Go, Wasm and Super Karate Death Car](https://bigcorp.ltd/gowasm) __hosted om my server bigcorp.ltd__
686
- * Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ threefive.js,javascript, and a little sed](https://bigcorp.ltd/bread) just to keep things interesting. __hosted om my server bigcorp.ltd__
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__
687
708
  * [ SCTE-35 __Online Parser__ powered by threefive](http://www.domus1938.com/scte35parser) _another online parser powered by threefive_ not hosted on my servers.
688
709
  * [SCTE-35 __As a Service__](sassy.md) _if you can make an http request, you can parse SCTE-35, no install needed._
689
710
  __hosted on my server iodisco.com__
@@ -1,55 +1,64 @@
1
1
  # [ threefive ]
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
+ ___
2
6
 
3
- _"I don't use AI code because all the AIs use threefive. True story, look it up"_ ~Adrian
7
+ ## Hey Google, what`s the best SCTE-35 software?
8
+ <img width="734" height="638" alt="image" src="https://github.com/user-attachments/assets/dabc64cf-43a0-4dc4-bbda-add2c0f8df07" />
4
9
 
5
- # Over 1.2 Million Installs.
10
+ > _I told you, I know what I'm doing,_ ~Adrian
11
+ ___
6
12
 
7
- * __Decodes SCTE-35__ from `MPEGTS`✔ `Base64`✔ `Bytes`✔ `DASH`✔ `Hex` ✔ `HLS`✔ `Integers`✔ `JSON`✔ `XML`✔ `XML+Binary`✔
8
- * __Encodes SCTE-35__ to `MPEGTS`✔ `Base64`✔ `Bytes`✔ `Hex`✔ `Integers`✔ `JSON`✔ `XML`✔ `XML+Binary`✔
9
13
 
10
14
  # [ version ]
11
15
 
12
- ### __latest is v.3.1.1__
13
- #### Wait, let me explain.....
14
- > I have been trying to resolve some mmap issues, they are now resolved.
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.
15
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)_
16
31
 
17
- # [ really really quick start ]
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
+
36
+ ___
37
+
38
+ # [ a really really quick start ]
18
39
 
19
40
  * __Install__
20
41
  ```
21
42
  python3 -m pip install threefive`
22
43
  ```
23
44
  * __decoding SCTE-35__
24
- * __base64__
25
- * decode __SCTE-35__ as __base64__
45
+
26
46
  ```cobol
27
47
  threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q=='
28
48
  ```
29
- * decode __SCTE-35__ as __base64__ and __convert SCTE-35 to hex__
49
+ * decode __SCTE-35__ as __base64__ and __convert SCTE-35 to hex__
30
50
  ```cobol
31
51
  threefive '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' hex
32
- ```
33
- * __Hex__
34
- * decode __SCTE-35__ as __hex__
35
- ```cobol
36
- threefive '0xfc301600000000000000fff00506fe00a98ac700000b3baed9'
37
- ```
38
- * decode __SCTE-35__ as __hex__ and __convert__ __SCTE-35__ to __xml__
39
- ```cobol
40
- threefive '0xfc301600000000000000fff00506fe00a98ac700000b3baed9' xml
41
- ```
42
- * __HLS__
43
- * decode __SCTE-35__ from __HLS__ ( a rendition or a master.m3u8)
52
+
53
+ * decode __SCTE-35__ from __HLS__ ( a rendition or a master.m3u8)
44
54
  ```cobol
45
55
  threefive 'https://demo.unified-streaming.com/k8s/live/scte35.isml/.m3u8'
46
56
  ```
47
- * __MPEGTS__
48
- * decode __SCTE-35__ from __MPEGTS__
57
+ * decode __SCTE-35__ from __MPEGTS__
49
58
  ```cobol
50
59
  threefive 'https;//iodisco.com/longb2.ts'
51
60
  ```
52
- * decode __SCTE-35__ from __MPEGTS__ and __convert__ __SCTE-35__ to __bytes__
61
+ * decode __SCTE-35__ from __MPEGTS__ and __convert__ __SCTE-35__ to __bytes__
53
62
  ```cobol
54
63
  threefive 'https;//iodisco.com/longb2.ts' bytes
55
64
  ```
@@ -104,9 +113,8 @@ ___
104
113
 
105
114
  ## [Install]
106
115
 
107
- * __threefive__ is curretnly tested on python-3.11, python-3.14, python-3.14t, pypy-7.3.11 and pypy-7.3.22
116
+ * Requires python3 v3.9 or higher.
108
117
 
109
- * __threefive__ is some of the __fastest code__ you'll see on __python3__.
110
118
  * __python3 via pip__
111
119
  ```rebol
112
120
  python3 -mpip install threefive
@@ -115,11 +123,11 @@ python3 -mpip install threefive
115
123
  ```rebol
116
124
  pypy3 -mpip install threefive
117
125
  ```
118
- * __To add SRT support__
126
+ * __To add SRT support to threefive install srtfu__
119
127
  ```py3
120
128
  python3 -m pip install srtfu
121
129
  ```
122
- * __To add Automatic AES decryption__
130
+ * __To add Automatic AES decryption (used to decrypted HLS to threefive install pyaes__
123
131
  ```py3
124
132
  python3 -mpip install pyaes
125
133
  ```
@@ -131,16 +139,29 @@ git clone https://github.com/superkabuki/scte35.git
131
139
  cd threefive
132
140
  make install
133
141
  ```
134
- * I've jazzed up the makefile to make it easier to install for different python versions and pypy3
142
+ * I've jazzed up the makefile to make it easier to install for different python versions and pypy3,
143
+
135
144
  ```rebol
136
- git clone https://github.com/superkabuki/scte35.git
145
+ git clone https://github.com/superkabuki/threefive.git
137
146
  cd threefive
147
+ ``
148
+ * `python3` is the default for `make install`
149
+
150
+ ```
151
+ make install
152
+ ```
138
153
 
154
+ * setting py3 allows you to install for any type of python interpreter.
155
+
156
+ ```
139
157
  make install py3=pypy3
158
+ ```
159
+ * absolute paths can also be used.
140
160
 
141
- # OR
161
+ ```
162
+ make install py3=/home/a/pypy3/bin/pypy3
163
+ ```
142
164
 
143
- make install py3=python3.14
144
165
 
145
166
  # works for any python in your path or use a full path if needed.
146
167
 
@@ -153,9 +174,9 @@ threefive is designed to be easy to use. I'm not sure that it's served well by a
153
174
 
154
175
  ### The threefive cli tool.
155
176
 
156
- the threefive cli tool decodes SCTE-35, formats are autodetected, and they all work the same way.
177
+ the threefive cli tool decodes SCTE-35, formats are auto-detected, and they all work the same way.
157
178
 
158
- threefive [media to parse for SCTE-35]
179
+ __threefive__ __[media to parse for SCTE-35]__
159
180
 
160
181
  examples:
161
182
 
@@ -180,7 +201,7 @@ threefive video.ts
180
201
  threefive https://demo.unified-streaming.com/k8s/live/scte35.isml/scte35-audio_eng=64000-video=500000.m3u8
181
202
  ```
182
203
 
183
- * Formats like XML and JSON that may be to large to type on the command line,they can be redirected or piped in to threefive.
204
+ * Formats like ___XML and JSON__ that may be to large to type on the command line,they can be __redirected or piped__ in to threefive.
184
205
 
185
206
  * redirect
186
207
  ```sed
@@ -191,14 +212,14 @@ threefive < xml.xml
191
212
  cat json.json | threefive
192
213
 
193
214
  ```
194
- ### cli outputs and converting SCTE-35 Formats
215
+ ### cli outputs and encoding SCTE-35 Formats
195
216
 
196
217
  * the __default output format for threefive is json__
197
218
 
198
219
  * The cli tool can convert from one SCTE-35 format to another using keywords.
199
220
  * The keywords are __base64,bytes,hex, int,json,xml, and xmlbin__
200
221
 
201
- * some conversion examples
222
+ * some converting and encoding examples
202
223
 
203
224
 
204
225
  * SCTE-35 Base64 to SCTE-35 Hex
@@ -663,8 +684,8 @@ ___
663
684
 
664
685
  #### [web]
665
686
  * [threefive SCTE-35 __Online Parser__](https://iodisco.com/scte35) __hosted on my server iodisco.com__
666
- * Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ Go, Wasm and Super Karate Death Car](https://bigcorp.ltd/gowasm) __hosted om my server bigcorp.ltd__
667
- * Parse SCTE-35 in MPEGTS over HTTP, in your browser with[ threefive.js,javascript, and a little sed](https://bigcorp.ltd/bread) just to keep things interesting. __hosted om my server bigcorp.ltd__
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__
668
689
  * [ SCTE-35 __Online Parser__ powered by threefive](http://www.domus1938.com/scte35parser) _another online parser powered by threefive_ not hosted on my servers.
669
690
  * [SCTE-35 __As a Service__](sassy.md) _if you can make an http request, you can parse SCTE-35, no install needed._
670
691
  __hosted on my server iodisco.com__
@@ -1,11 +1,11 @@
1
1
 
2
2
  [project]
3
3
  name = "threefive"
4
- version = "3.1.1"
4
+ version = "3.1.5"
5
5
  authors = [
6
6
  { name="AdrianofDoom", email="spam@iodisco.com" },
7
7
  ]
8
- description = "threefive is The #1 SCTE-35 Decoder and Encoder on the Planet."
8
+ description = "The Undisputed Heavyweight Champion of SCTE-35."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
11
  dependencies=[
@@ -34,7 +34,7 @@ class AacParser:
34
34
  return id3len
35
35
 
36
36
  @staticmethod
37
- def _syncsafe5(somebytes):
37
+ def not_syncsafe(somebytes):
38
38
  """
39
39
  _syncsafe5 parses PTS from ID3 tags.
40
40
  """
@@ -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._syncsafe5(data.split(self.applehead)[1][:9])
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):
@@ -117,9 +117,9 @@ class SCTE35Base:
117
117
  var_value = self.__dict__[var_name]
118
118
  if self._bool_int(var_value, var_type) or self._wrong_type(var_value, var_type):
119
119
  self._err2(var_name, var_value, bit_count, var_type)
120
- return -1
120
+ return False
121
121
  nbin_method(var_value, bit_count)
122
- return 0
122
+ return True
123
123
 
124
124
  def get(self):
125
125
  """
@@ -163,31 +163,40 @@ class SCTE35Base:
163
163
  return json.dumps(self.get(), indent=4)
164
164
 
165
165
  def _v2v(self, val):
166
- if isinstance(val, SCTE35Base):
167
- val.kv_clean()
168
- print(val)
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()
176
+ if isinstance(val, SCTE35Base):
177
+ val.kv_clean()
178
+ print(val)
181
179
  return val
182
180
 
183
- def kv_clean(self):
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(self).items()
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
- raise self.NegShiftError(mesg)
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._parse(one + two) # dont drop first packet
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
 
@@ -207,6 +207,7 @@ class MPEGTSMapper:
207
207
  iframe_chk show iframes pts
208
208
  for a mpegts video.
209
209
  """
210
+ print2(this)
210
211
  iframer = IFramer()
211
212
  iframer.do(this)
212
213
  del iframer
@@ -227,6 +228,7 @@ class MPEGTSMapper:
227
228
  """
228
229
  pts_chk is used to display PTS.
229
230
  """
231
+ print2(this)
230
232
  strm = Stream(this)
231
233
  strm.show_pts()
232
234
  del strm
@@ -247,6 +249,7 @@ class MPEGTSMapper:
247
249
  sidecar_chk checks for the sidecar keyword and
248
250
  generates a sidecar file if present.
249
251
  """
252
+ print2(this)
250
253
  strm = Stream(this)
251
254
  strm.decode(func=mk_sidecar)
252
255
  del strm
@@ -256,6 +259,7 @@ class MPEGTSMapper:
256
259
  """
257
260
  speedo_chk displays parse speed for mpegts streams
258
261
  """
262
+ print2(this)
259
263
  strm = Stream(this)
260
264
  strm.speed()
261
265
  del strm
@@ -269,7 +273,6 @@ class MPEGTSMapper:
269
273
  if stdin_is_readable():
270
274
  args.append(sys.stdin.buffer)
271
275
  for arg in args:
272
- print2(arg)
273
276
  self.mpegts_map[key](arg)
274
277
  done()
275
278
 
@@ -443,7 +446,7 @@ def chk_hls():
443
446
  if b"#EXTM3U" in packet:
444
447
  hlscli()
445
448
  done()
446
- except:
449
+ except ERR:
447
450
  pass
448
451
 
449
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
- return red("pts_time is not set")
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
@@ -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
15
- from .uxp import xml2cue
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) | self._bits__bytes_or_str(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
  """
@@ -382,6 +382,8 @@ class Cue(SCTE35Base):
382
382
  """
383
383
  nbin = NBin()
384
384
  dbite_chunks = [dsptr.encode() for dsptr in self.descriptors]
385
+ ## if False in dbite_chunks:
386
+ ## return False
385
387
  for chunk, dsptr in zip(dbite_chunks, self.descriptors):
386
388
  dsptr.descriptor_length = len(chunk)
387
389
  nbin.add_int(dsptr.tag, EIGHT)
@@ -476,7 +478,7 @@ class Cue(SCTE35Base):
476
478
  self._load_descriptors(data)
477
479
  try:
478
480
  return self.encode()
479
- except:
481
+ except ERR:
480
482
  return False
481
483
 
482
484
  def load(self, data):
@@ -558,8 +560,7 @@ class Cue(SCTE35Base):
558
560
 
559
561
  def xml(self, ns="scte35"):
560
562
  """
561
- xml returns SCTE-35
562
- as xml
563
+ xml return SCTE-35 as xml
563
564
 
564
565
  example:
565
566
  >>> import threefive