threefive3 3.0.3__tar.gz → 3.0.7__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 (38) hide show
  1. threefive3-3.0.7/LICENSE +24 -0
  2. threefive3-3.0.7/PKG-INFO +220 -0
  3. threefive3-3.0.7/README.md +196 -0
  4. {threefive3-3.0.3 → threefive3-3.0.7}/bin/threefive3 +12 -7
  5. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/base.py +8 -0
  6. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/cue.py +27 -26
  7. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/hls.py +148 -84
  8. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/iframes.py +32 -13
  9. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/sixfix.py +42 -30
  10. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/stream.py +106 -70
  11. threefive3-3.0.7/threefive3/sxp.py +81 -0
  12. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/upids.py +5 -10
  13. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/version.py +1 -1
  14. threefive3-3.0.7/threefive3/x2c.py +253 -0
  15. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/xml.py +1 -1
  16. threefive3-3.0.7/threefive3.egg-info/PKG-INFO +220 -0
  17. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3.egg-info/SOURCES.txt +2 -0
  18. threefive3-3.0.3/PKG-INFO +0 -250
  19. threefive3-3.0.3/README.md +0 -228
  20. threefive3-3.0.3/threefive3/sxp.py +0 -350
  21. threefive3-3.0.3/threefive3.egg-info/PKG-INFO +0 -250
  22. {threefive3-3.0.3 → threefive3-3.0.7}/setup.cfg +0 -0
  23. {threefive3-3.0.3 → threefive3-3.0.7}/setup.py +0 -0
  24. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/__init__.py +0 -0
  25. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/bitn.py +0 -0
  26. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/commands.py +0 -0
  27. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/crc.py +0 -0
  28. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/descriptors.py +0 -0
  29. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/new_reader.py +0 -0
  30. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/packetdata.py +0 -0
  31. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/section.py +0 -0
  32. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/segment.py +0 -0
  33. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/segmentation.py +0 -0
  34. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/spare.py +0 -0
  35. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3/streamtypes.py +0 -0
  36. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3.egg-info/dependency_links.txt +0 -0
  37. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3.egg-info/requires.txt +1 -1
  38. {threefive3-3.0.3 → threefive3-3.0.7}/threefive3.egg-info/top_level.txt +0 -0
@@ -0,0 +1,24 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2024, Adrian of Doom
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.1
2
+ Name: threefive3
3
+ Version: 3.0.7
4
+ Summary: threefive continued.
5
+ Home-page: https://github.com/superkabuki/scte35
6
+ Author: Adrian of Doom
7
+ Author-email: spam@iodisco.com
8
+ Classifier: License :: OSI Approved :: Sleepycat License
9
+ Classifier: Environment :: Console
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Operating System :: POSIX :: BSD :: OpenBSD
12
+ Classifier: Operating System :: POSIX :: BSD :: NetBSD
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Topic :: Multimedia :: Video
15
+ Classifier: Programming Language :: Python :: 3.6
16
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
17
+ Classifier: Programming Language :: Python :: Implementation :: CPython
18
+ Requires-Python: >=3.6
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: m3ufu>=0.0.89
22
+ Requires-Dist: sideways>=0.0.23
23
+ Requires-Dist: pyaes
24
+
25
+ ![image](https://github.com/user-attachments/assets/adae03a1-9f85-403e-9dce-d134e0996903)
26
+
27
+
28
+
29
+ > I wrote threefive because I couldn't find any SCTE-35 tools. There were a few libraries, but SCTE-35 wasn't their focus,
30
+ > and they required writing several hundred lines of code to do anything. I think a library should save you time.
31
+ # Why threefive3, why not just threefive?
32
+ * __Answer #1__ <s>Github F2A'ed out of my account, and I have no idea where I put the recovery codes. I have more than one Internet account, where I am supposed to keep all this data? Should I store in some company's cloud so they can read it or give it away to Eastern European script kiddies? F2A is complete nonsense. It doesn't matter how secure it is, if a security measure prevents me from accessing my account, that's not secure, that's locked out.</s>
33
+ * __Answer #2__ <s> Two repos with the same name, would be confusing. </s>
34
+ * __Answer #3__ <s>I wanted to rethink everything. After going through the code, I kept about 75% of it. I completely rewrote the Xml parser,I did a lot of work with the Cue class, HLS, and really tuned up the cli. The cli is amazing and super easy to use.</s>
35
+ * __Answer #4__ I came up with a really cool name, but it wasn't available on pypi.org for a package name.
36
+ * __Answer #5__ <s>Really, I was just getting a little bored with the whole thing, I just wanted to shake things up a little, keep it fun.</s>
37
+ * __Answer #6__ <s>Have you seen chewy Tic Tacs? They're just mini jelly beans.</s>
38
+ * __Answer #7__ I'll tell you the truth, everything is a lie.
39
+ * __Answer #8__ <s>Obama is a lizard. I'm not sure about his wife.</s>
40
+
41
+ # How do I upgrade my code to threefive3?
42
+ > Despite making a lot of changes, the api remains. threefive3 is pretty much a drop in replacement for threefive. I used sed to upgrade my code.
43
+ ```js
44
+ sed -e 's/threefive/threefive3/g'
45
+ ```
46
+ > One thing to note, calling load or decode is no longer necessary for the Cue class, however, the methods are there in case you do call them.
47
+ >
48
+ >
49
+ # Is threefive3 faster than threefive?
50
+ ### `threefive` vs. `threefive3` vs. `threefive3 next release`
51
+ #
52
+ ![image](https://github.com/user-attachments/assets/c3b8f741-01f4-40c1-b980-5c9df40c288c)
53
+
54
+
55
+
56
+
57
+ * _testing was done on a beatup chrome book reporting 5GB of RAM running Debian Sid and PyPy 7.3.11_
58
+
59
+ ---
60
+
61
+ # Now with Super Advanced Error Detection and Stuff.
62
+ * This is super cool.
63
+ * Does not generate Fatal errors, it won't break your process.
64
+ * Displays what is in error and how to correct it.
65
+ * Works in the cli
66
+ * Works in code.
67
+ ![image](https://github.com/user-attachments/assets/50331e73-cd0a-46d6-b265-1b212d625737)
68
+
69
+
70
+ # Issues and Bugs.
71
+ * If you think you have a bug, I'll quickly fix it, but first I need you to prove it to me. Show me the entire error message, the code you're running, and the SCTE-35.
72
+ ---
73
+ # Special Requests
74
+ * If need some work done, this is what I do for a living, you can hire me.
75
+ * If you want to discuss your project open an issue and I'll send you my contact info.
76
+ ---
77
+
78
+ # `Install`
79
+ * python3 via pip
80
+ ```rebol
81
+ python3 -mpip install threefive3
82
+ ```
83
+ * pypy3
84
+ ```rebol
85
+ pypy3 -mpip install threefive3
86
+ ```
87
+ * from the git repo
88
+ ```rebol
89
+ git clone https://github.com/superkabuki/scte35.git
90
+ cd scte35
91
+ make install
92
+ ```
93
+ ___
94
+
95
+ # `The Cli tool`
96
+ > The cli audetects data being available on stdin and that allows it to autodetect the SCTE-35 format as well as MPEGTS steams. Now every SCTE-35 data format, except hls, is autodetected on the commandline, as well as stdin.HLS requires the `hls` ketyword.
97
+
98
+ ### The cli tool installs automatically with pip or the Makefile.
99
+
100
+
101
+ * [__SCTE-35 Inputs__](#inputs)
102
+ * [__SCTE-35 Outputs__](#outputs)
103
+ * [Parse __MPEGTS__ streams for __SCTE-35__](#streams)
104
+ * [Parse __SCTE-35__ in __hls__](#hls)
105
+ * [Display __MPEGTS__ __iframes__](#iframes)
106
+ * [Display raw __SCTE-35 packets__ from __video streams__](#packets)
107
+ * [__Repair SCTE-35 streams__ changed to __bin data__ by __ffmpeg__](#sixfix)
108
+
109
+
110
+ # `Inputs`
111
+
112
+ * Most __inputs__ are __auto-detected.__
113
+ * __stdin__ is __auto selected__ and __auto detected.__
114
+ * __SCTE-35 data is printed to stderr__
115
+ * __stdout is used when piping video__
116
+
117
+ | Input Type | Cli Example |
118
+ |------------|-------------------------------------------------------------------------------------------------------------|
119
+ | __Base64__ | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU='`
120
+ | __Hex__ |`threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b`|
121
+ | __HLS__ |`threefive3 hls https://example.com/master.m3u8` |
122
+ | __JSON__ |`threefive3 < json.json` |
123
+ | __Xml__ | `threefive3 < xml.xml` |
124
+ | __Xmlbin__ | `threefive3 < xmlbin.xml` |
125
+
126
+ # Streams
127
+
128
+ |Protocol | Cli Example |
129
+ |---------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
130
+ | File | `threefive3 video.ts` |
131
+ | Http(s) | `threefive3 https://example.com/video.ts` |
132
+ | Stdin | `threefive3 < video.ts` |
133
+ | UDP Multicast| `threefive3 udp://@235.35.3.5:9999` |
134
+ | UDP Unicast | `threefive3 udp://10.0.0.7:5555` |
135
+ | HLS | `threefive3 hls https://example.com/master.m3u8`|
136
+ | | |
137
+
138
+
139
+ ### Outputs
140
+ * output type is determined by the key words __base64, bytes, hex, int, json, xml, and xmlbin__.
141
+ * __json is the default__.
142
+ * __Any input (except HLS,) can be returned as any output__
143
+ * examples __Base64 to Hex__, or __Mpegts to Xml__, etc...)
144
+
145
+
146
+ | Output Type | Cli Example |
147
+ |-------------|----------------------------------------------------------|
148
+ |__Base 64__ | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b base64 ` |
149
+ | __Bytes__ | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b bytes` |
150
+ | Hex | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' hex` |
151
+ | Integer | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' int` |
152
+ | JSON | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b json ` |
153
+ | Xml | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' xml ` ` |
154
+ | Xml+bin | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b xmlbin ` |`
155
+
156
+ ### `hls`
157
+ * parse hls manifests and segments for SCTE-35
158
+ ```rebol
159
+ threefive3 hls https://example.com/master.m3u8
160
+ ```
161
+ ___
162
+ ### `Iframes`
163
+ * Show iframes PTS in an MPEGTS video
164
+ ```rebol
165
+ threefive3 iframes https://example.com/video.ts
166
+ ```
167
+ ___
168
+ ### `packets`
169
+ * Print raw SCTE-35 packets from multicast mpegts video
170
+ ```rebol
171
+ threefive3 packets udp://@235.35.3.5:3535
172
+ ```
173
+ ___
174
+ ### `proxy`
175
+ * Parse a https stream and write raw video to stdout
176
+ ```rebol
177
+ threefive3 proxy video.ts
178
+ ```
179
+ ___
180
+ ### `pts`
181
+ * Print PTS from mpegts video
182
+ ```rebol
183
+ threefive3 pts video.ts
184
+ ```
185
+ ___
186
+ ### `sidecar`
187
+ * Parse a stream, write pts,write SCTE-35 Cues to sidecar.txt
188
+ ```rebol
189
+ threefive3 sidecar video.ts
190
+ ```
191
+ ___
192
+ ### `sixfix`
193
+ * Fix SCTE-35 data mangled by ffmpeg
194
+ ```rebol
195
+ threefive3 sixfix video.ts
196
+ ```
197
+ ___
198
+ ### `show`
199
+
200
+ * Probe mpegts video _( kind of like ffprobe )_
201
+ ```rebol
202
+ threefive3 show video.ts
203
+ ```
204
+ ___
205
+ ### `version`
206
+ * Show version
207
+ ```rebol
208
+ threefive3 version
209
+ ```
210
+ ___
211
+ ### `help`
212
+ * Help
213
+ ```rebol
214
+ threefive3 help
215
+ ```
216
+ ## [iodisco.com/scte35](https://iodisco.com/scte35)
217
+ [![image](https://github.com/user-attachments/assets/28d228c5-56e2-41d3-a053-eebd3af958f1)
218
+ ![image](https://github.com/user-attachments/assets/07c52c21-e83e-438d-91b0-6f502f0d1d43)](https://iodisco.com/scte35)
219
+ ___
220
+
@@ -0,0 +1,196 @@
1
+ ![image](https://github.com/user-attachments/assets/adae03a1-9f85-403e-9dce-d134e0996903)
2
+
3
+
4
+
5
+ > I wrote threefive because I couldn't find any SCTE-35 tools. There were a few libraries, but SCTE-35 wasn't their focus,
6
+ > and they required writing several hundred lines of code to do anything. I think a library should save you time.
7
+ # Why threefive3, why not just threefive?
8
+ * __Answer #1__ <s>Github F2A'ed out of my account, and I have no idea where I put the recovery codes. I have more than one Internet account, where I am supposed to keep all this data? Should I store in some company's cloud so they can read it or give it away to Eastern European script kiddies? F2A is complete nonsense. It doesn't matter how secure it is, if a security measure prevents me from accessing my account, that's not secure, that's locked out.</s>
9
+ * __Answer #2__ <s> Two repos with the same name, would be confusing. </s>
10
+ * __Answer #3__ <s>I wanted to rethink everything. After going through the code, I kept about 75% of it. I completely rewrote the Xml parser,I did a lot of work with the Cue class, HLS, and really tuned up the cli. The cli is amazing and super easy to use.</s>
11
+ * __Answer #4__ I came up with a really cool name, but it wasn't available on pypi.org for a package name.
12
+ * __Answer #5__ <s>Really, I was just getting a little bored with the whole thing, I just wanted to shake things up a little, keep it fun.</s>
13
+ * __Answer #6__ <s>Have you seen chewy Tic Tacs? They're just mini jelly beans.</s>
14
+ * __Answer #7__ I'll tell you the truth, everything is a lie.
15
+ * __Answer #8__ <s>Obama is a lizard. I'm not sure about his wife.</s>
16
+
17
+ # How do I upgrade my code to threefive3?
18
+ > Despite making a lot of changes, the api remains. threefive3 is pretty much a drop in replacement for threefive. I used sed to upgrade my code.
19
+ ```js
20
+ sed -e 's/threefive/threefive3/g'
21
+ ```
22
+ > One thing to note, calling load or decode is no longer necessary for the Cue class, however, the methods are there in case you do call them.
23
+ >
24
+ >
25
+ # Is threefive3 faster than threefive?
26
+ ### `threefive` vs. `threefive3` vs. `threefive3 next release`
27
+ #
28
+ ![image](https://github.com/user-attachments/assets/c3b8f741-01f4-40c1-b980-5c9df40c288c)
29
+
30
+
31
+
32
+
33
+ * _testing was done on a beatup chrome book reporting 5GB of RAM running Debian Sid and PyPy 7.3.11_
34
+
35
+ ---
36
+
37
+ # Now with Super Advanced Error Detection and Stuff.
38
+ * This is super cool.
39
+ * Does not generate Fatal errors, it won't break your process.
40
+ * Displays what is in error and how to correct it.
41
+ * Works in the cli
42
+ * Works in code.
43
+ ![image](https://github.com/user-attachments/assets/50331e73-cd0a-46d6-b265-1b212d625737)
44
+
45
+
46
+ # Issues and Bugs.
47
+ * If you think you have a bug, I'll quickly fix it, but first I need you to prove it to me. Show me the entire error message, the code you're running, and the SCTE-35.
48
+ ---
49
+ # Special Requests
50
+ * If need some work done, this is what I do for a living, you can hire me.
51
+ * If you want to discuss your project open an issue and I'll send you my contact info.
52
+ ---
53
+
54
+ # `Install`
55
+ * python3 via pip
56
+ ```rebol
57
+ python3 -mpip install threefive3
58
+ ```
59
+ * pypy3
60
+ ```rebol
61
+ pypy3 -mpip install threefive3
62
+ ```
63
+ * from the git repo
64
+ ```rebol
65
+ git clone https://github.com/superkabuki/scte35.git
66
+ cd scte35
67
+ make install
68
+ ```
69
+ ___
70
+
71
+ # `The Cli tool`
72
+ > The cli audetects data being available on stdin and that allows it to autodetect the SCTE-35 format as well as MPEGTS steams. Now every SCTE-35 data format, except hls, is autodetected on the commandline, as well as stdin.HLS requires the `hls` ketyword.
73
+
74
+ ### The cli tool installs automatically with pip or the Makefile.
75
+
76
+
77
+ * [__SCTE-35 Inputs__](#inputs)
78
+ * [__SCTE-35 Outputs__](#outputs)
79
+ * [Parse __MPEGTS__ streams for __SCTE-35__](#streams)
80
+ * [Parse __SCTE-35__ in __hls__](#hls)
81
+ * [Display __MPEGTS__ __iframes__](#iframes)
82
+ * [Display raw __SCTE-35 packets__ from __video streams__](#packets)
83
+ * [__Repair SCTE-35 streams__ changed to __bin data__ by __ffmpeg__](#sixfix)
84
+
85
+
86
+ # `Inputs`
87
+
88
+ * Most __inputs__ are __auto-detected.__
89
+ * __stdin__ is __auto selected__ and __auto detected.__
90
+ * __SCTE-35 data is printed to stderr__
91
+ * __stdout is used when piping video__
92
+
93
+ | Input Type | Cli Example |
94
+ |------------|-------------------------------------------------------------------------------------------------------------|
95
+ | __Base64__ | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU='`
96
+ | __Hex__ |`threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b`|
97
+ | __HLS__ |`threefive3 hls https://example.com/master.m3u8` |
98
+ | __JSON__ |`threefive3 < json.json` |
99
+ | __Xml__ | `threefive3 < xml.xml` |
100
+ | __Xmlbin__ | `threefive3 < xmlbin.xml` |
101
+
102
+ # Streams
103
+
104
+ |Protocol | Cli Example |
105
+ |---------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
106
+ | File | `threefive3 video.ts` |
107
+ | Http(s) | `threefive3 https://example.com/video.ts` |
108
+ | Stdin | `threefive3 < video.ts` |
109
+ | UDP Multicast| `threefive3 udp://@235.35.3.5:9999` |
110
+ | UDP Unicast | `threefive3 udp://10.0.0.7:5555` |
111
+ | HLS | `threefive3 hls https://example.com/master.m3u8`|
112
+ | | |
113
+
114
+
115
+ ### Outputs
116
+ * output type is determined by the key words __base64, bytes, hex, int, json, xml, and xmlbin__.
117
+ * __json is the default__.
118
+ * __Any input (except HLS,) can be returned as any output__
119
+ * examples __Base64 to Hex__, or __Mpegts to Xml__, etc...)
120
+
121
+
122
+ | Output Type | Cli Example |
123
+ |-------------|----------------------------------------------------------|
124
+ |__Base 64__ | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b base64 ` |
125
+ | __Bytes__ | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b bytes` |
126
+ | Hex | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' hex` |
127
+ | Integer | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' int` |
128
+ | JSON | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b json ` |
129
+ | Xml | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' xml ` ` |
130
+ | Xml+bin | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b xmlbin ` |`
131
+
132
+ ### `hls`
133
+ * parse hls manifests and segments for SCTE-35
134
+ ```rebol
135
+ threefive3 hls https://example.com/master.m3u8
136
+ ```
137
+ ___
138
+ ### `Iframes`
139
+ * Show iframes PTS in an MPEGTS video
140
+ ```rebol
141
+ threefive3 iframes https://example.com/video.ts
142
+ ```
143
+ ___
144
+ ### `packets`
145
+ * Print raw SCTE-35 packets from multicast mpegts video
146
+ ```rebol
147
+ threefive3 packets udp://@235.35.3.5:3535
148
+ ```
149
+ ___
150
+ ### `proxy`
151
+ * Parse a https stream and write raw video to stdout
152
+ ```rebol
153
+ threefive3 proxy video.ts
154
+ ```
155
+ ___
156
+ ### `pts`
157
+ * Print PTS from mpegts video
158
+ ```rebol
159
+ threefive3 pts video.ts
160
+ ```
161
+ ___
162
+ ### `sidecar`
163
+ * Parse a stream, write pts,write SCTE-35 Cues to sidecar.txt
164
+ ```rebol
165
+ threefive3 sidecar video.ts
166
+ ```
167
+ ___
168
+ ### `sixfix`
169
+ * Fix SCTE-35 data mangled by ffmpeg
170
+ ```rebol
171
+ threefive3 sixfix video.ts
172
+ ```
173
+ ___
174
+ ### `show`
175
+
176
+ * Probe mpegts video _( kind of like ffprobe )_
177
+ ```rebol
178
+ threefive3 show video.ts
179
+ ```
180
+ ___
181
+ ### `version`
182
+ * Show version
183
+ ```rebol
184
+ threefive3 version
185
+ ```
186
+ ___
187
+ ### `help`
188
+ * Help
189
+ ```rebol
190
+ threefive3 help
191
+ ```
192
+ ## [iodisco.com/scte35](https://iodisco.com/scte35)
193
+ [![image](https://github.com/user-attachments/assets/28d228c5-56e2-41d3-a053-eebd3af958f1)
194
+ ![image](https://github.com/user-attachments/assets/07c52c21-e83e-438d-91b0-6f502f0d1d43)](https://iodisco.com/scte35)
195
+ ___
196
+
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env python3
1
+ #!/usr/bin/pypy3
2
2
 
3
3
  """
4
4
  scte35 command line SCTE35 decoder.
@@ -13,7 +13,8 @@ from threefive3.new_reader import reader
13
13
  from threefive3 import Cue, Stream, print2, version
14
14
  from threefive3.hls import cli as hlscli
15
15
  from threefive3.sixfix import sixfix
16
- from sideways import cli as sidecli
16
+
17
+ # from sideways import cli as sidecli
17
18
 
18
19
  REV = "\033[7;1m"
19
20
  NORM = "\033[27m\033[0m"
@@ -308,6 +309,7 @@ def to_funk(this):
308
309
  """
309
310
  to_funk prints a cue in a variety of formats.
310
311
  """
312
+ cue = None
311
313
  if this in ["", b""]:
312
314
  return
313
315
  try:
@@ -319,8 +321,9 @@ def to_funk(this):
319
321
  cue = Cue(this)
320
322
  except:
321
323
  print2("Bad Data")
322
- if cue:
323
- funk()(cue) # func works here too.
324
+ sys.exit()
325
+ if cue:
326
+ funk()(cue) # func works here too.
324
327
 
325
328
 
326
329
  def chk_stdin(args):
@@ -335,9 +338,11 @@ def chk_stdin(args):
335
338
  two = reader(sys.stdin.buffer).read()
336
339
  args.append((one + two).decode()) # no rewind on stdin
337
340
  else:
338
- reader(sys.stdin.buffer).read(187) # drop first packet
339
- Stream(sys.stdin.buffer).decode(func=funk())
340
- sys.exit()
341
+ two = reader(sys.stdin.buffer).read(187)
342
+ strm = Stream(sys.stdin.buffer)
343
+ strm._parse(one + two) # dont drop first packet
344
+ strm.decode(func=funk())
345
+ sys.exit() # I keep forgetting why I do
341
346
  return args
342
347
 
343
348
 
@@ -105,6 +105,14 @@ class SCTE35Base:
105
105
  return True
106
106
  return False
107
107
 
108
+ def hasis(self, what):
109
+ """
110
+ hasis obj "has" a what and what "is" returned.
111
+ """
112
+ if self.has(what):
113
+ return vars(self)[what]
114
+ return None
115
+
108
116
  @staticmethod
109
117
  def idxsplit(gonzo, sep):
110
118
  """
@@ -13,25 +13,24 @@ from .descriptors import splice_descriptor, descriptor_map
13
13
  from .crc import crc32
14
14
  from .xml import Node
15
15
  from .segmentation import table22
16
- from .sxp import SuperXmlParser
16
+ from .x2c import xml2cue
17
17
 
18
18
 
19
19
  class Cue(SCTE35Base):
20
20
  """
21
- The threefive3.Splice class handles parsing
21
+ The threefive3.Cue class handles parsing
22
22
  SCTE 35 message strings.
23
23
  Example usage:
24
24
 
25
- >>>> import fu
25
+ >>>> import threefive3
26
26
  >>>> Base64 = "/DAvAAAAAAAA///wBQb+dGKQoAAZAhdDVUVJSAAAjn+fCAgAAAAALKChijUCAKnMZ1g="
27
27
  >>>> cue = threefive3.Cue(Base64)
28
+ >>>> cue.show()
28
29
 
29
- # cue.decode() returns True on success,or False if decoding failed
30
+ * A cue instance can be initialized with
31
+ Base64, Bytes, Hex, Int, Json, Xml, or Xml+binary data.
30
32
 
31
- >>>> cue.decode()
32
- True
33
-
34
- # After Calling cue.decode() the instance variables can be accessed via dot notation.
33
+ * Instance variables can be accessed via dot notation.
35
34
 
36
35
  >>>> cue.command
37
36
  {'command_length': 5, 'name': 'Time Signal', 'time_specified_flag': True,
@@ -40,9 +39,6 @@ class Cue(SCTE35Base):
40
39
  >>>> cue.command.pts_time
41
40
  21695.740089
42
41
 
43
- >>>> cue.info_section.table_id
44
-
45
- '0xfc'
46
42
 
47
43
  """
48
44
 
@@ -63,11 +59,12 @@ class Cue(SCTE35Base):
63
59
  def __repr__(self):
64
60
  return str(self.__dict__)
65
61
 
66
- # decode
67
-
68
62
  def decode(self):
69
63
  """
70
64
  Cue.decode() parses for SCTE35 data
65
+
66
+ * decode doesn't need to be called directly
67
+ unless you initialize a Cue without data.
71
68
  """
72
69
  bites = self.bites
73
70
  self.descriptors = []
@@ -213,13 +210,14 @@ class Cue(SCTE35Base):
213
210
  Cue.info_section.descriptor_loop_length,
214
211
  then call Cue._descriptor_loop
215
212
  """
216
- if len(bites) < 2:
217
- return False
218
- dll = (bites[0] << 8) | bites[1]
219
- self.info_section.descriptor_loop_length = dll
220
- bites = bites[2:]
221
- self._descriptor_loop(bites[:dll])
222
- return bites[dll:]
213
+ ## if len(bites) < 2:
214
+ ## return False
215
+ while bites:
216
+ dll = (bites[0] << 8) | bites[1]
217
+ self.info_section.descriptor_loop_length = dll
218
+ bites = bites[2:]
219
+ self._descriptor_loop(bites[:dll])
220
+ return bites[dll:]
223
221
 
224
222
  def mk_info_section(self, bites):
225
223
  """
@@ -379,6 +377,10 @@ class Cue(SCTE35Base):
379
377
  'command': {dict},
380
378
  'descriptors': [list of {dicts}],
381
379
  }
380
+
381
+ * load doesn't need to be called directly
382
+ unless you initialize a Cue without data.
383
+
382
384
  """
383
385
  if isinstance(gonzo, bytes):
384
386
  gonzo = gonzo.decode()
@@ -389,7 +391,7 @@ class Cue(SCTE35Base):
389
391
  self.decode()
390
392
  return self.bites
391
393
  if gonzo.strip()[0] == "<":
392
- self.from_xml(gonzo)
394
+ self._from_xml(gonzo)
393
395
  return self.bites
394
396
  gonzo = json.loads(gonzo)
395
397
  if "command" not in gonzo:
@@ -400,13 +402,12 @@ class Cue(SCTE35Base):
400
402
  self.encode()
401
403
  return self.bites
402
404
 
403
- def from_xml(self, gonzo):
405
+ def _from_xml(self, gonzo):
404
406
  """
405
- build_cue takes the data put into the gonzo dict
406
- and builds a threefive3.Cue instance
407
+ _from_xml converts xml to data that can
408
+ be loaded by a Cue instance.
407
409
  """
408
- sxp = SuperXmlParser()
409
- dat = sxp.xml2cue(gonzo)
410
+ dat = xml2cue(gonzo)
410
411
  if isinstance(
411
412
  dat, str
412
413
  ): # a string is returned for Binary xml tag, make sense?