From 3c34a94b5f85cc862395403fa6af40c1065e2408 Mon Sep 17 00:00:00 2001
From: FSCorrupt <45659314+fscorrupt@users.noreply.github.com>
Date: Thu, 14 Nov 2024 16:12:14 +0100
Subject: [PATCH] add: season poster fallback to show poster
---
MyPersonalConfig.json | 9 +++--
Posterizarr.ps1 | 89 ++++++++++++++++++++++++++++++++++++++++++-
README.md | 1 +
Release.txt | 2 +-
config.example.json | 1 +
5 files changed, 96 insertions(+), 6 deletions(-)
diff --git a/MyPersonalConfig.json b/MyPersonalConfig.json
index 4b5e04a..43a9aa1 100644
--- a/MyPersonalConfig.json
+++ b/MyPersonalConfig.json
@@ -119,7 +119,7 @@
"strokewidth": "6",
"AddOverlay": "true",
"fontcolor": "white",
- "bordercolor": "white",
+ "bordercolor": "black",
"minPointSize": "45",
"maxPointSize": "300",
"borderwidth": "30",
@@ -137,7 +137,7 @@
"strokecolor": "black",
"strokewidth": "6",
"fontcolor": "white",
- "bordercolor": "white",
+ "bordercolor": "black",
"minPointSize": "100",
"maxPointSize": "300",
"borderwidth": "30",
@@ -150,7 +150,7 @@
"UseBackgroundAsTitleCard": "false",
"AddOverlay": "true",
"AddBorder": "true",
- "bordercolor": "white",
+ "bordercolor": "black",
"borderwidth": "30",
"BackgroundFallback": "true"
},
@@ -186,6 +186,7 @@
},
"SeasonPosterOverlayPart": {
"fontAllCaps": "true",
+ "ShowFallback": "true",
"AddBorder": "true",
"AddText": "true",
"AddTextStroke": "false",
@@ -193,7 +194,7 @@
"strokewidth": "6",
"AddOverlay": "true",
"fontcolor": "white",
- "bordercolor": "white",
+ "bordercolor": "black",
"minPointSize": "95",
"maxPointSize": "250",
"borderwidth": "30",
diff --git a/Posterizarr.ps1 b/Posterizarr.ps1
index d1c1a6e..ae08f98 100644
--- a/Posterizarr.ps1
+++ b/Posterizarr.ps1
@@ -12,7 +12,7 @@ param (
[switch]$SyncEmby
)
-$CurrentScriptVersion = "1.9.7"
+$CurrentScriptVersion = "1.9.8"
$global:HeaderWritten = $false
$ProgressPreference = 'SilentlyContinue'
@@ -3516,6 +3516,7 @@ function LogConfigSettings {
Write-Entry -Subtext "| Text Box Offset: $text_offset" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "| Line Spacing: $lineSpacing" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "OverLay Season Part" -Path $configLogging -Color Cyan -log Info
+ Write-Entry -Subtext "| Fallback to Show: $ShowFallback" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "| All Caps on Text: $SeasonfontAllCaps" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "| Add Border to Image: $AddSeasonBorder" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "| Add Text to Image: $AddSeasonText" -Path $configLogging -Color White -log Info
@@ -3565,6 +3566,7 @@ function LogConfigSettings {
Write-Entry -Subtext "| Line Spacing: $BackgroundlineSpacing" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "OverLay TitleCard Part" -Path $configLogging -Color Cyan -log Info
Write-Entry -Subtext "| Use Background as Title Card: $UseBackgroundAsTitleCard" -Path $configLogging -Color White -log Info
+ Write-Entry -Subtext "| Fallback to Background: $BackgroundFallback" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "| Add Border to Background: $AddTitleCardBorder" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "| Border Color: $TitleCardbordercolor" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "| Add Overlay to Background: $AddTitleCardOverlay" -Path $configLogging -Color White -log Info
@@ -6257,6 +6259,7 @@ $borderwidthsecond = $borderwidth + 'x' + $borderwidth
$boxsize = $MaxWidth + 'x' + $MaxHeight
# Season Poster Overlay Part
+$ShowFallback = $config.TitleCardOverlayPart.ShowFallback.tolower()
$SeasonfontAllCaps = $config.SeasonPosterOverlayPart.fontAllCaps.tolower()
$AddSeasonBorder = $config.SeasonPosterOverlayPart.AddBorder.tolower()
$AddSeasonText = $config.SeasonPosterOverlayPart.AddText.tolower()
@@ -10311,6 +10314,34 @@ Elseif ($Tautulli) {
Write-Entry -Subtext "Taking Season Poster with text as fallback from 'TVDB'" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color DarkMagenta -log Info
$global:IsFallback = $true
}
+ if (!$global:posterurl -and $ShowFallback -eq 'true') {
+ # Lets just try to grab a show poster.
+ Write-Entry -Subtext "Fallback to Show Poster..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color DarkMagenta -log Info
+ $global:posterurl = GetTMDBSeasonPoster
+ if ($global:posterurl) {
+ Write-Entry -Subtext "Using the Show Poster as Season Fallback..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
+ $global:IsFallback = $true
+ $global:FallbackText = 'True-Show'
+ }
+ Else {
+ # Lets just try to grab a show poster.
+ $global:posterurl = GetTVDBSeasonPoster
+ if ($global:posterurl) {
+ Write-Entry -Subtext "Using the Show Poster as Season Fallback..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
+ $global:IsFallback = $true
+ $global:FallbackText = 'True-Show'
+ }
+ Else {
+ # Lets just try to grab a show poster.
+ $global:posterurl = GetFanartShowPoster
+ if ($global:posterurl) {
+ Write-Entry -Subtext "Using the Show Poster as Season Fallback..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
+ $global:IsFallback = $true
+ $global:FallbackText = 'True-Show'
+ }
+ }
+ }
+ }
}
if ($global:posterurl -or $global:PlexartworkDownloaded -or $TakeLocal) {
if ($global:ImageProcessing -eq 'true') {
@@ -14805,6 +14836,34 @@ Elseif ($OtherMediaServerUrl -and $OtherMediaServerApiKey -and $UseOtherMediaSer
Write-Entry -Subtext "Taking Season Poster with text as fallback from 'TVDB'" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color DarkMagenta -log Info
$global:IsFallback = $true
}
+ if (!$global:posterurl -and $ShowFallback -eq 'true') {
+ # Lets just try to grab a show poster.
+ Write-Entry -Subtext "Fallback to Show Poster..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color DarkMagenta -log Info
+ $global:posterurl = GetTMDBSeasonPoster
+ if ($global:posterurl) {
+ Write-Entry -Subtext "Using the Show Poster as Season Fallback..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
+ $global:IsFallback = $true
+ $global:FallbackText = 'True-Show'
+ }
+ Else {
+ # Lets just try to grab a show poster.
+ $global:posterurl = GetTVDBSeasonPoster
+ if ($global:posterurl) {
+ Write-Entry -Subtext "Using the Show Poster as Season Fallback..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
+ $global:IsFallback = $true
+ $global:FallbackText = 'True-Show'
+ }
+ Else {
+ # Lets just try to grab a show poster.
+ $global:posterurl = GetFanartShowPoster
+ if ($global:posterurl) {
+ Write-Entry -Subtext "Using the Show Poster as Season Fallback..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
+ $global:IsFallback = $true
+ $global:FallbackText = 'True-Show'
+ }
+ }
+ }
+ }
}
if ($global:posterurl -or $TakeLocal) {
if ($TakeLocal){
@@ -18924,6 +18983,34 @@ else {
Write-Entry -Subtext "Taking Season Poster with text as fallback from 'TVDB'" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color DarkMagenta -log Info
$global:IsFallback = $true
}
+ if (!$global:posterurl -and $ShowFallback -eq 'true') {
+ # Lets just try to grab a show poster.
+ Write-Entry -Subtext "Fallback to Show Poster..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color DarkMagenta -log Info
+ $global:posterurl = GetTMDBSeasonPoster
+ if ($global:posterurl) {
+ Write-Entry -Subtext "Using the Show Poster as Season Fallback..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
+ $global:IsFallback = $true
+ $global:FallbackText = 'True-Show'
+ }
+ Else {
+ # Lets just try to grab a show poster.
+ $global:posterurl = GetTVDBSeasonPoster
+ if ($global:posterurl) {
+ Write-Entry -Subtext "Using the Show Poster as Season Fallback..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
+ $global:IsFallback = $true
+ $global:FallbackText = 'True-Show'
+ }
+ Else {
+ # Lets just try to grab a show poster.
+ $global:posterurl = GetFanartShowPoster
+ if ($global:posterurl) {
+ Write-Entry -Subtext "Using the Show Poster as Season Fallback..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Yellow -log Warning
+ $global:IsFallback = $true
+ $global:FallbackText = 'True-Show'
+ }
+ }
+ }
+ }
}
if ($global:posterurl -or $global:PlexartworkDownloaded -or $TakeLocal) {
if ($global:ImageProcessing -eq 'true') {
diff --git a/README.md b/README.md
index cef2768..f3e0aa3 100644
--- a/README.md
+++ b/README.md
@@ -264,6 +264,7 @@ Posterizarr is cross-platform ready, meaning it can run on Linux (also arm), [Do
SeasonPosterOverlayPart [click to unfold]
+ - `ShowFallback`: Set to `true` if you want to fallback to show poster if no season poster was found.
- `fontAllCaps`: Set to `true` for all caps text, else `false`.
- `AddBorder`: Set to `true` to add a border to the image.
- `AddText`: Set to `true` to add text to the image.
diff --git a/Release.txt b/Release.txt
index 0b9006e..f5f0aa6 100644
--- a/Release.txt
+++ b/Release.txt
@@ -1 +1 @@
-1.9.7
\ No newline at end of file
+1.9.8
\ No newline at end of file
diff --git a/config.example.json b/config.example.json
index dc8f8b9..213df21 100644
--- a/config.example.json
+++ b/config.example.json
@@ -121,6 +121,7 @@
},
"SeasonPosterOverlayPart": {
"fontAllCaps": "true",
+ "ShowFallback": "false",
"AddBorder": "true",
"AddText": "true",
"AddTextStroke": "false",