Skip to content

Commit

Permalink
feat: Skip jap/chines titles on TC
Browse files Browse the repository at this point in the history
  • Loading branch information
fscorrupt committed Apr 29, 2024
1 parent f3f420e commit de37e8a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
19 changes: 18 additions & 1 deletion Posterizarr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ param (
[string]$mediatype
)

$CurrentScriptVersion = "1.2.11"
$CurrentScriptVersion = "1.2.12"
$global:HeaderWritten = $false
$ProgressPreference = 'SilentlyContinue'

Expand Down Expand Up @@ -2654,6 +2654,7 @@ $global:Posters = $config.PrerequisitePart.Posters
$global:BackgroundPosters = $config.PrerequisitePart.BackgroundPosters
$global:TitleCards = $config.PrerequisitePart.TitleCards
$SkipTBA = $config.PrerequisitePart.SkipTBA
$SkipJapTitle = $config.PrerequisitePart.SkipJapTitle

# Poster Overlay Part
$global:ImageProcessing = $config.OverlayPart.ImageProcessing
Expand Down Expand Up @@ -6253,9 +6254,13 @@ Elseif ($Tautulli) {
$EpisodeImage = $EpisodeImage.Replace('[', '_').Replace(']', '_').Replace('{', '_').Replace('}', '_')

$EpisodeTempImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\temp.jpg"
$cjkTitlePattern = '[\p{IsHiragana}\p{IsKatakana}\p{IsCJKUnifiedIdeographs}\p{IsThai}]'
if ($SkipTBA -eq 'True' -and $global:EPTitle -eq 'TBA') {
Write-Entry -Subtext "Skipping episode because Title is 'TBA'" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
}
Elseif ($SkipJapTitle -eq 'True' -and $global:EPTitle -match $cjkTitlePattern){
Write-Entry -Subtext "Skipping episode because Title contains Jap/Chinese Chars" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
}
Else {
if (-not $directoryHashtable.ContainsKey("$hashtestpath")) {
if (!$Episodepostersearchtext) {
Expand Down Expand Up @@ -6645,9 +6650,13 @@ Elseif ($Tautulli) {

$EpisodeImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\$($entry.RootFoldername)_$global:FileNaming.jpg"
$EpisodeImage = $EpisodeImage.Replace('[', '_').Replace(']', '_').Replace('{', '_').Replace('}', '_')
$cjkTitlePattern = '[\p{IsHiragana}\p{IsKatakana}\p{IsCJKUnifiedIdeographs}\p{IsThai}]'
if ($SkipTBA -eq 'True' -and $global:EPTitle -eq 'TBA') {
Write-Entry -Subtext "Skipping episode because Title is 'TBA'" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
}
Elseif ($SkipJapTitle -eq 'True' -and $global:EPTitle -match $cjkTitlePattern){
Write-Entry -Subtext "Skipping episode because Title contains Jap/Chinese Chars" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
}
Else {
if (-not $directoryHashtable.ContainsKey("$hashtestpath")) {
if (!$Episodepostersearchtext) {
Expand Down Expand Up @@ -9190,9 +9199,13 @@ else {
$EpisodeImage = $EpisodeImage.Replace('[', '_').Replace(']', '_').Replace('{', '_').Replace('}', '_')

$EpisodeTempImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\temp.jpg"
$cjkTitlePattern = '[\p{IsHiragana}\p{IsKatakana}\p{IsCJKUnifiedIdeographs}\p{IsThai}]'
if ($SkipTBA -eq 'True' -and $global:EPTitle -eq 'TBA') {
Write-Entry -Subtext "Skipping episode because Title is 'TBA'" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
}
Elseif ($SkipJapTitle -eq 'True' -and $global:EPTitle -match $cjkTitlePattern){
Write-Entry -Subtext "Skipping episode because Title contains Jap/Chinese Chars" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
}
Else {
if (-not $directoryHashtable.ContainsKey("$hashtestpath")) {
if (!$Episodepostersearchtext) {
Expand Down Expand Up @@ -9565,9 +9578,13 @@ else {

$EpisodeImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\$($entry.RootFoldername)_$global:FileNaming.jpg"
$EpisodeImage = $EpisodeImage.Replace('[', '_').Replace(']', '_').Replace('{', '_').Replace('}', '_')
$cjkTitlePattern = '[\p{IsHiragana}\p{IsKatakana}\p{IsCJKUnifiedIdeographs}\p{IsThai}]'
if ($SkipTBA -eq 'True' -and $global:EPTitle -eq 'TBA') {
Write-Entry -Subtext "Skipping episode because Title is 'TBA'" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
}
Elseif ($SkipJapTitle -eq 'True' -and $global:EPTitle -match $cjkTitlePattern){
Write-Entry -Subtext "Skipping episode because Title contains Jap/Chinese Chars" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
}
Else {
if (-not $directoryHashtable.ContainsKey("$hashtestpath")) {
if (!$Episodepostersearchtext) {
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Posterizarr is cross-platform ready, meaning it can run on Linux, [Docker (Alpin
- `BackgroundPosters`: Set to `true` to also create background posters.
- `TitleCards` : Set to `true` to also create title cards.
- `SkipTBA` : Set to `true` to skip TitleCard creation if the Titletext is `TBA`.
- `SkipJapTitle` : Set to `true` to skip TitleCard creation if the Titletext is `Jap or Chinese`.
</details>
<details close>
<summary>OverlayPart:</summary>
Expand Down
2 changes: 1 addition & 1 deletion Release.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.11
1.2.12
3 changes: 2 additions & 1 deletion config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"SeasonPosters": "true",
"BackgroundPosters": "false",
"TitleCards": "false",
"SkipTBA": "false"
"SkipTBA": "false",
"SkipJapTitle": "false"
},
"OverlayPart":{
"ImageProcessing": "true",
Expand Down

0 comments on commit de37e8a

Please sign in to comment.