threefive3 3.0.27__tar.gz → 3.0.29__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 (40) hide show
  1. {threefive3-3.0.27/threefive3.egg-info → threefive3-3.0.29}/PKG-INFO +12 -23
  2. {threefive3-3.0.27 → threefive3-3.0.29}/README.md +11 -22
  3. {threefive3-3.0.27 → threefive3-3.0.29}/bin/threefive3 +2 -11
  4. threefive3-3.0.29/threefive3/aac.py +62 -0
  5. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/base.py +5 -14
  6. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/bitn.py +3 -1
  7. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/commands.py +0 -70
  8. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/cue.py +13 -47
  9. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/descriptors.py +3 -118
  10. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/gums.py +3 -1
  11. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/hls.py +17 -60
  12. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/section.py +0 -15
  13. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/stream.py +5 -8
  14. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/upids.py +2 -99
  15. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/version.py +1 -1
  16. {threefive3-3.0.27 → threefive3-3.0.29/threefive3.egg-info}/PKG-INFO +12 -23
  17. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3.egg-info/SOURCES.txt +1 -3
  18. threefive3-3.0.27/threefive3/sxp.py +0 -94
  19. threefive3-3.0.27/threefive3/x2c.py +0 -253
  20. threefive3-3.0.27/threefive3/xml.py +0 -355
  21. {threefive3-3.0.27 → threefive3-3.0.29}/LICENSE +0 -0
  22. {threefive3-3.0.27 → threefive3-3.0.29}/setup.cfg +0 -0
  23. {threefive3-3.0.27 → threefive3-3.0.29}/setup.py +0 -0
  24. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/__init__.py +0 -0
  25. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/crc.py +0 -0
  26. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/encode.py +0 -0
  27. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/hlstags.py +0 -0
  28. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/iframes.py +0 -0
  29. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/new_reader.py +0 -0
  30. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/packetdata.py +0 -0
  31. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/segment.py +0 -0
  32. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/segmentation.py +0 -0
  33. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/sixfix.py +0 -0
  34. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/streamtypes.py +0 -0
  35. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/stuff.py +0 -0
  36. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/superkabuki.py +0 -0
  37. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3/words.py +0 -0
  38. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3.egg-info/dependency_links.txt +0 -0
  39. {threefive3-3.0.27 → threefive3-3.0.29}/threefive3.egg-info/requires.txt +0 -0
  40. {threefive3-3.0.27 → threefive3-3.0.29}/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.27
3
+ Version: 3.0.29
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
@@ -22,18 +22,18 @@ License-File: LICENSE
22
22
  Canada has a virtual monopoly on the World's mustard seed supply and they will use it to manipulate financial markets. We must act.
23
23
  ## Nuke Canada Now!
24
24
 
25
- [Install threefive3](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md) | [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) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
25
+ [Install threefive3](#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) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
26
26
 
27
27
 
28
28
 
29
29
  # threefive3 SCTE-35 cli super tool and python3 library.
30
30
  > Brought to you by the fine folks at fu-corp _( Adrian and the two blonde Chinese girls. )_
31
31
 
32
- ✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml ✅ SCTE-35 Cli ✅ SCTE-35 library
32
+ ✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml+binary ✅ SCTE-35 Cli ✅ SCTE-35 library
33
33
 
34
34
 
35
- * Parses SCTE-35 from MPEGTS, HLS, XML, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
36
- * Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON, Xml, or Xml+binary.
35
+ * Parses SCTE-35 from MPEGTS, HLS, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
36
+ * Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON, or Xml+binary.
37
37
  * Built-in network support for HTTP(S), UDP, and Multicast.
38
38
  * Automatic AES decryption for HLS.
39
39
  * All HLS SCTE-35 Tags are Supported.
@@ -73,7 +73,7 @@ Type "help", "copyright", "credits" or "license" for more information.
73
73
  | six2scte35 | ffmpeg bin data stream back to scte-35 | Done |
74
74
  | superkabuki | scte-35 packet injection | Next release |
75
75
  | sideways | hls scte-35 tag injecton | No |
76
- | gums | multicast server | Next release |
76
+ | gums | multicast server | Done |
77
77
  | adbreak3 | fast cli scte-35 cue creation | No |
78
78
 
79
79
 
@@ -110,12 +110,6 @@ If you want to get involved, just open an issue and we can talk about it.
110
110
  * [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?
111
111
 
112
112
 
113
- #### Xml
114
-
115
- * [SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md) The people wanted it so I finally did Xml.
116
- * I feel cheap and dirty.
117
- ___
118
-
119
113
  #### `Classes`
120
114
 
121
115
  * The python built in help is always the most up to date docs for the library.
@@ -184,17 +178,14 @@ ___
184
178
  ```rebol
185
179
  threefive3 udp://@235.2.5.35:3535
186
180
  ```
187
- * If a file comtains a SCTE-35 cue as a string( base64,hex,int,json,xml or xml+bin), redirect the file contents.
181
+ * If a file comtains a SCTE-35 cue as a string( base64,hex,int,json,or xml+bin), redirect the file contents.
188
182
  ```rebol
189
183
 
190
184
  threefive3 < json.json
191
185
 
192
- threefive3 < xml.xml
193
-
194
- cat xml.xml | threefive3
195
186
  ```
196
187
 
197
- * quoted strings(( base64,hex,int,json,xml or xml+bin), can be passed directly on the command line as well.
188
+ * quoted strings(( base64,hex,int,json or xml+bin), can be passed directly on the command line as well.
198
189
 
199
190
  ```awk
200
191
 
@@ -209,8 +200,7 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
209
200
  | __Hex__ |`threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b`|
210
201
  | __HLS__ |`threefive3 hls https://example.com/master.m3u8` |
211
202
  | __JSON__ |`threefive3 < json.json` |
212
- | __Xml__ | `threefive3 < xml.xml` |
213
- | __Xmlbin__ | `js threefive3 < xmlbin.xml` |
203
+ | __Xmlbin__ | `js threefive3 < xmlbin.xml` |
214
204
 
215
205
  # `Streams`
216
206
 
@@ -226,10 +216,10 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
226
216
 
227
217
 
228
218
  #### Outputs
229
- * output type is determined by the key words __base64, bytes, hex, int, json, xml, and xmlbin__.
219
+ * output type is determined by the key words __base64, bytes, hex, int, json, and xmlbin__.
230
220
  * __json is the default__.
231
221
  * __Any input (except HLS,) can be returned as any output__
232
- * examples __Base64 to Hex__, or __Mpegts to Xml__, etc...)
222
+ * examples __Base64 to Hex__ etc...)
233
223
 
234
224
 
235
225
  | Output Type | Cli Example |
@@ -239,7 +229,6 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
239
229
  | Hex | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' hex` |
240
230
  | Integer | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' int` |
241
231
  | JSON | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b json ` |
242
- | Xml | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' xml ` ` |
243
232
  | Xml+bin | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b xmlbin ` |`
244
233
 
245
234
  #### `hls`
@@ -321,4 +310,4 @@ ___
321
310
 
322
311
  ___
323
312
 
324
- [Install threefive3](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md) | [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) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
313
+ [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) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
@@ -1,18 +1,18 @@
1
1
  Canada has a virtual monopoly on the World's mustard seed supply and they will use it to manipulate financial markets. We must act.
2
2
  ## Nuke Canada Now!
3
3
 
4
- [Install threefive3](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md) | [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) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
4
+ [Install threefive3](#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) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
5
5
 
6
6
 
7
7
 
8
8
  # threefive3 SCTE-35 cli super tool and python3 library.
9
9
  > Brought to you by the fine folks at fu-corp _( Adrian and the two blonde Chinese girls. )_
10
10
 
11
- ✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml ✅ SCTE-35 Cli ✅ SCTE-35 library
11
+ ✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml+binary ✅ SCTE-35 Cli ✅ SCTE-35 library
12
12
 
13
13
 
14
- * Parses SCTE-35 from MPEGTS, HLS, XML, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
15
- * Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON, Xml, or Xml+binary.
14
+ * Parses SCTE-35 from MPEGTS, HLS, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
15
+ * Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON, or Xml+binary.
16
16
  * Built-in network support for HTTP(S), UDP, and Multicast.
17
17
  * Automatic AES decryption for HLS.
18
18
  * All HLS SCTE-35 Tags are Supported.
@@ -52,7 +52,7 @@ Type "help", "copyright", "credits" or "license" for more information.
52
52
  | six2scte35 | ffmpeg bin data stream back to scte-35 | Done |
53
53
  | superkabuki | scte-35 packet injection | Next release |
54
54
  | sideways | hls scte-35 tag injecton | No |
55
- | gums | multicast server | Next release |
55
+ | gums | multicast server | Done |
56
56
  | adbreak3 | fast cli scte-35 cue creation | No |
57
57
 
58
58
 
@@ -89,12 +89,6 @@ If you want to get involved, just open an issue and we can talk about it.
89
89
  * [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?
90
90
 
91
91
 
92
- #### Xml
93
-
94
- * [SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md) The people wanted it so I finally did Xml.
95
- * I feel cheap and dirty.
96
- ___
97
-
98
92
  #### `Classes`
99
93
 
100
94
  * The python built in help is always the most up to date docs for the library.
@@ -163,17 +157,14 @@ ___
163
157
  ```rebol
164
158
  threefive3 udp://@235.2.5.35:3535
165
159
  ```
166
- * If a file comtains a SCTE-35 cue as a string( base64,hex,int,json,xml or xml+bin), redirect the file contents.
160
+ * If a file comtains a SCTE-35 cue as a string( base64,hex,int,json,or xml+bin), redirect the file contents.
167
161
  ```rebol
168
162
 
169
163
  threefive3 < json.json
170
164
 
171
- threefive3 < xml.xml
172
-
173
- cat xml.xml | threefive3
174
165
  ```
175
166
 
176
- * quoted strings(( base64,hex,int,json,xml or xml+bin), can be passed directly on the command line as well.
167
+ * quoted strings(( base64,hex,int,json or xml+bin), can be passed directly on the command line as well.
177
168
 
178
169
  ```awk
179
170
 
@@ -188,8 +179,7 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
188
179
  | __Hex__ |`threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b`|
189
180
  | __HLS__ |`threefive3 hls https://example.com/master.m3u8` |
190
181
  | __JSON__ |`threefive3 < json.json` |
191
- | __Xml__ | `threefive3 < xml.xml` |
192
- | __Xmlbin__ | `js threefive3 < xmlbin.xml` |
182
+ | __Xmlbin__ | `js threefive3 < xmlbin.xml` |
193
183
 
194
184
  # `Streams`
195
185
 
@@ -205,10 +195,10 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
205
195
 
206
196
 
207
197
  #### Outputs
208
- * output type is determined by the key words __base64, bytes, hex, int, json, xml, and xmlbin__.
198
+ * output type is determined by the key words __base64, bytes, hex, int, json, and xmlbin__.
209
199
  * __json is the default__.
210
200
  * __Any input (except HLS,) can be returned as any output__
211
- * examples __Base64 to Hex__, or __Mpegts to Xml__, etc...)
201
+ * examples __Base64 to Hex__ etc...)
212
202
 
213
203
 
214
204
  | Output Type | Cli Example |
@@ -218,7 +208,6 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
218
208
  | Hex | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' hex` |
219
209
  | Integer | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' int` |
220
210
  | JSON | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b json ` |
221
- | Xml | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' xml ` ` |
222
211
  | Xml+bin | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b xmlbin ` |`
223
212
 
224
213
  #### `hls`
@@ -300,4 +289,4 @@ ___
300
289
 
301
290
  ___
302
291
 
303
- [Install threefive3](#install) |[SCTE-35 Cli](#the-cli-tool) |[SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md) | [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) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
292
+ [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) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
@@ -56,15 +56,14 @@ HELP = f"""
56
56
 
57
57
  {B} Default {U} {BLUE}The default action is to read a input and write a SCTE-35 output.{U}
58
58
 
59
- {BLUE}Inputs {U} mpegts, base64, hex, json, xml, and xmlbin{U}.
59
+ {BLUE}Inputs {U} mpegts, base64, hex, json,and xmlbin{U}.
60
60
 
61
- {BLUE}Outputs{U} base64, bytes, hex, int, json, xml, and xmlbin.{U}
61
+ {BLUE}Outputs{U} base64, bytes, hex, int, json, and xmlbin.{U}
62
62
 
63
63
  {BLUE}scte35 can read from {U} strings, files, stdin, http(s), multicast, and Udp.
64
64
 
65
65
  Input {U} Output {U}
66
66
  {U}{BLUE} mpegts {U} {U}{BLUE} base64 {NORM} threefive3 https://example.com/video.ts base64
67
- {U}{BLUE} xml {U} {U}{BLUE} bytes {NORM} threefive3 bytes < xml.xml
68
67
  {U}{BLUE} base64 {U} {U}{BLUE} hex {NORM} threefive3 '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' hex
69
68
  {U}{BLUE} xmlbin {U} {U}{BLUE} int {NORM} threefive3 int < xml.xml
70
69
  {U}{BLUE} mpegts {U} {U}{BLUE} json {NORM} threefive3 video.ts
@@ -269,13 +268,6 @@ def json_out(cue):
269
268
  cue.show()
270
269
 
271
270
 
272
- def xml_out(cue):
273
- """
274
- xml_out prints cue as xml
275
- """
276
- print2(cue.xml())
277
-
278
-
279
271
  def xmlbin_out(cue):
280
272
  """
281
273
  xml_out prints cue as xml
@@ -289,7 +281,6 @@ funk_map = {
289
281
  "hex": hex_out,
290
282
  "int": int_out,
291
283
  "json": json_out,
292
- "xml": xml_out,
293
284
  "xmlbin": xmlbin_out,
294
285
  }
295
286
 
@@ -0,0 +1,62 @@
1
+ """
2
+ aac.py
3
+ home of the AacParser for audio only hls renditions
4
+ """
5
+ from .new_reader import reader
6
+
7
+
8
+ ROLLOVER = 95443.717678
9
+
10
+
11
+ class AacParser:
12
+ """
13
+ AacParser parses aac segments.
14
+ """
15
+
16
+ applehead = b"com.apple.streaming.transportStreamTimestamp"
17
+
18
+ @staticmethod
19
+ def is_header(header):
20
+ """
21
+ is_header tests aac and ac3 files for ID3 headers.
22
+ """
23
+ if header[:3] == b"ID3":
24
+ return True
25
+ return False
26
+
27
+ @staticmethod
28
+ def id3_len(header):
29
+ """
30
+ id3_len parses the length value from ID3 headers
31
+ """
32
+ id3len = int.from_bytes(header[6:], byteorder="big")
33
+ return id3len
34
+
35
+ @staticmethod
36
+ def syncsafe5(somebytes):
37
+ """
38
+ syncsafe5 parses PTS from ID3 tags.
39
+ """
40
+ lsb = len(somebytes) - 1
41
+ syncd = 0
42
+ for idx, bite in enumerate(somebytes):
43
+ syncd += bite << ((lsb - idx) << 3)
44
+ return round(syncd / 90000.0, 6)
45
+
46
+ def parse(self, media):
47
+ """
48
+ aac_pts parses the ID3 header tags in aac and ac3 audio files
49
+ """
50
+ pts = 0
51
+ aac = reader(media)
52
+ header = aac.read(10)
53
+ if self.is_header(header):
54
+ id3len = self.id3_len(header)
55
+ data = aac.read(id3len)
56
+ if self.applehead in data:
57
+ try:
58
+ pts = float(data.split(self.applehead)[1].split(b"\x00", 2)[1])
59
+ except:
60
+ pts = self.syncsafe5(data.split(self.applehead)[1][:9])
61
+ return round((pts % ROLLOVER), 6)
62
+
@@ -1,12 +1,11 @@
1
1
  """
2
- scte35.base contains
2
+ threefive3.base contains
3
3
  the class SCTE35Base.
4
4
  """
5
5
 
6
6
  import json
7
7
  from .bitn import NBin
8
8
  from .stuff import print2, red
9
- from .xml import Node
10
9
 
11
10
 
12
11
  class SCTE35Base:
@@ -36,16 +35,19 @@ class SCTE35Base:
36
35
  if isinstance(var_value, bool):
37
36
  self._err2(var_name, var_value, bit_count, var_type)
38
37
  return True
38
+ return False
39
39
 
40
40
  def _wrong_type(self, var_name, var_value, bit_count, var_type):
41
41
  if not isinstance(var_value, var_type):
42
42
  self._err2(var_name, var_value, bit_count, var_type)
43
43
  return True
44
+ return False
44
45
 
45
46
  def _is_none(self, var_name, var_value, bit_count, var_type):
46
47
  if var_value is None:
47
48
  self._err2(var_name, var_value, bit_count, var_type)
48
49
  return True
50
+ return False
49
51
 
50
52
  def _chk_var(self, var_type, nbin_method, var_name, bit_count):
51
53
  """
@@ -56,6 +58,7 @@ class SCTE35Base:
56
58
  if me(var_name, var_value, bit_count, var_type):
57
59
  return
58
60
  nbin_method(var_value, bit_count)
61
+ return
59
62
 
60
63
  @staticmethod
61
64
  def as_90k(int_time):
@@ -184,15 +187,3 @@ class SCTE35Base:
184
187
  show prints self as json to stderr (2)
185
188
  """
186
189
  print2(self.json())
187
-
188
- def xml(self, ns="scte35"):
189
- """
190
- xml default xml method will return
191
- all attributes, which is expressly allowed
192
- for SCTE-35 xml.
193
- """
194
- xml_attrs = self.kv_clean()
195
- iam = type(self)
196
- iam = str(iam).split("'", 1)[1].split("'", 1)[0]
197
- this = Node(iam, attrs=xml_attrs, ns=ns)
198
- return this
@@ -157,12 +157,14 @@ class NBin:
157
157
  and appends it to self.nbits
158
158
  via self.add_int
159
159
  """
160
+ dehexed=False
160
161
  if isinstance(hex_str, str):
161
162
  dehexed = int(hex_str, 16)
162
163
  # just in case hex_str is an int....
163
164
  if isinstance(hex_str, int):
164
165
  dehexed = hex_str
165
- self.add_int(dehexed, bit_len)
166
+ if dehexed:
167
+ self.add_int(dehexed, bit_len)
166
168
 
167
169
  def add_flag(self, flg, bit_len=1):
168
170
  """
@@ -5,7 +5,6 @@ SCTE35 Splice Commands
5
5
  from .bitn import Bitn
6
6
  from .base import SCTE35Base
7
7
  from .stuff import red
8
- from .xml import Node
9
8
 
10
9
 
11
10
  class SpliceCommand(SCTE35Base):
@@ -54,12 +53,6 @@ class BandwidthReservation(SpliceCommand):
54
53
  BandwidthReservation.decode method
55
54
  """
56
55
 
57
- def xml(self, ns="scte35"):
58
- """
59
- create XML Node of type BandwidthReservation
60
- """
61
- return Node("BandwidthReservation", ns=ns)
62
-
63
56
 
64
57
  class PrivateCommand(SpliceCommand):
65
58
  """
@@ -91,16 +84,6 @@ class PrivateCommand(SpliceCommand):
91
84
  nbin.add_bites(self.private_bytes)
92
85
  return nbin.bites
93
86
 
94
- def xml(self, ns="scte35"):
95
- """
96
- create XML Node of type PrivateCommand
97
- """
98
- attrs = {"identifier": self.identifier}
99
- pc = Node("PrivateCommand", attrs=attrs)
100
- pc.add_child(Node("PrivateBytes", value=self.private_bytes.hex(), ns=ns))
101
- return pc
102
-
103
-
104
87
  class SpliceNull(SpliceCommand):
105
88
  """
106
89
  Table 8 - splice_null()
@@ -111,9 +94,6 @@ class SpliceNull(SpliceCommand):
111
94
  self.command_type = 0
112
95
  self.name = "Splice Null"
113
96
 
114
- def xml(self, ns="scte35"):
115
- return Node("SpliceNull", ns=ns)
116
-
117
97
 
118
98
  class TimeSignal(SpliceCommand):
119
99
  """
@@ -171,22 +151,6 @@ class TimeSignal(SpliceCommand):
171
151
  else:
172
152
  nbin.reserve(7)
173
153
 
174
- def xml(self, ns="scte35"):
175
- """
176
- xml return TimeSignal as an xml node
177
- """
178
- ts = Node("TimeSignal", ns=ns)
179
- if self.has("pts_time"):
180
- if self.pts_time:
181
- self.pts_time = round(self.pts_time, 6)
182
- st = Node(
183
- "SpliceTime",
184
- attrs={"pts_time": self.as_ticks(self.pts_time)},
185
- ns=ns,
186
- )
187
- ts.add_child(st)
188
- return ts
189
-
190
154
 
191
155
  class SpliceInsert(TimeSignal):
192
156
  """
@@ -279,40 +243,6 @@ class SpliceInsert(TimeSignal):
279
243
  nbin.forward(6)
280
244
  nbin.add_int(self.as_ticks(self.break_duration), 33)
281
245
 
282
- def xml(self, ns="scte35"):
283
- """
284
- xml return the SpliceInsert instance as an xml node.
285
- """
286
- si_attrs = {
287
- "splice_event_id": self.splice_event_id,
288
- "splice_event_cancel_Indicator": self.splice_event_cancel_indicator,
289
- "splice_immediate_flag": self.splice_immediate_flag,
290
- "event_id_compliance_flag": self.event_id_compliance_flag,
291
- "avail_num": self.avail_num,
292
- "avails_expected": self.avails_expected,
293
- "out_of_network_indicator": self.out_of_network_indicator,
294
- "unique_program_id": self.unique_program_id,
295
- }
296
- for k, v in si_attrs.items():
297
- if v is None:
298
- red(f"SpliceInsert.{k} needs to be set")
299
- si = Node("SpliceInsert", attrs=si_attrs, ns=ns)
300
- if self.pts_time:
301
- prgm = Node("Program", ns=ns)
302
- st = Node(
303
- "SpliceTime", attrs={"ptsTime": self.as_ticks(self.pts_time)}, ns=ns
304
- )
305
- prgm.add_child(st)
306
- si.add_child(prgm)
307
- if self.break_duration:
308
- bd_attrs = {
309
- "auto_return": self.break_auto_return,
310
- "duration": self.as_ticks(self.break_duration),
311
- }
312
- bd = Node("BreakDuration", attrs=bd_attrs, ns=ns)
313
- si.add_child(bd)
314
- return si
315
-
316
246
 
317
247
  # table 7
318
248
  command_map = {
@@ -11,7 +11,6 @@ from .section import SpliceInfoSection
11
11
  from .commands import command_map, SpliceCommand
12
12
  from .descriptors import splice_descriptor, descriptor_map
13
13
  from .crc import crc32
14
- from .xml import Node
15
14
  from .segmentation import table22
16
15
  from .words import (
17
16
  minusone,
@@ -26,7 +25,6 @@ from .words import (
26
25
  sixteen,
27
26
  equalsign,
28
27
  )
29
- from .x2c import xml2cue
30
28
 
31
29
 
32
30
  class Cue(SCTE35Base):
@@ -41,7 +39,7 @@ class Cue(SCTE35Base):
41
39
  >>>> cue.show()
42
40
 
43
41
  * A cue instance can be initialized with
44
- Base64, Bytes, Hex, Int, Json, Xml, or Xml+binary data.
42
+ Base64, Bytes, Hex, Int, Json, or Xml+binary data.
45
43
 
46
44
  * Instance variables can be accessed via dot notation.
47
45
 
@@ -214,9 +212,6 @@ class Cue(SCTE35Base):
214
212
  if isinstance(data, dict):
215
213
  self.load(data)
216
214
  return self.bites
217
- if isinstance(data, Node):
218
- self.load(data.mk())
219
- return self.bites
220
215
  if isinstance(data, bytes):
221
216
  data = self._pkt_bits(data)
222
217
  bites = self.idxsplit(data, b"\xfc")
@@ -226,9 +221,6 @@ class Cue(SCTE35Base):
226
221
  if isinstance(data, str):
227
222
  return self._str_bits(data)
228
223
 
229
- # self.bites = bites
230
- # return bites
231
-
232
224
  def _mk_descriptors(self, bites):
233
225
  """
234
226
  Cue._mk_descriptors parses
@@ -442,51 +434,25 @@ class Cue(SCTE35Base):
442
434
  _from_xml converts xml to data that can
443
435
  be loaded by a Cue instance.
444
436
  """
445
- dat = xml2cue(gonzo)
437
+
446
438
  if isinstance(
447
- dat, str
439
+ gonzo, bytes
448
440
  ): # a string is returned for Binary xml tag, make sense?
449
- self.bites = self._mk_bits(dat)
450
- self.decode()
441
+ if '<scte35:Binary>' in gonzo:
442
+ dat = gonzo.split('<scte35:Binary>')[1].split('</scte35:Binary>')[0]
443
+ self.bites = self._mk_bits(dat)
444
+ self.decode()
451
445
  else:
452
- self.load(dat) # a dict is returned for infosection xml.
453
- # Self.encode() will calculate lengths and types and such
454
- # self.encode()
455
-
456
- def _xml_mk_descriptor(self, sis, ns):
457
- """
458
- _mk_descriptor_xml make xml nodes for descriptors.
459
- """
460
- for d in self.descriptors:
461
- if d.has("segmentation_type_id"):
462
- if d.segmentation_type_id in table22:
463
- comment = f"{table22[d.segmentation_type_id]}"
464
- sis.add_comment(comment)
465
- else:
466
- red("Segmentation type id not in table 22")
467
- sis.add_child(d.xml(ns=ns))
468
- return sis
469
-
470
- def xml(self, ns="scte35"):
471
- """
472
- xml returns a threefive3.Node instance
473
- which can be edited as needed or printed.
474
- """
475
- sis = self.info_section.xml(ns=ns)
476
- cmd = self.command.xml(ns=ns)
477
- sis.add_child(cmd)
478
- sis = self._xml_mk_descriptor(sis, ns)
479
- sis.mk()
480
- return sis
446
+ blue('Only xml+binary format supported ')
447
+
481
448
 
482
449
  def xmlbin(self, ns="scte35"):
483
450
  """
484
451
  xml returns a threefive3.Node instance
485
452
  which can be edited as needed or printed.
486
453
  xmlbin
454
+
487
455
  """
488
- sig_attrs = {"xmlns": "https://scte.org/schemas/35"}
489
- sig_node = Node("Signal", attrs=sig_attrs, ns=ns)
490
- bin_node = Node("Binary", value=self.encode(), ns=ns)
491
- sig_node.add_child(bin_node)
492
- return sig_node
456
+ return f'''<scte35:Signal xmlns:scte35="https://scte.org/schemas/35">
457
+ <scte35:Binary>{self.base64()}</scte35:Binary>
458
+ </scte35:Signal>'''