Browse Source

修改 Sub 運作模式

feature/Sub
pcnick 1 month ago
parent
commit
df5e7f22fe
  1. 20
      Animelibk.ps1

20
Animelibk.ps1

@ -3,12 +3,16 @@
$Index = "H:\AnimeLib",
$VarConfig,
$RecorDB = "animelibk.ini",
$Include = @(".rmvb", ".mp4", ".mkv", ".avi", ".ass", ".ssa"),
$Include = @(".rmvb", ".mp4", ".mkv", ".avi"),
[switch] $Single,
[switch] $Force,
[switch] $Sub,
[switch] $testrun
)
#$Include = ".rmvb", ".mp4", ".mkv", ".avi"
$SubExt = if ($Sub) { ".ssa", ".ass", ".srt" }
Import-Module -Name ($PSScriptRoot + "\PathChar.psd1")
Import-Module -Name ($PSScriptRoot + "\NameRegex.psd1")
Edit-PathChar $Path
@ -84,8 +88,7 @@ if (-not($WorkData.Episode)) {
}
$WorkData
#$Seasons_TC = "", "第一季", "第二季", "第三季", "第四季", "第五季"
$Seasons_TC = "", "Seasons 1", "Seasons 2", "Seasons 3", "Seasons 4", "Seasons 5"
# $Seasons_TC = "", "Seasons 1", "Seasons 2", "Seasons 3", "Seasons 4", "Seasons 5"
$Lang = @{
Season = "Season {0:00}"
}
@ -131,7 +134,7 @@ function Get-StandName {
$OutputData.newName = $Result.Name;
$OutputData.Season = $WorkData.Season;
$OutputData.Episode = [int] $Result.Episode;
$OutputData.newFullName = "{0} S{3:00}E{1}{4}{2}" -f $Result.Name, $Result.Episode, $File.Extension, $WorkData.Season, $(if($Sub) {".default"});
$OutputData.newFullName = "{0} S{3:00}E{1}{4}{2}" -f $Result.Name, $Result.Episode, $File.Extension, $WorkData.Season, $(if($File.Extension -in $SubExt) {".default"});
return $OutputData;
}
@ -162,14 +165,14 @@ if ($Single) {
$List = @(Get-Item -Path $(Edit-PathChar $Path))
$BuildList = $List | select $FileObj, $StructPathObj, $NewNameObj | ? {$_.NewName.Episode -notin $WorkData.Episode}
#$BuildList | ? {$_.NewName.Episode -notin $WorkData.Episode} | Format-List
} elseif ($Sub) {
<# } elseif ($Sub) {
$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")} #>
} 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 ($Include -ne "") { $BuildList = $BuildList | ? {$_.File.Extension -in $Include, $SubExt} }
if (-not($Force)) { $BuildList = $BuildList | ? {$_.NewName.Episode -notin $WorkData.Episode} }
} else {
exit 0;
@ -191,6 +194,7 @@ $ENDResult = $BuildList | % {
}
#$ENDResult
#$ENDResult.gettype();
if (-not($Sub)) { $ENDResult | % { if ($_.Episode) { $WorkData.Episode += $_.Episode }}}
#if (-not($Sub)) { $ENDResult | % { if ($_.Episode) { $WorkData.Episode += $_.Episode }}}
$ENDResult | % { if ($_.Episode) { $WorkData.Episode += $_.Episode }}
$WorkData | ConvertTo-Json | Out-File -Encoding "UTF8" $RecorDB
exit 0;

Loading…
Cancel
Save