Skip to content

Commit

Permalink
feat: add missing notif for lidarr
Browse files Browse the repository at this point in the history
  • Loading branch information
royto authored and bastienwirtz committed Jul 16, 2024
1 parent f6b1247 commit 6462974
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
3 changes: 1 addition & 2 deletions docs/customservices.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,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, Radarr and Sonarr 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

0 comments on commit 6462974

Please sign in to comment.