Skip to content

Commit

Permalink
fixed sonarr and radarr calendar images (#1963)
Browse files Browse the repository at this point in the history
  • Loading branch information
causefx committed Jun 17, 2024
1 parent dcaeef6 commit 3e4de05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/homepage/radarr.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ public function formatRadarrCalendar($array, $number, $url)
$banner = "/plugins/images/homepage/no-np.png";
foreach ($child['images'] as $image) {
if ($image['coverType'] == "banner" || $image['coverType'] == "fanart") {
if (strpos($image['url'], '://') === false) {
if ($image['coverType'] == 'fanart' && (isset($image['remoteUrl']) && $image['remoteUrl'] !== '')) {
$banner = $image['remoteUrl'];
}elseif (strpos($image['url'], '://') === false) {
$imageUrl = $image['url'];
$urlParts = explode("/", $url);
$imageParts = explode("/", $image['url']);
Expand All @@ -306,7 +308,7 @@ public function formatRadarrCalendar($array, $number, $url)
}
}
}
if ($banner !== "/plugins/images/homepage/no-np.png" || (strpos($banner, 'apikey') !== false)) {
if ($banner !== "/plugins/images/homepage/no-np.png" && (strpos($banner, 'apikey') !== false)) {
$cacheDirectory = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR;
$imageURL = $banner;
$cacheFile = $cacheDirectory . $movieID . '.jpg';
Expand Down
3 changes: 3 additions & 0 deletions api/homepage/sonarr.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ public function formatSonarrCalendar($array, $number)
if ($image['coverType'] == "fanart" && (isset($image['url']) && $image['url'] !== '')) {
$fanArt = $image['url'];
}
if ($image['coverType'] == 'fanart' && (isset($image['remoteUrl']) && $image['remoteUrl'] !== '')) {
$fanArt = $image['remoteUrl'];
}
}
if ($fanArt !== "/plugins/images/homepage/no-np.png" || (strpos($fanArt, '://') === false)) {
$cacheDirectory = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR;
Expand Down

1 comment on commit 3e4de05

@mannbadal
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@causefx confirmed working in develop branch. Thank you 👍

Please sign in to comment.