auto-editor 27.1.0__py3-none-any.whl → 27.1.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 +1 @@
1
- __version__ = "27.1.0"
1
+ __version__ = "27.1.1"
auto_editor/edit.py CHANGED
@@ -5,6 +5,7 @@ import sys
5
5
  from fractions import Fraction
6
6
  from heapq import heappop, heappush
7
7
  from os.path import splitext
8
+ from pathlib import Path
8
9
  from subprocess import run
9
10
  from typing import TYPE_CHECKING, Any
10
11
 
@@ -28,14 +29,18 @@ if TYPE_CHECKING:
28
29
 
29
30
 
30
31
  def set_output(
31
- out: str | None, _export: str | None, src: FileInfo | None, log: Log
32
+ out: str | None, _export: str | None, path: Path | None, log: Log
32
33
  ) -> tuple[str, dict[str, Any]]:
33
- if src is None:
34
- root, ext = "out", ".mp4"
34
+ if out is None:
35
+ if path is None:
36
+ log.error("`--output` must be set.") # When a timeline file is the input.
37
+ root, ext = splitext(path)
35
38
  else:
36
- root, ext = splitext(src.path if out is None else out)
37
- if ext == "":
38
- ext = src.path.suffix
39
+ root, ext = splitext(out)
40
+
41
+ if ext == "":
42
+ # Use `mp4` as the default, because it is most compatible.
43
+ ext = ".mp4" if path is None else path.suffix
39
44
 
40
45
  if _export is None:
41
46
  if ext == ".xml":
@@ -158,8 +163,7 @@ def parse_export(export: str, log: Log) -> dict[str, Any]:
158
163
 
159
164
  def edit_media(paths: list[str], args: Args, log: Log) -> None:
160
165
  bar = initBar(args.progress)
161
- tl = None
162
- src = None
166
+ tl = src = use_path = None
163
167
 
164
168
  if args.keep_tracks_separate:
165
169
  log.deprecated("--keep-tracks-separate is deprecated.")
@@ -181,9 +185,10 @@ def edit_media(paths: list[str], args: Args, log: Log) -> None:
181
185
  tl = read_json(paths[0], log)
182
186
  else:
183
187
  sources = [FileInfo.init(path, log) for path in paths]
184
- src = None if not sources else sources[0]
188
+ src = sources[0]
189
+ use_path = src.path
185
190
 
186
- output, export_ops = set_output(args.output, args.export, src, log)
191
+ output, export_ops = set_output(args.output, args.export, use_path, log)
187
192
  assert "export" in export_ops
188
193
  export = export_ops["export"]
189
194
 
@@ -2,7 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  import xml.etree.ElementTree as ET
4
4
  from fractions import Fraction
5
- from io import StringIO
6
5
  from math import ceil
7
6
  from typing import TYPE_CHECKING
8
7
  from xml.etree.ElementTree import Element
@@ -29,59 +28,20 @@ DEPTH = "16"
29
28
 
30
29
 
31
30
  def uri_to_path(uri: str) -> str:
32
- def de_norm(s: str) -> str:
33
- uri_escape = {
34
- "3C": "<",
35
- "3E": ">",
36
- "23": "#",
37
- "25": "%",
38
- "2B": "+",
39
- "7B": "{",
40
- "7D": "}",
41
- "7C": "|",
42
- "5C": "\\",
43
- "5E": "^",
44
- "7E": "~",
45
- "5B": "[",
46
- "5D": "]",
47
- "60": "`",
48
- "3F": "?",
49
- "3A": ":",
50
- "40": "@",
51
- "3D": "=",
52
- "2A": "*",
53
- "29": ")",
54
- "28": "(",
55
- "27": "'",
56
- "26": "&",
57
- "24": "$",
58
- "22": '"',
59
- "21": "!",
60
- "20": " ",
61
- }
62
- buf = StringIO()
63
- i = 0
64
- while i < len(s):
65
- if s[i] == "%" and len(s) > i + 3:
66
- tag = s[i + 1 : i + 3]
67
- if tag in uri_escape:
68
- buf.write(uri_escape[tag])
69
- i += 3
70
- else:
71
- buf.write(s[i])
72
- i += 1
73
- else:
74
- buf.write(s[i])
75
- i += 1
76
- return buf.getvalue()
31
+ urllib = __import__("urllib.parse", fromlist=["parse"])
77
32
 
78
33
  if uri.startswith("file://localhost/"):
79
- return de_norm(uri[16:])
80
- if uri.startswith("file://"):
81
- if uri[9] == ":": # Handle Windows-style paths
82
- return de_norm(uri[8:])
83
- return de_norm(uri[7:])
84
- return uri
34
+ uri = uri[16:]
35
+ elif uri.startswith("file://"):
36
+ # Windows-style paths
37
+ if len(uri) > 8 and uri[9] == ":":
38
+ uri = uri[8:]
39
+ else:
40
+ uri = uri[7:]
41
+ else:
42
+ return uri
43
+
44
+ return urllib.parse.unquote(uri)
85
45
 
86
46
  # /Users/wyattblue/projects/auto-editor/example.mp4
87
47
  # file:///Users/wyattblue/projects/auto-editor/example.mp4
auto_editor/timeline.py CHANGED
@@ -347,26 +347,29 @@ video\n"""
347
347
  return self.T.sr
348
348
 
349
349
 
350
- def make_tracks_dir(path: Path) -> Path:
350
+ def make_tracks_dir(tracks_dir: Path, path: Path) -> None:
351
351
  from os import mkdir
352
352
  from shutil import rmtree
353
353
 
354
- tracks_dir = path.parent / f"{path.stem}_tracks"
355
-
356
354
  try:
357
355
  mkdir(tracks_dir)
358
356
  except OSError:
359
357
  rmtree(tracks_dir)
360
358
  mkdir(tracks_dir)
361
359
 
362
- return tracks_dir
363
-
364
360
 
365
361
  def set_stream_to_0(src: FileInfo, tl: v3, log: Log) -> None:
366
- fold = make_tracks_dir(src.path)
362
+ dir_exists = False
367
363
  cache: dict[Path, FileInfo] = {}
368
364
 
369
365
  def make_track(i: int, path: Path) -> FileInfo:
366
+ nonlocal dir_exists
367
+
368
+ fold = path.parent / f"{path.stem}_tracks"
369
+ if not dir_exists:
370
+ make_tracks_dir(fold, path)
371
+ dir_exists = True
372
+
370
373
  newtrack = fold / f"{path.stem}_{i}.wav"
371
374
  if newtrack not in cache:
372
375
  mux(path, output=newtrack, stream=i)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: auto-editor
3
- Version: 27.1.0
3
+ Version: 27.1.1
4
4
  Summary: Auto-Editor: Effort free video editing!
5
5
  Author-email: WyattBlue <wyattblue@auto-editor.com>
6
6
  License-Expression: Unlicense
@@ -1,13 +1,13 @@
1
- auto_editor/__init__.py,sha256=GyXI0pHyyPF89C9QtYg4zFjEDtSMUJMNUdrc74jh27A,23
1
+ auto_editor/__init__.py,sha256=0ioEHfOkA9Eoup9m_rzaYLCKq4b4PYoylPtUx3iCRPE,23
2
2
  auto_editor/__main__.py,sha256=WfNtjKwx5fDMPpfSNLarigXD3Jp0My98FpzQqSAxQZ8,15807
3
3
  auto_editor/analyze.py,sha256=CeJG0LI9wXZk1R-QPrNGPS4za-_Avd8y7H-D437DqLg,12300
4
- auto_editor/edit.py,sha256=UbKG5jhl5K3kCx9wIB_-Con6PF-4H0-Du0yVln3B5Qc,18921
4
+ auto_editor/edit.py,sha256=qeuStjcBbRVhLweap_pxxAfME3Jh6tHyxywOjrYJ_ts,19125
5
5
  auto_editor/ffwrapper.py,sha256=Wet6B5nohgnjpBX7o20Zq0rYr-H9mUuOqHrbQAPPj38,5128
6
6
  auto_editor/help.py,sha256=CzfDTsL4GuGu596ySHKj_wKnxGR9h8B0KUdkZpo33oE,8044
7
7
  auto_editor/json.py,sha256=8IVhZJSLx2IVqJsbR5YKDvbHOhgIOvdQmYNpMdMG_xA,9332
8
8
  auto_editor/make_layers.py,sha256=nSEeCHysMot2eze23q05g2HFDuskN_4Jk108xlk2Rw8,10102
9
9
  auto_editor/preview.py,sha256=cqQdozM2IB-5qXHNxeqiSrSdEIzlMfjD4SU-NX9sYZ0,3052
10
- auto_editor/timeline.py,sha256=Ku6BdDDzdboO0DisO_KLDjAyxJLQVDybWVgFbGCcsmY,9416
10
+ auto_editor/timeline.py,sha256=wUduvIB7JRoV_kswSBWJar_aNJH6i-RO917xrON6lIM,9521
11
11
  auto_editor/vanparse.py,sha256=Ug5A2QaRqGiw4l55Z_h9T2QU1x0WqRibR7yY5rQ0WTk,10002
12
12
  auto_editor/cmds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  auto_editor/cmds/cache.py,sha256=bViYbtVXefTeEIUvSanDfA6cG35ep1N_Jvtz7ZjgIkY,1959
@@ -20,7 +20,7 @@ auto_editor/cmds/subdump.py,sha256=kHg8nfUi6I6VeJjEgMxupPa666qsYUh7ZEUxint7Gqo,2
20
20
  auto_editor/cmds/test.py,sha256=UNN1r6J69-woqA6QU7TeY0WlPxukQzwCRl5DGBTLK8g,28837
21
21
  auto_editor/formats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  auto_editor/formats/fcp11.py,sha256=uaJbLiwiVxqoVy5JCA14wZj-m1wqZIzWh7rS-BsnSQM,5219
23
- auto_editor/formats/fcp7.py,sha256=rHjXXjpJ5YQQvCxor7FpUaqaAreqjCas4uLpiTdFclc,20255
23
+ auto_editor/formats/fcp7.py,sha256=Q_raDxOBqo8QcnhaiXrIFPB-Un7wUvQ4SYt6KALOI1s,19212
24
24
  auto_editor/formats/json.py,sha256=UUBhFR_79vn4Lxu73B0cVBFgw4qytrmMP-TiCmDFMd0,7666
25
25
  auto_editor/formats/shotcut.py,sha256=-ES854LLFCMCBe100JRJedDmuk8zPev17aQMTrzPv-g,4923
26
26
  auto_editor/formats/utils.py,sha256=LYXDiqOk9WwUorLGw2D0M7In9BNDkoKikNawuks7hqE,1648
@@ -45,10 +45,10 @@ auto_editor/utils/container.py,sha256=CNHChHbhzIrjmDdWw6UzMqscrr9u7A-ZqKWejGjJwY
45
45
  auto_editor/utils/func.py,sha256=ODyjXnzSDatEu08w398K8_xBKYdXMY3IPHiJpGRZDyQ,3250
46
46
  auto_editor/utils/log.py,sha256=wPNf6AabV-0cnoS_bPLv1Lh7llQBtNqPKeh07einOuc,3701
47
47
  auto_editor/utils/types.py,sha256=j2hd4zMQ9EftDy41Ji2_PFru_7HEZObd9yKA0BJxFaY,7616
48
- auto_editor-27.1.0.dist-info/licenses/LICENSE,sha256=yiq99pWITHfqS0pbZMp7cy2dnbreTuvBwudsU-njvIM,1210
48
+ auto_editor-27.1.1.dist-info/licenses/LICENSE,sha256=yiq99pWITHfqS0pbZMp7cy2dnbreTuvBwudsU-njvIM,1210
49
49
  docs/build.py,sha256=g1uc1H9T_naGaermUiVMMwUpbT0IWElRhjgT0fvCh8w,1914
50
- auto_editor-27.1.0.dist-info/METADATA,sha256=JU6SgcQLr3thOG27aQRkt2r3INzU0q306BeK79qkwGs,6176
51
- auto_editor-27.1.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
52
- auto_editor-27.1.0.dist-info/entry_points.txt,sha256=UAsTc7qJQbnAzHd7KWg-ALo_X9Hj2yDs3M9I2DV3eyI,212
53
- auto_editor-27.1.0.dist-info/top_level.txt,sha256=jBV5zlbWRbKOa-xaWPvTD45QL7lGExx2BDzv-Ji4dTw,17
54
- auto_editor-27.1.0.dist-info/RECORD,,
50
+ auto_editor-27.1.1.dist-info/METADATA,sha256=ri7aLym52FDEnnDR7czUR3xqZ025BLmepV0Em6GXjQc,6176
51
+ auto_editor-27.1.1.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
52
+ auto_editor-27.1.1.dist-info/entry_points.txt,sha256=UAsTc7qJQbnAzHd7KWg-ALo_X9Hj2yDs3M9I2DV3eyI,212
53
+ auto_editor-27.1.1.dist-info/top_level.txt,sha256=jBV5zlbWRbKOa-xaWPvTD45QL7lGExx2BDzv-Ji4dTw,17
54
+ auto_editor-27.1.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.0)
2
+ Generator: setuptools (80.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5