Add -Suffix parameter to Create-Clip.ps1 for optional text appended to derived -Target name after "-Clip" and before file extension (e.g. -Suffix "-Shot-1" makes P01.mp4 become P01-Clip-Shot-1.mp4), with '.skip' marker preservation so suffix is inserted before marker (e.g. P01.skip.mp4 -> P01-Clip-Shot-1.skip.mp4), and update documentation to exclude -Suffix from forwarded parameters to Clone-Video.ps1

This commit is contained in:
guru committed 2026-11-01 09:24:14 -05:00
1 parent 553d0ea18d
commit 61894433d9
1 file changed
+8 -2
+8 -2
View File
@@ -3,7 +3,7 @@
Creates a new clipped video file using Clone-Video.ps1, requiring the -Video and -Frames parameters. Creates a new clipped video file using Clone-Video.ps1, requiring the -Video and -Frames parameters.
The filename used for the -Target parameter is automatically derived from the -Video filename, with "-Clip" inserted before the video file extension (e.g., P01.mp4 becomes P01-Clip.mp4). The filename used for the -Target parameter is automatically derived from the -Video filename, with "-Clip" inserted before the video file extension (e.g., P01.mp4 becomes P01-Clip.mp4).
When the video name carries a '.skip' marker before its extension, "-Clip" is inserted before that marker so it stays last (e.g., P01.skip.mp4 becomes P01-Clip.skip.mp4). When the video name carries a '.skip' marker before its extension, "-Clip" is inserted before that marker so it stays last (e.g., P01.skip.mp4 becomes P01-Clip.skip.mp4).
Any extra parameters will be pass directly to Clone-Video.ps1, except for parameters -Video, -Frames and -Target. Any extra parameters will be pass directly to Clone-Video.ps1, except for parameters -Video, -Frames, -Suffix and -Target.
.PARAMETER Video .PARAMETER Video
Path to the input video file. Can be absolute or relative to current directory. If the path has no extension, .mp4, .webm and .mkv are tried in turn. Path to the input video file. Can be absolute or relative to current directory. If the path has no extension, .mp4, .webm and .mkv are tried in turn.
.PARAMETER Frames .PARAMETER Frames
@@ -13,6 +13,9 @@
- -negative_number: Extract last N frames (e.g., "-10") - -negative_number: Extract last N frames (e.g., "-10")
- %: Represents the last frame index. Can be used alone or in ranges (e.g., "%", "10-%", "-%") - %: Represents the last frame index. Can be used alone or in ranges (e.g., "%", "10-%", "-%")
- all: Extract all frames (same as "0-%") - all: Extract all frames (same as "0-%")
.PARAMETER Suffix
Optional text appended to the derived -Target name after "-Clip" and before the file extension
(e.g. -Suffix "-Shot-1" makes P01.mp4 become P01-Clip-Shot-1.mp4). A '.skip' marker still stays last.
#> #>
[CmdletBinding(SupportsShouldProcess)] [CmdletBinding(SupportsShouldProcess)]
param( param(
@@ -22,6 +25,9 @@ param(
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[string]$Frames, [string]$Frames,
[Parameter(Mandatory = $false)]
[string]$Suffix = '',
[Parameter(ValueFromRemainingArguments)] [Parameter(ValueFromRemainingArguments)]
[object[]]$ExtraArgs [object[]]$ExtraArgs
) )
@@ -58,7 +64,7 @@ if ($sourceBase -match '^(.*)(\.skip)$') {
$skipMarker = $Matches[2] $skipMarker = $Matches[2]
} }
$targetName = "$sourceBase-Clip$skipMarker$sourceExt" $targetName = "$sourceBase-Clip$Suffix$skipMarker$sourceExt"
$targetPath = if ([string]::IsNullOrEmpty($sourceDir)) { $targetName } else { Join-Path $sourceDir $targetName } $targetPath = if ([string]::IsNullOrEmpty($sourceDir)) { $targetName } else { Join-Path $sourceDir $targetName }
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path