diff --git a/Animelibk.ps1 b/Animelibk.ps1 index edfc2cf..cf5aed5 100644 --- a/Animelibk.ps1 +++ b/Animelibk.ps1 @@ -68,7 +68,7 @@ $WorkData = $(if (Test-Path $RecorDB) { Get-Content $RecorDB | ConvertFrom-Json } else { "" -}) | Select-Object ID, WorkName, TargetName, DestinName, Latinization, Standard, Season, Episode +}) | Select-Object ID, WorkName, TargetName, DestinName, Latinization, Standard, Season, Offset, Episode $RecorDB # 確認資料狀態,缺少則進行物件資料建立 @@ -84,6 +84,13 @@ if (-not($WorkData.DestinName)) { if (-not($WorkData.Season)) { [int] $WorkData.Season = Read-Host "請輸入季別:"; } +if (-not($WorkData.Offset)) { + [int] $WorkData.Offset = if ($WorkData.Season -gt 1) { + Read-Host "請輸入集數偏移修正"; + } else { + 0 + } +} if (-not($WorkData.Episode)) { $WorkData.Episode = @(); } @@ -163,7 +170,7 @@ function Get-StandName { $OutputData.newName = if ($LS) { $WorkData.Latinization } else { $Result.Name.Trim() } $OutputData.Season = $WorkData.Season; $OutputData.Episode = [int] $Result.Episode; - $OutputData.newFullName = "{0} S{3:00}E{1:00}{4}{2}" -f $OutputData.newName, $OutputData.Episode, $File.Extension, $WorkData.Season, $(if($File.Extension -in $SubExt) {".default"}); + $OutputData.newFullName = "{0} S{3:00}E{1:00}{4}{2}" -f $OutputData.newName, $(if (($nE = $OutputData.Episode + $WorkData.Offset) -gt 0) { $nE } else { $OutputData.Episode }), $File.Extension, $WorkData.Season, $(if($File.Extension -in $SubExt) {".default"}); return $OutputData; } @@ -206,7 +213,7 @@ if ($Single) { } else { exit 0; } - +$_.NewName | Out-Host $ENDResult = $BuildList | ForEach-Object { if ($_.NewName.Episode -and ($_.NewName.newName.Length -gt 0)) { $Command = @{ @@ -222,7 +229,7 @@ $ENDResult = $BuildList | ForEach-Object { } else { "{0} 處理錯誤" -f $_.File.FullName | Write-Error - $_.NewName + $_.NewName | Out-Host } } #$ENDResult