From 696cd5601fd68975a737605bf69307123e2db863 Mon Sep 17 00:00:00 2001 From: pcnick Date: Sat, 4 Jul 2026 19:06:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20S00E=20=E8=88=87=E9=83=A8?= =?UTF-8?q?=E4=BB=BD=E9=8C=AF=E8=AA=A4=EF=BC=8C=E4=B8=A6=E8=BC=B8=E5=87=BA?= =?UTF-8?q?=E9=8C=AF=E8=AA=A4=E8=A8=8A=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Animelibk.ps1 | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/Animelibk.ps1 b/Animelibk.ps1 index bfd20d2..26e5fe8 100644 --- a/Animelibk.ps1 +++ b/Animelibk.ps1 @@ -159,7 +159,7 @@ function Get-StandName { } # 建立回傳資料物件,以方便後續資料處理。 - $OutputData = "" | Select newName, Season, Episode, newFullName; + $OutputData = "" | Select-Object newName, Season, Episode, newFullName; $OutputData.newName = if ($LS) { $WorkData.Latinization } else { $Result.Name.Trim() } $OutputData.Season = $WorkData.Season; $OutputData.Episode = [int] $Result.Episode; @@ -192,7 +192,7 @@ $StructPathObj = @{ if ($Single) { # 單集模式 $List = @(Get-Item -Path $(Edit-PathChar $Path)) - $BuildList = $List | select $FileObj, $StructPathObj, $NewNameObj | ? {$_.NewName.Episode -notin $WorkData.Episode} + $BuildList = $List | Select-Object $FileObj, $StructPathObj, $NewNameObj | ? {$_.NewName.Episode -notin $WorkData.Episode} #$BuildList | ? {$_.NewName.Episode -notin $WorkData.Episode} | Format-List # } elseif ($Sub) { # $List = @(Get-Item -Path $(Edit-PathChar $Path)) @@ -200,26 +200,30 @@ if ($Single) { } 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 + $BuildList = $List | Select-Object $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 | % { - $Command = @{ - ItemType = 'HardLink' - Path = $("{0}\{1}" -f $_.StructPath, $_.NewName.newFullName) - Target = $(Edit-PathChar $_.File.Fullname -nowlid) - } - #try { - if (New-Item @Command) { - Write-Host $_.NewName.newFullName - $_.NewName } +$ENDResult = $BuildList | ForEach-Object { + if ($_.NewName.Episode -and ($_.NewName.newName.Length -gt 0)) { + $Command = @{ + ItemType = 'HardLink' + Path = $("{0}\{1}" -f $_.StructPath, $_.NewName.newFullName) + Target = $(Edit-PathChar $_.File.Fullname -nowlid) + } + #try { + if (New-Item @Command) { + Write-Host $_.NewName.newFullName + $_.NewName } #} catch { - #} + } else { + "{0} 處理錯誤" -f $_.File.FullName | Write-Error + $_.NewName + } } #$ENDResult #$ENDResult.gettype();