diff --git a/Animelibk.ps1 b/Animelibk.ps1 index 9ade618..3527450 100644 --- a/Animelibk.ps1 +++ b/Animelibk.ps1 @@ -5,6 +5,8 @@ [switch] $Force, [switch] $Sub ) +Import-Module -Name ($PSScriptRoot + "\PathChar.psd1") +Edit-PathChar $Path #$TargetName = "俺だけ入れる隠しダンジョン〜こっそり鍛えて世界最強〜"; $TargetName = "" #$DestinName = "真の仲間" @@ -62,20 +64,22 @@ function Get-StandName { $File = $(if ($FileObj.GetType().Name -eq 'FileInfo') { $FileObj } else { - Get-Item -Path $($FileObj -replace '([\[\]])', '`$1') + Get-Item -Path $(Edit-PathChar $FileObj) }) # 因應檔名不同而設定多組正規方式 $Result = @($( #$($TestName[-1] -match "\[([^\]]*)\]\[(\d{1,2})\]") #$($File.Name -match "[\[\s]([^\]]*?)(?:[\]\[\-\s]+)(\d{1,2})[\]\s]") - $($File.Name -match "[\[\s](?\b[^\]]*\b)(?:[\]\[\-\s]+)(?\d{1,2})(?:[vV]\d|FIN|END)?[\]\s]") + #$($File.Name -match "[\[\s](?\b[^\]]*\b)(?:[\]\[\-\s]+)(?\d{1,2})(?:[vV]\d|FIN|END)?[\]\s]") + $($($File.Name -replace "\[(DVD|HDTV|BD)rip\]", '') -match "[\[\s](?\b[^\]]*\b)(?:[\]\[\-\s]+)(?\d{1,2})(?:_?[vV]\d|FIN|END)?[\]\s]") #$($TestName[-1] -match "[\[\s](?[^\]]*?)(?:[\]\[\-\s]+)(?\d{1,2})(?:[vV]\d)?[\]\s]") ) | % { if ($_) { $Matches }}) # 檔名分析測試用 # $Pathes = @( -# "L:\Anime\200910 聖剣の刀鍛冶(聖劍鍛造師)\[DMG][The Sacred Blacksmith][01-12 END][848x480][BIG5]\[DMG][The Sacred Blacksmith][04V2][848x480][BIG5].rmvb" +# "L:\Anime\200910 聖剣の刀鍛冶(聖劍鍛造師)\[DMG][The Sacred Blacksmith][01-12 END][848x480][BIG5]\[DMG][The Sacred Blacksmith][04V2][848x480][BIG5].rmvb" +# "L:\Anime\201104 星空へ架かる橋(架向星空之橋)\[AngelSub][Hoshizora e Kakaru Hashi][BDRip][Vol.01][1920x1080][TW_BIG5][x264_FLAC]\[AngelSub][Hoshizora e Kakaru Hashi][BDRip][01][1920x1080][BIG5][x264_FLAC].mkv" # "H:\Anime\201901 盾の勇者の成り上がり\[LKSUB][Tate no Yuusha no Nariagari][01-25][GB][720P][MP4]\[LKSUB][Tate no Yuusha no Nariagari][01][GB][720P].mp4" # "L:\Anime\202004 ストライク・ザ・ブラッド OVA IV\[Suzu-Kaze][Strike_the_Blood_IV_OVA][01-12FIN][BDRip_1080P][HEVC_YUV420P10]\[Suzu-Kaze] Strike the Blood IV 12FIN [BDRip 1920x1080 HEVC YUV420P10 FLAC].mkv" # "L:\Anime\200910 アスラクライン II(機巧魔神)\[DMG][Asura Cryin2][01-13 END][848x480][BIG5][RMVB]\[DMG][Asura Cryin 2][01][848x480][Big5].rmvb" @@ -84,7 +88,7 @@ function Get-StandName { # $TestName = @($Pathes | % {$_.Split("\\")[-1]}) # $Result = @( $TestName | % { @( #$($_ -match "\[([^\]]*)\]\[(\d{1,2})\]") -# $($_ -match "[\[\s](?\b[^\]]*\b)(?:[\]\[\-\s]+)(?\d{1,2})(?:[vV]\d|FIN|END)?[\]\s]") +# $($($_ -replace "\[(DVD|HDTV|BD)rip\]", '') -match "[\[\s](?\b[^\]]*\b)(?:[\]\[\-\s]+)(?\d{1,2})(?:[vV]\d|FIN|END)?[\]\s]") # ) | % { if ($_) { $Matches }}}) # Write-Output $Result # $Matches @@ -144,11 +148,11 @@ $StructPathObj = @{ # 運作模式 if ($Single) { # 單集模式 - $List = @(Get-Item -Path $($Path -replace '([\[\]])', '`$1')) + $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) { - $List = @(Get-Item -Path $($Path -replace '([\[\]])', '`$1')) + $List = @(Get-Item -Path $(Edit-PathChar $Path)) $BuildList = $List | select $FileObj, $StructPathObj, $NewNameObj | ? {$_.File.Extension -in @(".ass", ".ssa")} } @@ -156,7 +160,7 @@ $ENDResult = $BuildList | % { $Command = @{ ItemType = 'HardLink' Path = $("{0}\{1}" -f $_.StructPath, $_.NewName.newFullName) - Target = $($_.File.Fullname -replace '([\[\]])', '`$1') + Target = $(Edit-PathChar $_.File.Fullname) } #try { if (New-Item @Command) { @@ -176,8 +180,8 @@ exit 0; # SIG # Begin signature block # MIIFxwYJKoZIhvcNAQcCoIIFuDCCBbQCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR -# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU8mPuUodwDIN2Q4E0vUnnZGUG -# r4GgggNSMIIDTjCCAjagAwIBAgIQdMnAQ4BDAo9Lgfn+QeDdhjANBgkqhkiG9w0B +# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUDqcimTh1uRkBM2wZ3oxWPCw2 +# SQ+gggNSMIIDTjCCAjagAwIBAgIQdMnAQ4BDAo9Lgfn+QeDdhjANBgkqhkiG9w0B # AQUFADAqMRMwEQYDVQQDDApOaWNrIENoYW5nMRMwEQYDVQQKDAplYXJpY2sub3Jn # MB4XDTIxMTAzMTEwMDI1MVoXDTIyMTAzMTEwMjI1MVowMzEiMCAGCSqGSIb3DQEJ # ARYTcGNuaWNrMTAwQGdtYWlsLmNvbTENMAsGA1UEAwwETmljazCCASIwDQYJKoZI @@ -198,11 +202,11 @@ exit 0; # AgEBMD4wKjETMBEGA1UEAwwKTmljayBDaGFuZzETMBEGA1UECgwKZWFyaWNrLm9y # ZwIQdMnAQ4BDAo9Lgfn+QeDdhjAJBgUrDgMCGgUAoHgwGAYKKwYBBAGCNwIBDDEK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