@@ -11,7 +11,7 @@ param (
11
11
[switch]$SyncEmby
12
12
)
13
13
14
- $CurrentScriptVersion = "1.8.8 "
14
+ $CurrentScriptVersion = "1.8.9 "
15
15
$global:HeaderWritten = $false
16
16
$ProgressPreference = 'SilentlyContinue'
17
17
@@ -6257,16 +6257,21 @@ if (!$SyncJelly -and !$SyncEmby) {
6257
6257
Write-Entry -Message "Checking size of overlay files..." -Path $configLogging -Color White -log Info
6258
6258
CheckOverlayDimensions -Posteroverlay "$Posteroverlay" -Backgroundoverlay "$Backgroundoverlay" -Titlecardoverlay "$titlecardoverlay" -PosterSize "$PosterSize" -BackgroundSize "$BackgroundSize" -Seasonoverlay "$Seasonoverlay"
6259
6259
6260
+ # Check if the FanartTvAPI module is installed
6261
+ $module = Get-Module -ListAvailable -Name FanartTvAPI
6260
6262
6261
- # check if fanart Module is installed
6262
- if (!(Get-InstalledModule -Name FanartTvAPI)) {
6263
- Write-Entry -Message "FanartTvAPI Module missing, installing it for you..." -Path $configLogging -Color Red -log Error
6264
- Write-Entry -Subtext "[ERROR-HERE] See above. ^^^" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Red -log Error
6265
- $errorCount++
6266
- Install-Module -Name FanartTvAPI -Force -Confirm -AllowClobber
6267
-
6268
- Write-Entry -Subtext "FanartTvAPI Module installed, importing it now..." -Path $configLogging -Color Green -log Info
6269
- Import-Module -Name FanartTvAPI
6263
+ if (-not $module) {
6264
+ # Try to install the module
6265
+ try {
6266
+ Install-Module -Name $moduleName -Force -SkipPublisherCheck -AllowPrerelease -Scope AllUsers
6267
+ Write-Entry -Message "FanartTvAPI Module missing, installing it for you..." -Path $configLogging -Color Red -log Error
6268
+ Write-Entry -Subtext "[ERROR-HERE] See above. ^^^" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Red -log Error
6269
+ $errorCount++
6270
+ Write-Entry -Subtext "FanartTvAPI Module installed, importing it now..." -Path $configLogging -Color Green -log Info
6271
+ Import-Module -Name FanartTvAPI
6272
+ } catch {
6273
+ Write-Host "Failed to install $moduleName module. Error: $_"
6274
+ }
6270
6275
}
6271
6276
# Add Fanart API
6272
6277
Add-FanartTvAPIKey -Api_Key $FanartTvAPIKey
@@ -19159,4 +19164,4 @@ else {
19159
19164
if (Test-Path $CurrentlyRunning) {
19160
19165
Remove-Item -LiteralPath $CurrentlyRunning | out-null
19161
19166
}
19162
- }
19167
+ }
0 commit comments