Skip to content

Commit

Permalink
Prefer --edit over --edit-based-on
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Nov 26, 2024
1 parent 4192a58 commit c69936f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions auto_editor/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ def main_options(parser: ArgumentParser) -> ArgumentParser:
"-m",
type=margin,
metavar="LENGTH",
help='Set sections near "loud" as "loud" too if section is less than LENGTH away.',
help='Set sections near "loud" as "loud" too if section is less than LENGTH away',
)
parser.add_argument(
"--edit-based-on",
"--edit",
metavar="METHOD",
help="Decide which method to use when making edits",
help="Set an expression which determines how to make auto edits",
)
parser.add_argument(
"--silent-speed",
Expand Down Expand Up @@ -147,7 +146,7 @@ def main_options(parser: ArgumentParser) -> ArgumentParser:
"--output",
"-o",
metavar="FILE",
help="Set the name/path of the new output file.",
help="Set the name/path of the new output file",
)
parser.add_argument(
"--player", "-p", metavar="CMD", help="Set player to open output media files"
Expand Down Expand Up @@ -312,6 +311,7 @@ def main() -> None:
({"--export-as-json"}, ["--export", "json"]),
({"--export-as-clip-sequence", "-excs"}, ["--export", "clip-sequence"]),
({"--keep-tracks-seperate"}, ["--keep-tracks-separate"]),
({"--edit-based-on"}, ["--edit"]),
],
)

Expand Down
28 changes: 14 additions & 14 deletions auto_editor/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,23 @@
will set the speed from 400 ticks to 800 ticks to 2.5x
If timebase is 30, 400 ticks to 800 means 13.33 to 26.66 seconds
""".strip(),
"--edit-based-on": """
"--edit": """
Evaluates a palet expression that returns a bool-array?. The array is then used for
editing.
Examples:
--edit audio
--edit audio:0.03 ; Change the threshold. Can be a value between 0-1.
--edit audio:3% ; You can also use the `%` macro.
--edit audio:0.03,stream=0 ; Only consider the first stream for editing.
--edit audio:stream=1,threshold=0.05 ; Here's how you use keyword arguments.
--edit (or audio:0.04,stream=0 audio:0.08,stream=1) ; Consider both streams for editing (merge with logical or), but with different thresholds.
--edit motion
--edit motion:0.02,blur=3
--edit (or audio:0.04 motion:0.02,blur=3)
--edit none
--edit all/e
Editing Methods:
- audio ; Audio silence/loudness detection
- threshold threshold? : 4%
Expand All @@ -52,19 +65,6 @@
- none ; Do not modify the media in anyway; mark all sections as "loud" (1).
- all/e ; Cut out everything out; mark all sections as "silent" (0).
Command-line Examples:
--edit audio
--edit audio:threshold=4%
--edit audio:threshold=0.03
--edit audio:stream=1
--edit (or audio:4%,stream=0 audio:8%,stream=1) ; `threshold` is first
--edit motion
--edit motion:threshold=2%,blur=3
--edit (or audio:4% motion:2%,blur=3)
--edit none
--edit all/e
""".strip(),
"--export": """
This option controls how timelines are exported.
Expand Down
2 changes: 1 addition & 1 deletion auto_editor/make_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def make_timeline(

for i, src in enumerate(sources):
try:
parser = Parser(Lexer("`--edit`", args.edit_based_on))
parser = Parser(Lexer("`--edit`", args.edit))
if log.is_debug:
log.debug(f"edit: {parser}")

Expand Down
2 changes: 1 addition & 1 deletion auto_editor/utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class Args:
sample_rate: int | None = None
resolution: tuple[int, int] | None = None
background: str = "#000000"
edit_based_on: str = "audio"
edit: str = "audio"
keep_tracks_separate: bool = False
audio_normalize: str = "#f"
export: str | None = None
Expand Down

0 comments on commit c69936f

Please sign in to comment.