diff --git a/src/widgets/radarr/widget.js b/src/widgets/radarr/widget.js index da3f2a6b9..d57f1b18d 100644 --- a/src/widgets/radarr/widget.js +++ b/src/widgets/radarr/widget.js @@ -1,6 +1,18 @@ import genericProxyHandler from "utils/proxy/handlers/generic"; import { jsonArrayFilter } from "utils/proxy/api-helpers"; +function isAvailable(item) { + // isAvailable means that a digital image exists + // E.g. it's available to stream or on DVD, etc + if (item.isAvailable === false) { + return false; + } + + // sizeOnDisk is how much of that digital image you currently have + // movieFile.size is how large the requested digital image is + return item.sizeOnDisk === item.movieFile?.size; +} + const widget = { api: "{url}/api/v3/{endpoint}?apikey={key}", proxyHandler: genericProxyHandler, @@ -9,8 +21,8 @@ const widget = { movie: { endpoint: "movie", map: (data) => ({ - wanted: jsonArrayFilter(data, (item) => item.isAvailable === false).length, - have: jsonArrayFilter(data, (item) => item.isAvailable === true).length, + wanted: jsonArrayFilter(data, (item) => !isAvailable(item)).length, + have: jsonArrayFilter(data, (item) => isAvailable(item)).length, }), }, "queue/status": {