|
|
@ -3,7 +3,7 @@ |
|
|
|
$Index = "H:\AnimeLib", |
|
|
|
$Index = "H:\AnimeLib", |
|
|
|
$VarConfig, |
|
|
|
$VarConfig, |
|
|
|
$RecorDB = "animelibk.ini", |
|
|
|
$RecorDB = "animelibk.ini", |
|
|
|
$Include = @(".rmvb", ".mp4", ".mkv", ".ass", ".ssa"), |
|
|
|
$Include = @(".rmvb", ".mp4", ".mkv", ".avi", ".ass", ".ssa"), |
|
|
|
[switch] $Single, |
|
|
|
[switch] $Single, |
|
|
|
[switch] $Force, |
|
|
|
[switch] $Force, |
|
|
|
[switch] $Sub, |
|
|
|
[switch] $Sub, |
|
|
@ -94,7 +94,7 @@ $Year = @($($JsonPath -replace '.*\\((?<Y>\d{4})?(?<M>\d{2})?).*$', '${Y}'), $(g |
|
|
|
# 依目標檔案位置變更磁碟代號 |
|
|
|
# 依目標檔案位置變更磁碟代號 |
|
|
|
$TargetDrive = Split-Path -Path $JsonPath -Qualifier |
|
|
|
$TargetDrive = Split-Path -Path $JsonPath -Qualifier |
|
|
|
if (Split-Path -Path $Index -IsAbsolute) { |
|
|
|
if (Split-Path -Path $Index -IsAbsolute) { |
|
|
|
if ($Index -match $TargetDrive) { |
|
|
|
if ($Index -notmatch $TargetDrive) { |
|
|
|
$Index2 = Join-Path -Path $TargetDrive -ChildPath (Split-Path -Path $Index -noQualifier) |
|
|
|
$Index2 = Join-Path -Path $TargetDrive -ChildPath (Split-Path -Path $Index -noQualifier) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$Index2 = $Index |
|
|
|
$Index2 = $Index |
|
|
@ -102,6 +102,7 @@ if (Split-Path -Path $Index -IsAbsolute) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$Index2 = Join-Path $TargetDrive $Index |
|
|
|
$Index2 = Join-Path $TargetDrive $Index |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Write-Host $Index2 |
|
|
|
# 取得目標資料夾是否存在,不存在建立資料夾,並取得資料夾物件 |
|
|
|
# 取得目標資料夾是否存在,不存在建立資料夾,並取得資料夾物件 |
|
|
|
$LinkPath = "{2}\{0}\{1}" -f $WorkData.DestinName, $($Lang["Season"] -f $WorkData.Season), $Index2 |
|
|
|
$LinkPath = "{2}\{0}\{1}" -f $WorkData.DestinName, $($Lang["Season"] -f $WorkData.Season), $Index2 |
|
|
|
$LinkDir = $(if (-not(Test-Path -Path "$LinkPath*")) { |
|
|
|
$LinkDir = $(if (-not(Test-Path -Path "$LinkPath*")) { |
|
|
@ -160,7 +161,7 @@ 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 $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)) |
|
|
|
$BuildList = $List | select $FileObj, $StructPathObj, $NewNameObj | ? {$_.File.Extension -in @(".ass", ".ssa")} |
|
|
|
$BuildList = $List | select $FileObj, $StructPathObj, $NewNameObj | ? {$_.File.Extension -in @(".ass", ".ssa")} |
|
|
@ -178,7 +179,7 @@ $ENDResult = $BuildList | % { |
|
|
|
$Command = @{ |
|
|
|
$Command = @{ |
|
|
|
ItemType = 'HardLink' |
|
|
|
ItemType = 'HardLink' |
|
|
|
Path = $("{0}\{1}" -f $_.StructPath, $_.NewName.newFullName) |
|
|
|
Path = $("{0}\{1}" -f $_.StructPath, $_.NewName.newFullName) |
|
|
|
Target = $(Edit-PathChar $_.File.Fullname) |
|
|
|
Target = $(Edit-PathChar $_.File.Fullname -nowlid) |
|
|
|
} |
|
|
|
} |
|
|
|
#try { |
|
|
|
#try { |
|
|
|
if (New-Item @Command) { |
|
|
|
if (New-Item @Command) { |
|
|
@ -192,4 +193,4 @@ $ENDResult = $BuildList | % { |
|
|
|
#$ENDResult.gettype(); |
|
|
|
#$ENDResult.gettype(); |
|
|
|
if (-not($Sub)) { $ENDResult | % { if ($_.Episode) { $WorkData.Episode += $_.Episode }}} |
|
|
|
if (-not($Sub)) { $ENDResult | % { if ($_.Episode) { $WorkData.Episode += $_.Episode }}} |
|
|
|
$WorkData | ConvertTo-Json | Out-File -Encoding "UTF8" $RecorDB |
|
|
|
$WorkData | ConvertTo-Json | Out-File -Encoding "UTF8" $RecorDB |
|
|
|
exit 0; |
|
|
|
exit 0; |
|
|
|