auto-editor 23.35.1__py3-none-any.whl → 23.40.1__py3-none-any.whl

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.
auto_editor/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "23.35.1"
2
- version = "23w35a"
1
+ __version__ = "23.40.1"
2
+ version = "23w40a"
auto_editor/analyze.py CHANGED
@@ -12,9 +12,9 @@ from auto_editor.lang.json import Lexer, Parser, dump
12
12
  from auto_editor.lib.contracts import (
13
13
  is_bool,
14
14
  is_nat,
15
+ is_nat1,
15
16
  is_str,
16
17
  is_threshold,
17
- is_uint,
18
18
  is_void,
19
19
  orc,
20
20
  )
@@ -46,28 +46,28 @@ if TYPE_CHECKING:
46
46
  audio_builder = pAttrs(
47
47
  "audio",
48
48
  pAttr("threshold", 0.04, is_threshold),
49
- pAttr("stream", 0, orc(is_uint, Sym("all"), "all")),
50
- pAttr("mincut", 6, is_uint),
51
- pAttr("minclip", 3, is_uint),
49
+ pAttr("stream", 0, orc(is_nat, Sym("all"), "all")),
50
+ pAttr("mincut", 6, is_nat),
51
+ pAttr("minclip", 3, is_nat),
52
52
  )
53
53
  motion_builder = pAttrs(
54
54
  "motion",
55
55
  pAttr("threshold", 0.02, is_threshold),
56
- pAttr("stream", 0, is_uint),
57
- pAttr("blur", 9, is_uint),
58
- pAttr("width", 400, is_nat),
56
+ pAttr("stream", 0, is_nat),
57
+ pAttr("blur", 9, is_nat),
58
+ pAttr("width", 400, is_nat1),
59
59
  )
60
60
  pixeldiff_builder = pAttrs(
61
61
  "pixeldiff",
62
- pAttr("threshold", 1, is_uint),
63
- pAttr("stream", 0, is_uint),
62
+ pAttr("threshold", 1, is_nat),
63
+ pAttr("stream", 0, is_nat),
64
64
  )
65
65
  subtitle_builder = pAttrs(
66
66
  "subtitle",
67
67
  pAttr("pattern", Required, is_str),
68
- pAttr("stream", 0, is_uint),
68
+ pAttr("stream", 0, is_nat),
69
69
  pAttr("ignore-case", False, is_bool),
70
- pAttr("max-count", None, orc(is_uint, is_void)),
70
+ pAttr("max-count", None, orc(is_nat, is_void)),
71
71
  )
72
72
 
73
73
  builder_map = {
@@ -149,16 +149,14 @@ def obj_tag(tag: str, tb: Fraction, obj: dict[str, Any]) -> str:
149
149
  return key
150
150
 
151
151
 
152
+ @dataclass
152
153
  class Levels:
153
- def __init__(
154
- self, ensure: Ensure, src: FileInfo, tb: Fraction, bar: Bar, temp: str, log: Log
155
- ):
156
- self.ensure = ensure
157
- self.src = src
158
- self.tb = tb
159
- self.bar = bar
160
- self.temp = temp
161
- self.log = log
154
+ ensure: Ensure
155
+ src: FileInfo
156
+ tb: Fraction
157
+ bar: Bar
158
+ temp: str
159
+ log: Log
162
160
 
163
161
  @property
164
162
  def media_length(self) -> int:
@@ -167,9 +165,7 @@ class Levels:
167
165
  return len(arr)
168
166
 
169
167
  sr, samples = read(
170
- self.ensure.audio(
171
- f"{self.src.path.resolve()}", self.src.label, stream=0
172
- )
168
+ self.ensure.audio(f"{self.src.path.resolve()}", self.src.label, 0)
173
169
  )
174
170
  samp_count = len(samples)
175
171
  del samples
auto_editor/ffwrapper.py CHANGED
@@ -298,11 +298,10 @@ class FileInfo:
298
298
  except ValueError:
299
299
  log.error(f"Could not convert fps '{fps_str}' to Fraction.")
300
300
 
301
- if fps < 1:
302
- if codec in IMG_CODECS:
303
- fps = Fraction(25)
304
- elif fps == 0:
305
- fps = Fraction(30)
301
+ if fps < 1 and codec in IMG_CODECS:
302
+ fps = Fraction(25)
303
+ if fps == 0:
304
+ fps = Fraction(30)
306
305
 
307
306
  try:
308
307
  time_base = Fraction(time_base_str)
@@ -123,6 +123,21 @@ def read_tb_ntsc(tb: int, ntsc: bool) -> Fraction:
123
123
  return Fraction(tb)
124
124
 
125
125
 
126
+ """
127
+ (define/c (read-tb-ntsc [tb int?] [ntsc bool?] -> frac?)
128
+ (if ntsc
129
+ (cond
130
+ ((= tb 24) 24000/1001)
131
+ ((= tb 30) 30000/1001)
132
+ ((= tb 60) 60000/1001)
133
+ (else (* tb 999/1000))
134
+ )
135
+ (* tb 1/1)
136
+ )
137
+ )
138
+ """
139
+
140
+
126
141
  def speedup(speed: float) -> Element:
127
142
  fil = Element("filter")
128
143
  effect = ET.SubElement(fil, "effect")
@@ -151,6 +166,28 @@ def speedup(speed: float) -> Element:
151
166
  return fil
152
167
 
153
168
 
169
+ """
170
+ (define/c (speedup [speed float?] -> element?)
171
+ (xml (filter (effect
172
+ (name "Time Remap")
173
+ (effectid "timeremap")
174
+ (parameter #:authoringApp "PremierePro"
175
+ (parameterid "variablespeed") (name "variablespeed")
176
+ (valuemin "0") (valuemax "1") (value "0")
177
+ )
178
+ (parameter #:authoringApp "PremierePro"
179
+ (parameterid "speed") (name "speed")
180
+ (valuemin "-100000") (valuemax "100000") (value (number->string speed))
181
+ )
182
+ (parameter #:authoringApp "PremierePro"
183
+ (parameterid "frameblending") (name "frameblending")
184
+ (value "FALSE")
185
+ )
186
+ )))
187
+ )
188
+ """
189
+
190
+
154
191
  SUPPORTED_EFFECTS = ["timeremap"]
155
192
 
156
193
 
auto_editor/help.py CHANGED
@@ -31,28 +31,28 @@ editing.
31
31
  Editing Methods:
32
32
  - audio ; Audio silence/loudness detection
33
33
  - threshold threshold? : 4%
34
- - stream (or/c uint? 'all "all") : 0
35
- - mincut uint? : 6
36
- - minclip uint? : 3
34
+ - stream (or/c nat? 'all "all") : 0
35
+ - mincut nat? : 6
36
+ - minclip nat? : 3
37
37
 
38
38
  - motion ; Motion detection specialized for noisy real-life videos
39
39
  - threshold threshold? : 2%
40
- - stream uint? : 0
41
- - blur uint? : 9
42
- - width nat? : 400
40
+ - stream nat? : 0
41
+ - blur nat? : 9
42
+ - width nat1? : 400
43
43
 
44
44
  - none ; Do not modify the media in anyway; mark all sections as "loud" (1).
45
45
  - all/e ; Cut out everything out; mark all sections as "silent" (0).
46
46
 
47
47
  - pixeldiff ; Detect when a certain amount of pixels have changed between frames.
48
- - threshold uint? : 1
49
- - stream uint? : 0
48
+ - threshold nat? : 1
49
+ - stream nat? : 0
50
50
 
51
51
  - subtitle ; Detect when subtitle matches pattern as a RegEx string.
52
52
  - pattern string?
53
- - stream uint? : 0
53
+ - stream nat? : 0
54
54
  - ignore-case bool? : #f
55
- - max-count (or/c uint? void?) : (void)
55
+ - max-count (or/c nat? void?) : (void)
56
56
 
57
57
  Command-line Examples:
58
58
  --edit audio