3
3
[switch ]$Testing
4
4
)
5
5
6
- $CurrentScriptVersion = " 1.0.20 "
6
+ $CurrentScriptVersion = " 1.0.21 "
7
7
$global :HeaderWritten = $false
8
8
9
9
$global :OSType = [System.Environment ]::OSVersion.Platform
@@ -146,6 +146,7 @@ function GetTMDBMoviePoster {
146
146
}
147
147
catch {
148
148
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
149
+ $errorCount ++
149
150
}
150
151
if ($response ) {
151
152
if ($response.images.posters ) {
@@ -181,6 +182,7 @@ function GetTMDBMoviePoster {
181
182
}
182
183
catch {
183
184
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
185
+ $errorCount ++
184
186
}
185
187
if ($response ) {
186
188
if ($response.images.posters ) {
@@ -222,6 +224,7 @@ function GetTMDBMovieBackground {
222
224
}
223
225
catch {
224
226
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
227
+ $errorCount ++
225
228
}
226
229
if ($response ) {
227
230
if ($response.images.backdrops ) {
@@ -263,6 +266,7 @@ function GetTMDBMovieBackground {
263
266
}
264
267
catch {
265
268
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
269
+ $errorCount ++
266
270
}
267
271
if ($response ) {
268
272
if ($response.images.backdrops ) {
@@ -314,6 +318,7 @@ function GetTMDBShowPoster {
314
318
}
315
319
catch {
316
320
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
321
+ $errorCount ++
317
322
}
318
323
if ($response ) {
319
324
if ($response.images.posters ) {
@@ -350,6 +355,7 @@ function GetTMDBShowPoster {
350
355
}
351
356
catch {
352
357
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
358
+ $errorCount ++
353
359
}
354
360
if ($response ) {
355
361
if ($response.images.posters ) {
@@ -391,6 +397,7 @@ function GetTMDBSeasonPoster {
391
397
}
392
398
catch {
393
399
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
400
+ $errorCount ++
394
401
}
395
402
if ($response ) {
396
403
if ($response.posters ) {
@@ -432,6 +439,7 @@ function GetTMDBSeasonPoster {
432
439
}
433
440
catch {
434
441
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
442
+ $errorCount ++
435
443
}
436
444
if ($responseBackup ) {
437
445
if ($responseBackup.images.posters ) {
@@ -505,6 +513,7 @@ function GetTMDBShowBackground {
505
513
}
506
514
catch {
507
515
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
516
+ $errorCount ++
508
517
}
509
518
if ($response ) {
510
519
if ($response.images.backdrops ) {
@@ -550,6 +559,7 @@ function GetTMDBShowBackground {
550
559
}
551
560
catch {
552
561
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
562
+ $errorCount ++
553
563
}
554
564
if ($response ) {
555
565
if ($response.images.backdrops ) {
@@ -600,6 +610,7 @@ function GetTMDBTitleCard {
600
610
}
601
611
catch {
602
612
Write-Log - Subtext " Could not query TMDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
613
+ $errorCount ++
603
614
}
604
615
if ($response ) {
605
616
if ($response.stills ) {
@@ -977,6 +988,7 @@ function GetTVDBMoviePoster {
977
988
}
978
989
catch {
979
990
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
991
+ $errorCount ++
980
992
}
981
993
if ($response ) {
982
994
if ($response.data.artworks ) {
@@ -999,6 +1011,7 @@ function GetTVDBMoviePoster {
999
1011
}
1000
1012
catch {
1001
1013
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1014
+ $errorCount ++
1002
1015
}
1003
1016
if ($response ) {
1004
1017
if ($response.data.artworks ) {
@@ -1044,6 +1057,7 @@ function GetTVDBMovieBackground {
1044
1057
}
1045
1058
catch {
1046
1059
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1060
+ $errorCount ++
1047
1061
}
1048
1062
if ($response ) {
1049
1063
if ($response.data.artworks ) {
@@ -1066,6 +1080,7 @@ function GetTVDBMovieBackground {
1066
1080
}
1067
1081
catch {
1068
1082
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1083
+ $errorCount ++
1069
1084
}
1070
1085
if ($response ) {
1071
1086
if ($response.data.artworks ) {
@@ -1114,6 +1129,7 @@ function GetTVDBShowPoster {
1114
1129
}
1115
1130
catch {
1116
1131
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1132
+ $errorCount ++
1117
1133
}
1118
1134
if ($response ) {
1119
1135
if ($response.data ) {
@@ -1144,6 +1160,7 @@ function GetTVDBShowPoster {
1144
1160
}
1145
1161
catch {
1146
1162
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1163
+ $errorCount ++
1147
1164
}
1148
1165
if ($response ) {
1149
1166
if ($response.data ) {
@@ -1188,6 +1205,7 @@ function GetTVDBSeasonPoster {
1188
1205
}
1189
1206
catch {
1190
1207
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1208
+ $errorCount ++
1191
1209
}
1192
1210
if ($response ) {
1193
1211
if ($response.data.seasons ) {
@@ -1201,6 +1219,7 @@ function GetTVDBSeasonPoster {
1201
1219
}
1202
1220
catch {
1203
1221
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1222
+ $errorCount ++
1204
1223
}
1205
1224
if ($Seasonresponse ) {
1206
1225
foreach ($lang in $global :PreferredLanguageOrderTVDB ) {
@@ -1247,6 +1266,7 @@ function GetTVDBShowBackground {
1247
1266
}
1248
1267
catch {
1249
1268
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1269
+ $errorCount ++
1250
1270
}
1251
1271
if ($response ) {
1252
1272
if ($response.data ) {
@@ -1277,6 +1297,7 @@ function GetTVDBShowBackground {
1277
1297
}
1278
1298
catch {
1279
1299
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1300
+ $errorCount ++
1280
1301
}
1281
1302
if ($response ) {
1282
1303
if ($response.data ) {
@@ -1324,6 +1345,7 @@ function GetTVDBTitleCard {
1324
1345
}
1325
1346
catch {
1326
1347
Write-Log - Subtext " Could not query TVDB url, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
1348
+ $errorCount ++
1327
1349
}
1328
1350
if ($response ) {
1329
1351
if ($response.data.episodes ) {
@@ -3275,8 +3297,15 @@ else {
3275
3297
$joinedTitle = $Titletext
3276
3298
}
3277
3299
if ($global :posterurl -or $global :PlexartworkDownloaded ) {
3278
- if (! $global :PlexartworkDownloaded ) {
3279
- Invoke-WebRequest - Uri $global :posterurl - OutFile $PosterImage
3300
+ try {
3301
+ if (! $global :PlexartworkDownloaded ) {
3302
+ $response = Invoke-WebRequest - Uri $global :posterurl - OutFile $PosterImage - ErrorAction Stop
3303
+ }
3304
+ }
3305
+ catch {
3306
+ $statusCode = $_.Exception.Response.StatusCode.value__
3307
+ Write-Log - Subtext " An error occurred while downloading the artwork: HTTP Error $statusCode " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
3308
+ $errorCount ++
3280
3309
}
3281
3310
Write-Log - Subtext " Poster url: $global :posterurl " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Info
3282
3311
if ($global :posterurl -like ' https://image.tmdb.org*' ) {
@@ -3452,8 +3481,15 @@ else {
3452
3481
$joinedTitle = $Titletext
3453
3482
}
3454
3483
if ($global :posterurl -or $global :PlexartworkDownloaded ) {
3455
- if (! $global :PlexartworkDownloaded ) {
3456
- Invoke-WebRequest - Uri $global :posterurl - OutFile $backgroundImage
3484
+ try {
3485
+ if (! $global :PlexartworkDownloaded ) {
3486
+ $response = Invoke-WebRequest - Uri $global :posterurl - OutFile $BackgroundImage - ErrorAction Stop
3487
+ }
3488
+ }
3489
+ catch {
3490
+ $statusCode = $_.Exception.Response.StatusCode.value__
3491
+ Write-Log - Subtext " An error occurred while downloading the artwork: HTTP Error $statusCode " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
3492
+ $errorCount ++
3457
3493
}
3458
3494
Write-Log - Subtext " Poster url: $global :posterurl " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Info
3459
3495
if ($global :posterurl -like ' https://image.tmdb.org*' ) {
@@ -3563,6 +3599,7 @@ else {
3563
3599
}
3564
3600
catch {
3565
3601
Write-Log - Subtext " Could not query entries from movies array, error message: $_ " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
3602
+ $errorCount ++
3566
3603
}
3567
3604
}
3568
3605
@@ -3678,8 +3715,15 @@ else {
3678
3715
$global :posterurl = $global :fanartfallbackposterurl
3679
3716
}
3680
3717
if ($global :posterurl -or $global :PlexartworkDownloaded ) {
3681
- if (! $global :PlexartworkDownloaded ) {
3682
- Invoke-WebRequest - Uri $global :posterurl - OutFile $PosterImage
3718
+ try {
3719
+ if (! $global :PlexartworkDownloaded ) {
3720
+ $response = Invoke-WebRequest - Uri $global :posterurl - OutFile $PosterImage - ErrorAction Stop
3721
+ }
3722
+ }
3723
+ catch {
3724
+ $statusCode = $_.Exception.Response.StatusCode.value__
3725
+ Write-Log - Subtext " An error occurred while downloading the artwork: HTTP Error $statusCode " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
3726
+ $errorCount ++
3683
3727
}
3684
3728
Write-Log - Subtext " Poster url: $global :posterurl " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Info
3685
3729
if ($global :posterurl -like ' https://image.tmdb.org*' ) {
@@ -3861,8 +3905,15 @@ else {
3861
3905
$joinedTitle = $Titletext
3862
3906
}
3863
3907
if ($global :posterurl -or $global :PlexartworkDownloaded ) {
3864
- if (! $global :PlexartworkDownloaded ) {
3865
- Invoke-WebRequest - Uri $global :posterurl - OutFile $backgroundImage
3908
+ try {
3909
+ if (! $global :PlexartworkDownloaded ) {
3910
+ $response = Invoke-WebRequest - Uri $global :posterurl - OutFile $BackgroundImage - ErrorAction Stop
3911
+ }
3912
+ }
3913
+ catch {
3914
+ $statusCode = $_.Exception.Response.StatusCode.value__
3915
+ Write-Log - Subtext " An error occurred while downloading the artwork: HTTP Error $statusCode " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
3916
+ $errorCount ++
3866
3917
}
3867
3918
Write-Log - Subtext " Poster url: $global :posterurl " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Info
3868
3919
if ($global :posterurl -like ' https://image.tmdb.org*' ) {
@@ -4047,8 +4098,15 @@ else {
4047
4098
}
4048
4099
if ($global :posterurl -or $global :PlexartworkDownloaded ) {
4049
4100
if ($global :ImageProcessing -eq ' true' ) {
4050
- if (! $global :PlexartworkDownloaded ) {
4051
- Invoke-WebRequest - Uri $global :posterurl - OutFile $SeasonImage
4101
+ try {
4102
+ if (! $global :PlexartworkDownloaded ) {
4103
+ $response = Invoke-WebRequest - Uri $global :posterurl - OutFile $SeasonImage - ErrorAction Stop
4104
+ }
4105
+ }
4106
+ catch {
4107
+ $statusCode = $_.Exception.Response.StatusCode.value__
4108
+ Write-Log - Subtext " An error occurred while downloading the artwork: HTTP Error $statusCode " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
4109
+ $errorCount ++
4052
4110
}
4053
4111
Write-Log - Subtext " Poster url: $global :posterurl " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Info
4054
4112
if ($global :posterurl -like ' https://image.tmdb.org*' ) {
@@ -4125,8 +4183,15 @@ else {
4125
4183
}
4126
4184
}
4127
4185
Else {
4128
- if (! $global :PlexartworkDownloaded ) {
4129
- Invoke-WebRequest - Uri $global :posterurl - OutFile $SeasonImage
4186
+ try {
4187
+ if (! $global :PlexartworkDownloaded ) {
4188
+ $response = Invoke-WebRequest - Uri $global :posterurl - OutFile $SeasonImage - ErrorAction Stop
4189
+ }
4190
+ }
4191
+ catch {
4192
+ $statusCode = $_.Exception.Response.StatusCode.value__
4193
+ Write-Log - Subtext " An error occurred while downloading the artwork: HTTP Error $statusCode " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
4194
+ $errorCount ++
4130
4195
}
4131
4196
Write-Log - Subtext " Poster url: $global :posterurl " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Info
4132
4197
if ($global :posterurl -like ' https://image.tmdb.org*' ) {
@@ -4356,8 +4421,15 @@ else {
4356
4421
}
4357
4422
if ($global :posterurl -or $global :PlexartworkDownloaded ) {
4358
4423
if ($global :ImageProcessing -eq ' true' ) {
4359
- if (! $global :PlexartworkDownloaded ) {
4360
- Invoke-WebRequest - Uri $global :posterurl - OutFile $EpisodeImage
4424
+ try {
4425
+ if (! $global :PlexartworkDownloaded ) {
4426
+ $response = Invoke-WebRequest - Uri $global :posterurl - OutFile $EpisodeImage - ErrorAction Stop
4427
+ }
4428
+ }
4429
+ catch {
4430
+ $statusCode = $_.Exception.Response.StatusCode.value__
4431
+ Write-Log - Subtext " An error occurred while downloading the artwork: HTTP Error $statusCode " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
4432
+ $errorCount ++
4361
4433
}
4362
4434
Write-Log - Subtext " Title Card url: $global :posterurl " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Info
4363
4435
if ($global :posterurl -like ' https://image.tmdb.org*' ) {
@@ -4445,7 +4517,6 @@ else {
4445
4517
}
4446
4518
}
4447
4519
catch {
4448
- # Not sure how fancy we get here to fall back to another provider, or just log the error and move on
4449
4520
$statusCode = $_.Exception.Response.StatusCode.value__
4450
4521
Write-Log - Subtext " An error occurred while downloading the artwork: HTTP Error $statusCode " - Path $global :ScriptRoot \Logs\Scriptlog.log - Type Error
4451
4522
$errorCount ++
0 commit comments