aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/customservices.md10
-rw-r--r--src/components/services/Radarr.vue27
-rw-r--r--src/components/services/Sonarr.vue26
3 files changed, 53 insertions, 10 deletions
diff --git a/docs/customservices.md b/docs/customservices.md
index 747d7a4..7e3e6b3 100644
--- a/docs/customservices.md
+++ b/docs/customservices.md
@@ -79,6 +79,16 @@ Two lines are needed in the config.yml :
79 79
80The url must be the root url of Lidarr, Prowlarr, Radarr or Sonarr application. 80The url must be the root url of Lidarr, Prowlarr, Radarr or Sonarr application.
81The Lidarr, Prowlarr, Radarr or Sonarr API key can be found in Settings > General. It is needed to access the API. 81The Lidarr, Prowlarr, Radarr or Sonarr API key can be found in Settings > General. It is needed to access the API.
82If you are using an older version of Radarr or Sonarr which don't support the new V3 api endpoints, add the following line to your service config "legacyApi: true", example:
83
84```yaml
85- name: "Radarr"
86 type: "Radarr"
87 url: "http://localhost:7878/"
88 apikey: "MY-SUPER-SECRET-API-KEY"
89 target: "_blank"
90 legacyApi: true
91```
82 92
83## PaperlessNG 93## PaperlessNG
84 94
diff --git a/src/components/services/Radarr.vue b/src/components/services/Radarr.vue
index a57c895..7573667 100644
--- a/src/components/services/Radarr.vue
+++ b/src/components/services/Radarr.vue
@@ -26,6 +26,9 @@
26import service from "@/mixins/service.js"; 26import service from "@/mixins/service.js";
27import Generic from "./Generic.vue"; 27import Generic from "./Generic.vue";
28 28
29const V3_API = "/api/v3";
30const LEGACY_API = "/api";
31
29export default { 32export default {
30 name: "Radarr", 33 name: "Radarr",
31 mixins: [service], 34 mixins: [service],
@@ -46,9 +49,14 @@ export default {
46 created: function () { 49 created: function () {
47 this.fetchConfig(); 50 this.fetchConfig();
48 }, 51 },
52 computed: {
53 apiPath() {
54 return this.item.legacyApi ? LEGACY_API : V3_API;
55 },
56 },
49 methods: { 57 methods: {
50 fetchConfig: function () { 58 fetchConfig: function () {
51 this.fetch(`/api/health?apikey=${this.item.apikey}`) 59 this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`)
52 .then((health) => { 60 .then((health) => {
53 this.warnings = 0; 61 this.warnings = 0;
54 this.errors = 0; 62 this.errors = 0;
@@ -64,12 +72,21 @@ export default {
64 console.error(e); 72 console.error(e);
65 this.serverError = true; 73 this.serverError = true;
66 }); 74 });
67 this.fetch(`/api/queue?apikey=${this.item.apikey}`) 75 this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
68 .then((queue) => { 76 .then((queue) => {
69 this.activity = 0; 77 this.activity = 0;
70 for (var i = 0; i < queue.length; i++) { 78
71 if (queue[i].movie) { 79 if (this.item.legacyApi) {
72 this.activity++; 80 for (var i = 0; i < queue.length; i++) {
81 if (queue[i].movie) {
82 this.activity++;
83 }
84 }
85 } else {
86 for (const record of queue.records) {
87 if (record.movieId) {
88 this.activity++;
89 }
73 } 90 }
74 } 91 }
75 }) 92 })
diff --git a/src/components/services/Sonarr.vue b/src/components/services/Sonarr.vue
index f8dd0d1..55df437 100644
--- a/src/components/services/Sonarr.vue
+++ b/src/components/services/Sonarr.vue
@@ -27,6 +27,9 @@
27import service from "@/mixins/service.js"; 27import service from "@/mixins/service.js";
28import Generic from "./Generic.vue"; 28import Generic from "./Generic.vue";
29 29
30const V3_API = "/api/v3";
31const LEGACY_API = "/api";
32
30export default { 33export default {
31 name: "Sonarr", 34 name: "Sonarr",
32 mixins: [service], 35 mixins: [service],
@@ -36,6 +39,11 @@ export default {
36 components: { 39 components: {
37 Generic, 40 Generic,
38 }, 41 },
42 computed: {
43 apiPath() {
44 return this.item.legacyApi ? LEGACY_API : V3_API;
45 },
46 },
39 data: () => { 47 data: () => {
40 return { 48 return {
41 activity: null, 49 activity: null,
@@ -49,7 +57,7 @@ export default {
49 }, 57 },
50 methods: { 58 methods: {
51 fetchConfig: function () { 59 fetchConfig: function () {
52 this.fetch(`/api/health?apikey=${this.item.apikey}`) 60 this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`)
53 .then((health) => { 61 .then((health) => {
54 this.warnings = 0; 62 this.warnings = 0;
55 this.errors = 0; 63 this.errors = 0;
@@ -65,12 +73,20 @@ export default {
65 console.error(e); 73 console.error(e);
66 this.serverError = true; 74 this.serverError = true;
67 }); 75 });
68 this.fetch(`/api/queue?apikey=${this.item.apikey}`) 76 this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
69 .then((queue) => { 77 .then((queue) => {
70 this.activity = 0; 78 this.activity = 0;
71 for (var i = 0; i < queue.length; i++) { 79 if (this.item.legacyApi) {
72 if (queue[i].series) { 80 for (var i = 0; i < queue.length; i++) {
73 this.activity++; 81 if (queue[i].series) {
82 this.activity++;
83 }
84 }
85 } else {
86 for (const record of queue.records) {
87 if (record.seriesId) {
88 this.activity++;
89 }
74 } 90 }
75 } 91 }
76 }) 92 })