Browse Source

Fix Lidarr API for calendar - thanks tron

causefx 7 years ago
parent
commit
106b4eca63
1 changed files with 11 additions and 2 deletions
  1. 11 2
      api/functions/homepage-connect-functions.php

+ 11 - 2
api/functions/homepage-connect-functions.php

@@ -1497,7 +1497,15 @@ function getLidarrCalendar($array, $number)
 		if (new DateTime() < new DateTime($releaseDate)) {
 			$unaired = true;
 		}
-		$downloaded = (isset($child['statistics']['percentOfEpisodes']) && $child['statistics']['percentOfEpisodes'] !== '100.0') ? '0' : '1';
+		if (isset($child['statistics']['percentOfTracks'])) {
+			if ($child['statistics']['percentOfTracks'] == '100.0') {
+				$downloaded = '1';
+			} else {
+				$downloaded = '0';
+			}
+		} else {
+			$downloaded = '0';
+		}
 		if ($downloaded == "0" && isset($unaired)) {
 			$downloaded = "text-info";
 		} elseif ($downloaded == "1") {
@@ -1536,7 +1544,8 @@ function getLidarrCalendar($array, $number)
 			"imagetypeFilter" => "music",
 			"downloadFilter" => $downloaded,
 			"bgColor" => str_replace('text', 'bg', $downloaded),
-			"details" => $details
+			"details" => $details,
+			"data" => $child
 		));
 	}
 	if ($i != 0) {