threefive3 3.0.16__tar.gz → 3.0.19__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 (37) hide show
  1. {threefive3-3.0.16/threefive3.egg-info → threefive3-3.0.19}/PKG-INFO +43 -14
  2. {threefive3-3.0.16 → threefive3-3.0.19}/README.md +42 -13
  3. {threefive3-3.0.16 → threefive3-3.0.19}/bin/threefive3 +4 -2
  4. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/__init__.py +5 -4
  5. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/base.py +13 -4
  6. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/bitn.py +7 -3
  7. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/cue.py +27 -25
  8. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/descriptors.py +3 -1
  9. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/hls.py +64 -86
  10. threefive3-3.0.19/threefive3/hlstags.py +171 -0
  11. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/iframes.py +1 -1
  12. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/section.py +3 -3
  13. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/sixfix.py +15 -11
  14. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/stream.py +22 -18
  15. threefive3-3.0.19/threefive3/stuff.py +47 -0
  16. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/upids.py +4 -3
  17. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/version.py +1 -1
  18. {threefive3-3.0.16 → threefive3-3.0.19/threefive3.egg-info}/PKG-INFO +43 -14
  19. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3.egg-info/SOURCES.txt +2 -2
  20. threefive3-3.0.16/threefive3/m3ufu.py +0 -663
  21. threefive3-3.0.16/threefive3/spare.py +0 -12
  22. {threefive3-3.0.16 → threefive3-3.0.19}/LICENSE +0 -0
  23. {threefive3-3.0.16 → threefive3-3.0.19}/setup.cfg +0 -0
  24. {threefive3-3.0.16 → threefive3-3.0.19}/setup.py +0 -0
  25. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/commands.py +0 -0
  26. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/crc.py +0 -0
  27. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/new_reader.py +0 -0
  28. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/packetdata.py +0 -0
  29. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/segment.py +0 -0
  30. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/segmentation.py +0 -0
  31. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/streamtypes.py +0 -0
  32. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/sxp.py +0 -0
  33. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/x2c.py +0 -0
  34. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3/xml.py +0 -0
  35. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3.egg-info/dependency_links.txt +0 -0
  36. {threefive3-3.0.16 → threefive3-3.0.19}/threefive3.egg-info/requires.txt +0 -0
  37. {threefive3-3.0.16 → threefive3-3.0.19}/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.16
3
+ Version: 3.0.19
4
4
  Summary: threefive continued.
5
5
  Home-page: https://github.com/superkabuki/scte35
6
6
  Author: Adrian of Doom
@@ -19,16 +19,47 @@ Requires-Python: >=3.6
19
19
  Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
21
 
22
- # threefive3 SCTE-35 cli tool and python3 library.
22
+
23
+ # threefive3 SCTE-35 cli super tool and python3 library.
23
24
 
24
25
  ✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml ✅ SCTE-35 Cli ✅ SCTE-35 library
25
26
 
26
27
 
27
- * Parses SCTE-35 from MPEGTS, HLS, XML, XML+Binary, Base64, Bytes, Hex, and Integers.
28
- * Built-in network support for http(s), UDP, and Multicast.
28
+ * Parses SCTE-35 from MPEGTS, HLS, XML, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
29
+ * Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON, Xml, or Xml+binary.
30
+ * Built-in network support for HTTP(S), UDP, and Multicast.
29
31
  * Automatic AES decryption for HLS.
30
- * All HLS SCTE-35 Tags are Supported
32
+ * All HLS SCTE-35 Tags are Supported.
33
+ ___
34
+ # Latest release is v3.0.19
35
+ > Stay up to date, only the latest release is supported.
31
36
  ___
37
+ ### MPEGTS streams can be parsed for SCTE-35 with three lines of code.
38
+
39
+ ```py3
40
+ a@fu:~/build5/scte35/scte35$ pypy3
41
+ Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
42
+ [PyPy 7.3.11 with GCC 12.2.0] on linux
43
+ Type "help", "copyright", "credits" or "license" for more information.
44
+
45
+ >>>> from threefive3 import Stream
46
+
47
+ >>>> strm=Stream('https://futzu.com/xaa.ts')
48
+
49
+ >>>> strm.decode()
50
+ ```
51
+ # Heads Up!
52
+
53
+ > threefive3 is a lot to do by myself, in my spare time. I'm going to impose on y'all a little.
54
+
55
+ > I am currently working on error reporting. I am trying to aggregate the errors into each object, so if you have multiple errors, you can get them all at once, rather than one at a time. I need to try some stuff so I can see how it works and how it fails.
56
+ > If I have to do this alone, it will take much longer than if y'all help me.
57
+ > I will probably push a couple releases this week, I need you to use then.
58
+ > Be a good citizen and get involved. That's what makes open source work.
59
+
60
+
61
+ # Documentation
62
+
32
63
  * [Install](#install)
33
64
  * [SCTE-35 Cli](#the-cli-tool)
34
65
  * [SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md)
@@ -38,19 +69,17 @@ ___
38
69
  * [Encode SCTE-35](https://github.com/superkabuki/threefive3/blob/main/encode.md)
39
70
  * [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
40
71
 
41
- ## MPEGTS streams can be parsed for SCTE-35 with three lines of code.
72
+ * _The cli tool comes with builtin documentation just type_ `threefive3 help`
42
73
 
43
- ```py3
44
- a@fu:~/build5/scte35/scte35$ pypy3
74
+ * _The python built in help is always the most up to date._
75
+
76
+ ```rebol
77
+ a@fu:~/build7/threefive3$ pypy3
45
78
  Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
46
79
  [PyPy 7.3.11 with GCC 12.2.0] on linux
47
80
  Type "help", "copyright", "credits" or "license" for more information.
48
-
49
81
  >>>> from threefive import Stream
50
-
51
- >>>> strm=Stream('https://futzu.com/xaa.ts')
52
-
53
- >>>> strm.decode()
82
+ >>>> help(Stream)
54
83
  ```
55
84
 
56
85
  ___
@@ -68,7 +97,7 @@ pypy3 -mpip install threefive3
68
97
  * from the git repo
69
98
  ```rebol
70
99
  git clone https://github.com/superkabuki/scte35.git
71
- cd scte35
100
+ cd threefive3
72
101
  make install
73
102
  ```
74
103
  ___
@@ -1,13 +1,44 @@
1
- # threefive3 SCTE-35 cli tool and python3 library.
1
+
2
+ # threefive3 SCTE-35 cli super tool and python3 library.
2
3
 
3
4
  ✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml ✅ SCTE-35 Cli ✅ SCTE-35 library
4
5
 
5
6
 
6
- * Parses SCTE-35 from MPEGTS, HLS, XML, XML+Binary, Base64, Bytes, Hex, and Integers.
7
- * Built-in network support for http(s), UDP, and Multicast.
7
+ * Parses SCTE-35 from MPEGTS, HLS, XML, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
8
+ * Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON, Xml, or Xml+binary.
9
+ * Built-in network support for HTTP(S), UDP, and Multicast.
8
10
  * Automatic AES decryption for HLS.
9
- * All HLS SCTE-35 Tags are Supported
11
+ * All HLS SCTE-35 Tags are Supported.
12
+ ___
13
+ # Latest release is v3.0.19
14
+ > Stay up to date, only the latest release is supported.
10
15
  ___
16
+ ### MPEGTS streams can be parsed for SCTE-35 with three lines of code.
17
+
18
+ ```py3
19
+ a@fu:~/build5/scte35/scte35$ pypy3
20
+ Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
21
+ [PyPy 7.3.11 with GCC 12.2.0] on linux
22
+ Type "help", "copyright", "credits" or "license" for more information.
23
+
24
+ >>>> from threefive3 import Stream
25
+
26
+ >>>> strm=Stream('https://futzu.com/xaa.ts')
27
+
28
+ >>>> strm.decode()
29
+ ```
30
+ # Heads Up!
31
+
32
+ > threefive3 is a lot to do by myself, in my spare time. I'm going to impose on y'all a little.
33
+
34
+ > I am currently working on error reporting. I am trying to aggregate the errors into each object, so if you have multiple errors, you can get them all at once, rather than one at a time. I need to try some stuff so I can see how it works and how it fails.
35
+ > If I have to do this alone, it will take much longer than if y'all help me.
36
+ > I will probably push a couple releases this week, I need you to use then.
37
+ > Be a good citizen and get involved. That's what makes open source work.
38
+
39
+
40
+ # Documentation
41
+
11
42
  * [Install](#install)
12
43
  * [SCTE-35 Cli](#the-cli-tool)
13
44
  * [SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md)
@@ -17,19 +48,17 @@ ___
17
48
  * [Encode SCTE-35](https://github.com/superkabuki/threefive3/blob/main/encode.md)
18
49
  * [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
19
50
 
20
- ## MPEGTS streams can be parsed for SCTE-35 with three lines of code.
51
+ * _The cli tool comes with builtin documentation just type_ `threefive3 help`
21
52
 
22
- ```py3
23
- a@fu:~/build5/scte35/scte35$ pypy3
53
+ * _The python built in help is always the most up to date._
54
+
55
+ ```rebol
56
+ a@fu:~/build7/threefive3$ pypy3
24
57
  Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
25
58
  [PyPy 7.3.11 with GCC 12.2.0] on linux
26
59
  Type "help", "copyright", "credits" or "license" for more information.
27
-
28
60
  >>>> from threefive import Stream
29
-
30
- >>>> strm=Stream('https://futzu.com/xaa.ts')
31
-
32
- >>>> strm.decode()
61
+ >>>> help(Stream)
33
62
  ```
34
63
 
35
64
  ___
@@ -47,7 +76,7 @@ pypy3 -mpip install threefive3
47
76
  * from the git repo
48
77
  ```rebol
49
78
  git clone https://github.com/superkabuki/scte35.git
50
- cd scte35
79
+ cd threefive3
51
80
  make install
52
81
  ```
53
82
  ___
@@ -318,10 +318,12 @@ def to_funk(this):
318
318
  strm = Stream(this)
319
319
  strm.decode(func=funk()) # funk() works here
320
320
  except: # try to load json or xml
321
+ cue = Cue()
321
322
  try:
322
- cue = Cue(this)
323
+ cue.bites = cue._mk_bits(this)
324
+ cue.decode()
323
325
  except:
324
- print2(f"Bad Data:\n{this}")
326
+ print2(f"Bad Data:\n{cue.errs()}")
325
327
  sys.exit()
326
328
  if cue:
327
329
  funk()(cue) # func works here too.
@@ -2,12 +2,14 @@
2
2
  scte35.__init__.py
3
3
  """
4
4
 
5
- from .spare import print2
6
5
 
7
6
  from .cue import Cue
7
+ from .hls import HlsParser
8
+ from .hlstags import TagParser
8
9
  from .section import SpliceInfoSection
9
10
  from .segment import Segment
10
11
  from .stream import Stream
12
+ from .stuff import print2, iso8601, atohif
11
13
  from .version import version
12
14
 
13
15
  from .commands import (
@@ -29,10 +31,9 @@ from .descriptors import (
29
31
  SpliceDescriptor,
30
32
  TimeDescriptor,
31
33
  descriptor_map,
32
-
33
34
  )
34
35
 
35
- from .upids import(
36
+ from .upids import (
36
37
  Upid,
37
38
  NoUpid,
38
39
  AirId,
@@ -43,4 +44,4 @@ from .upids import(
43
44
  Mpu,
44
45
  Umid,
45
46
  upid_map,
46
- )
47
+ )
@@ -5,7 +5,7 @@ the class SCTE35Base.
5
5
 
6
6
  import json
7
7
  from .bitn import NBin
8
- from .spare import print2
8
+ from .stuff import print2
9
9
  from .xml import Node
10
10
 
11
11
 
@@ -18,7 +18,7 @@ class SCTE35Base:
18
18
  ROLLOVER = 8589934591
19
19
 
20
20
  def __init__(self):
21
- self.errors=[]
21
+ self.errors = []
22
22
 
23
23
  def __repr__(self):
24
24
  return str(self.__dict__)
@@ -31,8 +31,9 @@ class SCTE35Base:
31
31
 
32
32
  def _err2(self, var_name, var_value, bit_count, var_type):
33
33
  var_type = str(var_type).split("'")[1]
34
- err_mesg = f'{var_name} is {var_value} , it should be type {var_type}, {bit_count} bit(s) long.'
34
+ err_mesg = f"{var_name} is {var_value} , it should be type {var_type}, {bit_count} bit(s) long."
35
35
  self.errors.append(err_mesg)
36
+ print2(err_mesg)
36
37
 
37
38
  def _bool_int(self, var_name, var_value, bit_count, var_type):
38
39
  if var_type == int:
@@ -146,7 +147,15 @@ class SCTE35Base:
146
147
  val = list(val)
147
148
  return val
148
149
 
149
- return {k: b2l(v) for k, v in vars(self).items() if v not in [None,[],] } # added empty list []
150
+ return {
151
+ k: b2l(v)
152
+ for k, v in vars(self).items()
153
+ if v
154
+ not in [
155
+ None,
156
+ [],
157
+ ]
158
+ } # added empty list []
150
159
 
151
160
  def _json2dict(self, gonzo):
152
161
  if isinstance(gonzo, str):
@@ -2,7 +2,7 @@
2
2
  The bitn.Bitn and bitn.NBin classes
3
3
  """
4
4
 
5
- from .spare import print2
5
+ from .stuff import print2
6
6
 
7
7
 
8
8
  class Bitn:
@@ -16,8 +16,12 @@ class Bitn:
16
16
  def __init__(self, bites):
17
17
  # self.bites = bites
18
18
  self.bitsize = self.idx = len(bites) << 3
19
- self.bits = int.from_bytes(bites, byteorder="big")
19
+ if isinstance(bites,bytes):
20
+ self.bits = int.from_bytes(bites, byteorder="big")
21
+ if isinstance(bites,int):
22
+ self.bits=bites
20
23
 
24
+
21
25
  def __repr__(self):
22
26
  return str(vars(self))
23
27
 
@@ -157,7 +161,7 @@ class NBin:
157
161
  if isinstance(hex_str, str):
158
162
  dehexed = int(hex_str, 16)
159
163
  # just in case hex_str is an int....
160
- else:
164
+ if isinstance(hex_str,int):
161
165
  dehexed = hex_str
162
166
  self.add_int(dehexed, bit_len)
163
167
 
@@ -4,7 +4,7 @@ scte35.Cue Class
4
4
 
5
5
  from base64 import b64decode, b64encode
6
6
  import json
7
- from .spare import print2
7
+ from .stuff import print2
8
8
  from .bitn import NBin
9
9
  from .base import SCTE35Base
10
10
  from .section import SpliceInfoSection
@@ -47,7 +47,7 @@ class Cue(SCTE35Base):
47
47
  data may be packet bites or encoded string
48
48
  packet_data is a instance passed from a Stream instance
49
49
  """
50
- self.errors=[]
50
+ self.errors = []
51
51
  self.command = None
52
52
  self.descriptors = []
53
53
  self.info_section = SpliceInfoSection()
@@ -65,15 +65,15 @@ class Cue(SCTE35Base):
65
65
  def errs(self):
66
66
  """
67
67
  errs show encoding errors.
68
- """
69
- e= {"cue.errors": self.errors}
68
+ """
69
+ e = {"cue.errors": self.errors}
70
70
  if self.info_section:
71
- e["info_section_errors"] = self.info_section.has("errors")
72
- if isinstance(self.command, SpliceCommand):
73
- e["command_errors"]= self.command.errors
71
+ e["info_section_errors"] = self.info_section.has("errors")
72
+ if isinstance(self.command, SpliceCommand):
73
+ e["command_errors"] = self.command.errors
74
74
  e["descriptor_errors"] = [d.errors for d in self.descriptors]
75
75
  return e
76
-
76
+
77
77
  def decode(self):
78
78
  """
79
79
  Cue.decode() parses for SCTE35 data
@@ -122,17 +122,19 @@ class Cue(SCTE35Base):
122
122
  Cue.get returns the SCTE-35 Cue
123
123
  data as a dict of dicts.
124
124
  """
125
- if self.command and self.info_section:
126
- scte35_data = {
125
+ # if self.command and self.info_section:
126
+ scte35_data = {
127
+ "errors": self.errs(),
127
128
  "info_section": self.info_section.get(),
128
129
  "command": self.command.get(),
129
130
  "descriptors": self.get_descriptors(),
130
- }
131
- scte35_data = self._get_dash_data(scte35_data)
132
- scte35_data = self._get_packet_data(scte35_data)
133
- return scte35_data
134
- self.errors.append("command or info section not found")
135
- return False
131
+ }
132
+ scte35_data = self._get_dash_data(scte35_data)
133
+ scte35_data = self._get_packet_data(scte35_data)
134
+
135
+ return scte35_data
136
+ # self.errors.append("command or info section not found")
137
+ # return False
136
138
 
137
139
  def get_descriptors(self):
138
140
  """
@@ -147,12 +149,12 @@ class Cue(SCTE35Base):
147
149
  """
148
150
  return self.bites
149
151
 
150
- def fix_bad_b64(self,data):
152
+ def fix_bad_b64(self, data):
151
153
  """
152
154
  fix_bad_b64 fixes bad padding on Base64
153
155
  """
154
- if len(data) %4!=0:
155
- self.errors.append('fixed bad base64 length ')
156
+ if len(data) % 4 != 0:
157
+ self.errors.append("fixed bad base64 length ")
156
158
  while len(data) % 4 != 0:
157
159
  data = data + "="
158
160
  return data
@@ -255,7 +257,7 @@ class Cue(SCTE35Base):
255
257
  """
256
258
  sct = self.info_section.splice_command_type
257
259
  if sct not in command_map:
258
- self.errors.append(f"Splice Command type {sct} not recognized")
260
+ self.errors.append(f"Splice Command type {sct} not recognized")
259
261
  return False
260
262
  iscl = self.info_section.splice_command_length
261
263
  cmd_bites = bites[:iscl]
@@ -269,12 +271,12 @@ class Cue(SCTE35Base):
269
271
 
270
272
  def _assemble(self):
271
273
  for d in self.descriptors:
272
- d.errors=[]
274
+ d.errors = []
273
275
  dscptr_bites = self._unloop_descriptors()
274
276
  dll = len(dscptr_bites)
275
277
  self.info_section.descriptor_loop_length = dll
276
- self.info_section.errors=[]
277
- self.command.errors=[]
278
+ self.info_section.errors = []
279
+ self.command.errors = []
278
280
  cmd_bites = self.command.encode()
279
281
  cmdl = self.command.command_length = len(cmd_bites)
280
282
  self.info_section.splice_command_length = cmdl
@@ -389,7 +391,8 @@ class Cue(SCTE35Base):
389
391
  _no_cmd raises an exception if no splice command.
390
392
  """
391
393
  self.errors.append("A splice command is required")
392
- # raise Exception("\033[7mA splice command is required\033[27m")
394
+
395
+ # raise Exception("\033[7mA splice command is required\033[27m")
393
396
 
394
397
  def load(self, gonzo):
395
398
  """
@@ -460,7 +463,6 @@ class Cue(SCTE35Base):
460
463
  """
461
464
  xml returns a threefive3.Node instance
462
465
  which can be edited as needed or printed.
463
- xmlbin
464
466
  """
465
467
  sis = self.info_section.xml(ns=ns)
466
468
  cmd = self.command.xml(ns=ns)
@@ -461,7 +461,9 @@ class SegmentationDescriptor(SpliceDescriptor):
461
461
  self._chk_var(int, nbin.add_int, "sub_segment_num", 8)
462
462
  self._chk_var(int, nbin.add_int, "sub_segments_expected", 8)
463
463
  except:
464
- self.errors.append("Adding sub_segment_num and sub_segments_expected. setting to 0, 0")
464
+ self.errors.append(
465
+ "Adding sub_segment_num and sub_segments_expected. setting to 0, 0"
466
+ )
465
467
  nbin.add_int(0, 8)
466
468
  nbin.add_int(0, 8)
467
469