From 780e8d1d2f07c53c52f2725c622d32344886991a Mon Sep 17 00:00:00 2001 From: pcnick Date: Mon, 9 Oct 2023 11:40:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=8B=E4=BD=9C=E6=A8=A1=E5=BC=8F=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=A6=96=E8=BC=B8=E5=85=A5=E6=AA=94=E6=A1=88=E5=B1=AC?= =?UTF-8?q?=E6=80=A7=E9=80=B2=E8=A1=8C=E9=80=A3=E7=BA=8C=E8=99=95=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Animelibk.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Animelibk.ps1 b/Animelibk.ps1 index a70ea8c..5026623 100644 --- a/Animelibk.ps1 +++ b/Animelibk.ps1 @@ -3,9 +3,11 @@ $Index = "H:\AnimeLib", $VarConfig, $RecorDB = "animelibk.ini", + $Include = @(".rmvb", ".mp4", ".mkv", ".ass", ".ssa"), [switch] $Single, [switch] $Force, - [switch] $Sub + [switch] $Sub, + [switch] $testrun ) Import-Module -Name ($PSScriptRoot + "\PathChar.psd1") Import-Module -Name ($PSScriptRoot + "\NameRegex.psd1") @@ -150,6 +152,14 @@ if ($Single) { } elseif ($Sub) { $List = @(Get-Item -Path $(Edit-PathChar $Path)) $BuildList = $List | select $FileObj, $StructPathObj, $NewNameObj | ? {$_.File.Extension -in @(".ass", ".ssa")} +} elseif ($testrun) { + $List = (Edit-PathChar $Path | Get-Item | ? { $_.GetType().Name -eq "FileInfo" }) + + (Edit-PathChar $Path | Get-Item | ? { $_.GetType().Name -eq "DirectoryInfo" } | % { $_.GetFiles() }) + $BuildList = $List | select $FileObj, $StructPathObj, $NewNameObj + if ($Include -ne "") { $BuildList = $BuildList | ? {$_.File.Extension -in $Include} } + if (-not($Force)) { $BuildList = $BuildList | ? {$_.NewName.Episode -notin $WorkData.Episode} } +} else { + exit 0; } $ENDResult = $BuildList | % {