Skip to content

Commit

Permalink
fix: Script exit on multiple Media Servers
Browse files Browse the repository at this point in the history
- Exit the script when a user has enabled plex and another mediaserver.
  • Loading branch information
fscorrupt committed Sep 5, 2024
1 parent 72bf80b commit 9b7e1b2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
21 changes: 20 additions & 1 deletion Posterizarr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[string]$mediatype
)

$CurrentScriptVersion = "1.7.0"
$CurrentScriptVersion = "1.7.1"
$global:HeaderWritten = $false
$ProgressPreference = 'SilentlyContinue'

Expand Down Expand Up @@ -3322,6 +3322,12 @@ function LogConfigSettings {
if ($PlexToken) {
Write-Entry -Subtext "| Plex Token: $($PlexToken[0..7] -join '')****" -Path $configLogging -Color White -log Info
}
if ($JellyfinAPIKey) {
Write-Entry -Subtext "| Jellyfin API Key: $($JellyfinAPIKey[0..7] -join '')****" -Path $configLogging -Color White -log Info
}
if ($EmbyAPIKey) {
Write-Entry -Subtext "| Emby API Key: $($EmbyAPIKey[0..7] -join '')****" -Path $configLogging -Color White -log Info
}
Write-Entry -Subtext "| Fav Provider: $global:FavProvider" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "| Width/Height Filtering: $global:WidthHeightFilter" -Path $configLogging -Color White -log Info
Write-Entry -Subtext "| Poster min width: $global:PosterMinWidth" -Path $configLogging -Color White -log Info
Expand Down Expand Up @@ -4048,6 +4054,19 @@ if ($UseEmby -eq 'true') {
$OtherMediaServerApiKey = $EmbyAPIKey
}

# Count how many media servers are enabled
$enabledServers = 0
if ($UseEmby -eq 'true') { $enabledServers++ }
if ($UseJellyfin -eq 'true') { $enabledServers++ }
if ($UsePlex -eq 'true') { $enabledServers++ }

# If more than one media server is enabled, exit with an error
if ($enabledServers -gt 1) {
Write-Entry -Message "You have enabled more than one media server - Please use only one." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Red -log Error
Write-Entry -Subtext "Exiting Posterizarr now..." -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Red -log Error
Exit 0
}

# Prerequisites Part
$AutoUpdateIM = $config.PrerequisitePart.AutoUpdateIM.tolower()
$show_skipped = $config.PrerequisitePart.show_skipped.tolower()
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Posterizarr is cross-platform ready, meaning it can run on Linux (also arm), [Do
> You do not have to redeploy the container if the script version changes because it is not part of the container.
> Container rebuilds only happen when there are changes to the ImageMagick, PowerShell, or other prerequisite versions.
>
> Do not enable more then one media server.
>
> If you want to install it on ARM please follow this carefully [ARM prerequisites](walkthrough.md#arm-prerequisites)

Expand Down Expand Up @@ -364,7 +366,7 @@ The posters are all placed in `AssetPath\...`. This can then be mounted in Komet
> - [IMAGE ASSET DIRECTORY GUIDE](https://kometa.wiki/en/latest/kometa/guides/assets/#image-asset-directory-guide)
>
> Assuming you made the config like i did, Posterizarr will now create the Posters directly in Kometa´s Asset dir.
>
>
> If you use Kometa make sure to set this settings on each Library in Kometa Config:
```yaml
libraries:
Expand Down
2 changes: 1 addition & 1 deletion Release.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.0
1.7.1

0 comments on commit 9b7e1b2

Please sign in to comment.