Skip to content

Commit

Permalink
add: season poster fallback to show poster (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
fscorrupt authored Nov 14, 2024
2 parents 37d5e2e + 3c34a94 commit 2429af4
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 2 deletions.
1 change: 1 addition & 0 deletions MyPersonalConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
},
"SeasonPosterOverlayPart": {
"fontAllCaps": "true",
"ShowFallback": "true",
"AddBorder": "true",
"AddText": "true",
"AddTextStroke": "false",
Expand Down
89 changes: 88 additions & 1 deletion Posterizarr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ param (
[switch]$SyncEmby
)

$CurrentScriptVersion = "1.9.7"
$CurrentScriptVersion = "1.9.8"
$global:HeaderWritten = $false
$ProgressPreference = 'SilentlyContinue'

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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){
Expand Down Expand Up @@ -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') {
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ Posterizarr is cross-platform ready, meaning it can run on Linux (also arm), [Do
<summary>SeasonPosterOverlayPart [click to unfold]</summary>
<br>

- `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.
Expand Down
2 changes: 1 addition & 1 deletion Release.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.7
1.9.8
1 change: 1 addition & 0 deletions config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
},
"SeasonPosterOverlayPart": {
"fontAllCaps": "true",
"ShowFallback": "false",
"AddBorder": "true",
"AddText": "true",
"AddTextStroke": "false",
Expand Down

0 comments on commit 2429af4

Please sign in to comment.