|  |  | @ -3,12 +3,16 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  |     $Index = "H:\AnimeLib", |  |  |  |     $Index = "H:\AnimeLib", | 
			
		
	
		
		
			
				
					
					|  |  |  |     $VarConfig, |  |  |  |     $VarConfig, | 
			
		
	
		
		
			
				
					
					|  |  |  |     $RecorDB = "animelibk.ini", |  |  |  |     $RecorDB = "animelibk.ini", | 
			
		
	
		
		
			
				
					
					|  |  |  |     $Include = @(".rmvb", ".mp4", ".mkv", ".avi", ".ass", ".ssa"), |  |  |  |     $Include = @(".rmvb", ".mp4", ".mkv", ".avi"), | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     [switch] $Single, |  |  |  |     [switch] $Single, | 
			
		
	
		
		
			
				
					
					|  |  |  |     [switch] $Force,  |  |  |  |     [switch] $Force,  | 
			
		
	
		
		
			
				
					
					|  |  |  |     [switch] $Sub, |  |  |  |     [switch] $Sub, | 
			
		
	
		
		
			
				
					
					|  |  |  |     [switch] $testrun |  |  |  |     [switch] $testrun | 
			
		
	
		
		
			
				
					
					|  |  |  | ) |  |  |  | ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #$Include = ".rmvb", ".mp4", ".mkv", ".avi" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | $SubExt = if ($Sub) { ".ssa", ".ass", ".srt" } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | Import-Module -Name ($PSScriptRoot + "\PathChar.psd1") |  |  |  | Import-Module -Name ($PSScriptRoot + "\PathChar.psd1") | 
			
		
	
		
		
			
				
					
					|  |  |  | Import-Module -Name ($PSScriptRoot + "\NameRegex.psd1") |  |  |  | Import-Module -Name ($PSScriptRoot + "\NameRegex.psd1") | 
			
		
	
		
		
			
				
					
					|  |  |  | Edit-PathChar $Path |  |  |  | Edit-PathChar $Path | 
			
		
	
	
		
		
			
				
					|  |  | @ -84,8 +88,7 @@ if (-not($WorkData.Episode)) { | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | $WorkData |  |  |  | $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 = @{ |  |  |  | $Lang = @{ | 
			
		
	
		
		
			
				
					
					|  |  |  |     Season = "Season {0:00}" |  |  |  |     Season = "Season {0:00}" | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | @ -131,7 +134,7 @@ function Get-StandName { | 
			
		
	
		
		
			
				
					
					|  |  |  |     $OutputData.newName = $Result.Name; |  |  |  |     $OutputData.newName = $Result.Name; | 
			
		
	
		
		
			
				
					
					|  |  |  |     $OutputData.Season = $WorkData.Season; |  |  |  |     $OutputData.Season = $WorkData.Season; | 
			
		
	
		
		
			
				
					
					|  |  |  |     $OutputData.Episode = [int] $Result.Episode; |  |  |  |     $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; |  |  |  |     return $OutputData; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | @ -162,14 +165,14 @@ 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")} #> | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } 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 $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} } |  |  |  |     if (-not($Force)) { $BuildList = $BuildList | ? {$_.NewName.Episode -notin $WorkData.Episode} } | 
			
		
	
		
		
			
				
					
					|  |  |  | } else { |  |  |  | } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |     exit 0; |  |  |  |     exit 0; | 
			
		
	
	
		
		
			
				
					|  |  | @ -191,6 +194,7 @@ $ENDResult = $BuildList | % { | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | #$ENDResult |  |  |  | #$ENDResult | 
			
		
	
		
		
			
				
					
					|  |  |  | #$ENDResult.gettype(); |  |  |  | #$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 |  |  |  | $WorkData | ConvertTo-Json | Out-File -Encoding "UTF8" $RecorDB | 
			
		
	
		
		
			
				
					
					|  |  |  | exit 0; |  |  |  | exit 0; | 
			
		
	
	
		
		
			
				
					|  |  | 
 |