Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sonarr, Lidarr and radarr missing notif #680

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/customservices.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ The Medusa API key can be found in General configuration > Interface. It is need

## Lidarr, Prowlarr, Sonarr, Readarr and Radarr

This service displays Activity (blue), Warning (orange) or Error (red) notifications bubbles from the Lidarr, Readarr, Radarr or Sonarr application.
Readarr display also a Missing (purple) notification bubbles.
This service displays Activity (blue), Missing(purple) Warning (orange) or Error (red) notifications bubbles from the Lidarr, Readarr, Radarr or Sonarr application.
Two lines are needed in the config.yml :

```yaml
Expand Down
27 changes: 19 additions & 8 deletions src/components/services/Lidarr.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<strong v-if="activity > 0" class="notif activity" title="Activity">
{{ activity }}
</strong>
<strong v-if="missing > 0" class="notif missing" title="Missing">
{{ missing }}
</strong>
<strong v-if="warnings > 0" class="notif warnings" title="Warning">
{{ warnings }}
</strong>
Expand Down Expand Up @@ -38,6 +41,7 @@ export default {
data: () => {
return {
activity: null,
missing: null,
warnings: null,
errors: null,
serverError: false,
Expand All @@ -48,6 +52,10 @@ export default {
},
methods: {
fetchConfig: function () {
const handleError = (e) => {
console.error(e);
this.serverError = true;
};
this.fetch(`/api/v1/health?apikey=${this.item.apikey}`)
.then((health) => {
this.warnings = 0;
Expand All @@ -60,18 +68,17 @@ export default {
}
}
})
.catch((e) => {
console.error(e);
this.serverError = true;
});
.catch(handleError);
this.fetch(`/api/v1/queue/status?apikey=${this.item.apikey}`)
.then((queue) => {
this.activity = queue.totalCount;
})
.catch((e) => {
console.error(e);
this.serverError = true;
});
.catch(handleError);
this.fetch(`/api/v1/wanted/missing?apikey=${this.item.apikey}`)
.then((queue) => {
this.missing = queue.totalRecords;
})
.catch(handleError);
},
},
};
Expand All @@ -98,6 +105,10 @@ export default {
background-color: #4fb5d6;
}

&.missing {
background-color: #9d00ff;
}

&.warnings {
background-color: #d08d2e;
}
Expand Down
30 changes: 22 additions & 8 deletions src/components/services/Radarr.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<strong v-if="activity > 0" class="notif activity" title="Activity">
{{ activity }}
</strong>
<strong v-if="missing > 0" class="notif missing" title="Missing">
{{ missing }}
</strong>
<strong v-if="warnings > 0" class="notif warnings" title="Warning">
{{ warnings }}
</strong>
Expand Down Expand Up @@ -41,6 +44,7 @@ export default {
data: () => {
return {
activity: null,
missing: null,
warnings: null,
errors: null,
serverError: false,
Expand All @@ -56,6 +60,10 @@ export default {
},
methods: {
fetchConfig: function () {
const handleError = (e) => {
console.error(e);
this.serverError = true;
};
this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`)
.then((health) => {
this.warnings = 0;
Expand All @@ -68,10 +76,7 @@ export default {
}
}
})
.catch((e) => {
console.error(e);
this.serverError = true;
});
.catch(handleError);
this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
.then((queue) => {
this.activity = 0;
Expand All @@ -86,10 +91,16 @@ export default {
this.activity = queue.totalRecords;
}
})
.catch((e) => {
console.error(e);
this.serverError = true;
});
.catch(handleError);
if (!this.item.legacyApi) {
this.fetch(`${this.apiPath}/movie?apikey=${this.item.apikey}`)
.then((movies) => {
this.missing = movies.filter(
(m) => m.monitored && !m.hasFile
).length;
})
.catch(handleError);
}
},
},
};
Expand All @@ -113,6 +124,9 @@ export default {
background-color: #4fb5d6;
}

&.missing {
background-color: #9d00ff;
}
&.warnings {
background-color: #d08d2e;
}
Expand Down
38 changes: 21 additions & 17 deletions src/components/services/Sonarr.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<strong v-if="activity > 0" class="notif activity" title="Activity">
{{ activity }}
</strong>
<strong v-if="missing > 0" class="notif missing" title="Missing">
{{ missing }}
</strong>
<strong v-if="warnings > 0" class="notif warnings" title="Warning">
{{ warnings }}
</strong>
Expand Down Expand Up @@ -47,6 +50,7 @@ export default {
data: () => {
return {
activity: null,
missing: null,
warnings: null,
errors: null,
serverError: false,
Expand All @@ -57,22 +61,16 @@ export default {
},
methods: {
fetchConfig: function () {
const handleError = (e) => {
console.error(e);
this.serverError = true;
};
this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`)
.then((health) => {
this.warnings = 0;
this.errors = 0;
for (var i = 0; i < health.length; i++) {
if (health[i].type == "warning") {
this.warnings++;
} else if (health[i].type == "error") {
this.errors++;
}
}
this.warnings = health.filter((h) => h.type === "warning").length;
this.errors = health.filter((h) => h.type === "errors").length;
})
.catch((e) => {
console.error(e);
this.serverError = true;
});
.catch(handleError);
this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
.then((queue) => {
this.activity = 0;
Expand All @@ -86,10 +84,12 @@ export default {
this.activity = queue.totalRecords;
}
})
.catch((e) => {
console.error(e);
this.serverError = true;
});
.catch(handleError);
this.fetch(`${this.apiPath}/wanted/missing?apikey=${this.item.apikey}`)
.then((missing) => {
this.missing = missing.totalRecords;
})
.catch(handleError);
},
},
};
Expand All @@ -115,6 +115,10 @@ export default {
background-color: #4fb5d6;
}

&.missing {
background-color: #9d00ff;
}

&.warnings {
background-color: #d08d2e;
}
Expand Down