|
|
|
@ -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.newName = if ($LS) { $WorkData.Latinization } else { $Result.Name.Trim() } |
|
|
|
$OutputData.Season = $WorkData.Season; |
|
|
|
$OutputData.Season = $WorkData.Season; |
|
|
|
$OutputData.Episode = [int] $Result.Episode; |
|
|
|
$OutputData.Episode = [int] $Result.Episode; |
|
|
|
@ -192,7 +192,7 @@ $StructPathObj = @{ |
|
|
|
if ($Single) { |
|
|
|
if ($Single) { |
|
|
|
# 單集模式 |
|
|
|
# 單集模式 |
|
|
|
$List = @(Get-Item -Path $(Edit-PathChar $Path)) |
|
|
|
$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 |
|
|
|
#$BuildList | ? {$_.NewName.Episode -notin $WorkData.Episode} | Format-List |
|
|
|
# } elseif ($Sub) { |
|
|
|
# } elseif ($Sub) { |
|
|
|
# $List = @(Get-Item -Path $(Edit-PathChar $Path)) |
|
|
|
# $List = @(Get-Item -Path $(Edit-PathChar $Path)) |
|
|
|
@ -200,26 +200,30 @@ if ($Single) { |
|
|
|
} elseif ($testrun) { |
|
|
|
} elseif ($testrun) { |
|
|
|
$List = @(Edit-PathChar $Path | Get-Item | ? { $_.GetType().Name -eq "FileInfo" }) + |
|
|
|
$List = @(Edit-PathChar $Path | Get-Item | ? { $_.GetType().Name -eq "FileInfo" }) + |
|
|
|
@(Edit-PathChar $Path | Get-Item | ? { $_.GetType().Name -eq "DirectoryInfo" } | % { $_.GetFiles() }) |
|
|
|
@(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 ($Include -ne "") { $BuildList = $BuildList | ? {$_.File.Extension -in $Include} } |
|
|
|
if (-not($Force)) { $BuildList = $BuildList | ? {$_.NewName.Episode -notin $WorkData.Episode} } |
|
|
|
if (-not($Force)) { $BuildList = $BuildList | ? {$_.NewName.Episode -notin $WorkData.Episode} } |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
exit 0; |
|
|
|
exit 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$ENDResult = $BuildList | % { |
|
|
|
$ENDResult = $BuildList | ForEach-Object { |
|
|
|
$Command = @{ |
|
|
|
if ($_.NewName.Episode -and ($_.NewName.newName.Length -gt 0)) { |
|
|
|
ItemType = 'HardLink' |
|
|
|
$Command = @{ |
|
|
|
Path = $("{0}\{1}" -f $_.StructPath, $_.NewName.newFullName) |
|
|
|
ItemType = 'HardLink' |
|
|
|
Target = $(Edit-PathChar $_.File.Fullname -nowlid) |
|
|
|
Path = $("{0}\{1}" -f $_.StructPath, $_.NewName.newFullName) |
|
|
|
} |
|
|
|
Target = $(Edit-PathChar $_.File.Fullname -nowlid) |
|
|
|
#try { |
|
|
|
} |
|
|
|
if (New-Item @Command) { |
|
|
|
#try { |
|
|
|
Write-Host $_.NewName.newFullName |
|
|
|
if (New-Item @Command) { |
|
|
|
$_.NewName } |
|
|
|
Write-Host $_.NewName.newFullName |
|
|
|
|
|
|
|
$_.NewName } |
|
|
|
#} catch { |
|
|
|
#} catch { |
|
|
|
|
|
|
|
|
|
|
|
#} |
|
|
|
} else { |
|
|
|
|
|
|
|
"{0} 處理錯誤" -f $_.File.FullName | Write-Error |
|
|
|
|
|
|
|
$_.NewName |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#$ENDResult |
|
|
|
#$ENDResult |
|
|
|
#$ENDResult.gettype(); |
|
|
|
#$ENDResult.gettype(); |
|
|
|
|