Parse new V3 api response

This commit is contained in:
Duy NGUYEN 2022-02-01 18:32:25 +01:00
parent 8ede30411e
commit f7f4ebdf66
3 changed files with 25 additions and 8 deletions

View File

@ -84,9 +84,9 @@ If you are using an older version of Radarr or Sonarr which don't support the ne
```yaml ```yaml
- name: "Radarr" - name: "Radarr"
type: "Radarr" type: "Radarr"
url: "http://localhost:8989/" url: "http://localhost:7878/"
apikey: "MY-SUPER-SECRET-API-KEY" apikey: "MY-SUPER-SECRET-API-KEY"
target: "_blank" # optional html tag target attribute target: "_blank"
legacyApi: true legacyApi: true
``` ```

View File

@ -75,9 +75,18 @@ export default {
this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`) this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
.then((queue) => { .then((queue) => {
this.activity = 0; this.activity = 0;
for (var i = 0; i < queue.length; i++) {
if (queue[i].movie) { if (this.item.legacyApi) {
this.activity++; for (var i = 0; i < queue.length; i++) {
if (queue[i].series) {
this.activity++;
}
}
} else {
for (const record of queue.records) {
if (record.movieId) {
this.activity++;
}
} }
} }
}) })

View File

@ -76,9 +76,17 @@ export default {
this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`) this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
.then((queue) => { .then((queue) => {
this.activity = 0; this.activity = 0;
for (var i = 0; i < queue.length; i++) { if (this.item.legacyApi) {
if (queue[i].series) { for (var i = 0; i < queue.length; i++) {
this.activity++; if (queue[i].series) {
this.activity++;
}
}
} else {
for (const record of queue.records) {
if (record.seriesId) {
this.activity++;
}
} }
} }
}) })