Rename -Source parameter to -Video in Create-Clip.ps1 and Create-PillarBox.ps1 for consistency with other scripts, updating all internal variable names (sourcePath->videoPath, sourceFull->videoFull) and documentation references, while preserving .skip marker handling and parameter forwarding logic in Create-Clip.ps1 and maintaining default -Target derivation and effect naming in Create-PillarBox.ps1
This commit is contained in:
1 parent
c8c5a5d75c
commit
553d0ea18d
3 files changed
+32
-32
No files matched your search
+17
-17
@@ -1,10 +1,10 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a new clipped video file using Clone-Video.ps1, requiring the -Source and -Frames parameters from that script.
|
||||
The filename used for the -Target parameter is automatically derived from the -Source filename, with "-Clip" inserted before the video file extension (e.g., P01.mp4 becomes P01-Clip.mp4).
|
||||
When the source 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 -Source, -Frames and -Target.
|
||||
.PARAMETER Source
|
||||
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).
|
||||
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.
|
||||
.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.
|
||||
.PARAMETER Frames
|
||||
0-based frames index to extract. Supports the following formats:
|
||||
@@ -17,7 +17,7 @@
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Source,
|
||||
[string]$Video,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Frames,
|
||||
@@ -29,25 +29,25 @@ param(
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$sourcePath = $Source
|
||||
$videoPath = $Video
|
||||
|
||||
# Resolve source path: accept .mp4, .webm or .mkv. If the path doesn't exist as-is,
|
||||
# Resolve video path: accept .mp4, .webm or .mkv. If the path doesn't exist as-is,
|
||||
# try appending each supported extension in turn (same logic as Clone-Video.ps1).
|
||||
$supportedSourceExts = @('.mp4', '.webm', '.mkv')
|
||||
if (-not (Test-Path -LiteralPath $sourcePath)) {
|
||||
foreach ($ext in $supportedSourceExts) {
|
||||
$candidate = "$sourcePath$ext"
|
||||
$supportedVideoExts = @('.mp4', '.webm', '.mkv')
|
||||
if (-not (Test-Path -LiteralPath $videoPath)) {
|
||||
foreach ($ext in $supportedVideoExts) {
|
||||
$candidate = "$videoPath$ext"
|
||||
if (Test-Path -LiteralPath $candidate) {
|
||||
$sourcePath = $candidate
|
||||
$videoPath = $candidate
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Derive the -Target path: insert "-Clip" before the file extension (e.g., P01.mp4 -> P01-Clip.mp4)
|
||||
$sourceExt = [System.IO.Path]::GetExtension($sourcePath)
|
||||
$sourceBase = [System.IO.Path]::GetFileNameWithoutExtension($sourcePath)
|
||||
$sourceDir = [System.IO.Path]::GetDirectoryName($sourcePath)
|
||||
$sourceExt = [System.IO.Path]::GetExtension($videoPath)
|
||||
$sourceBase = [System.IO.Path]::GetFileNameWithoutExtension($videoPath)
|
||||
$sourceDir = [System.IO.Path]::GetDirectoryName($videoPath)
|
||||
|
||||
# A '.skip' marker must stay immediately before the container extension, so "-Clip" is
|
||||
# inserted before it rather than after (e.g., P01.skip.mp4 -> P01-Clip.skip.mp4).
|
||||
@@ -103,5 +103,5 @@ while ($index -lt $extra.Count) {
|
||||
if ($PSBoundParameters.ContainsKey('WhatIf')) { $forwarded['WhatIf'] = [bool]$PSBoundParameters['WhatIf'] }
|
||||
if ($PSBoundParameters.ContainsKey('Confirm')) { $forwarded['Confirm'] = [bool]$PSBoundParameters['Confirm'] }
|
||||
|
||||
& $cloneVideoScript -Source $sourcePath -Frames $Frames -Target $targetPath @forwarded
|
||||
& $cloneVideoScript -Source $videoPath -Frames $Frames -Target $targetPath @forwarded
|
||||
exit $LASTEXITCODE
|
||||
Reference in new issue
Block a user