aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Bentley <mbentley@mbentley.net>2023-02-07 02:38:37 -0500
committerGitHub <noreply@github.com>2023-02-07 08:38:37 +0100
commitdfde8ea89d02f59f5408585702c0f2cf3f94eac1 (patch)
tree9b546463afa26c98d0fe9dab66a658ee5e452a86
parent1c7451bc81b847cf26cdb60c87b9c6cfffb12a6a (diff)
downloadhomer-dfde8ea89d02f59f5408585702c0f2cf3f94eac1.tar.gz
homer-dfde8ea89d02f59f5408585702c0f2cf3f94eac1.tar.zst
homer-dfde8ea89d02f59f5408585702c0f2cf3f94eac1.zip
Added Tdarr service (#573)v23.02.1
* Added Tdarr service Signed-off-by: Matt Bentley <mbentley@mbentley.net> * Added dummy-data for Tdarr; remove trailing / for API endpoint Signed-off-by: Matt Bentley <mbentley@mbentley.net> --------- Signed-off-by: Matt Bentley <mbentley@mbentley.net>
-rw-r--r--docs/customservices.md16
-rw-r--r--dummy-data/tdarr/api/v2/cruddb470
-rw-r--r--src/components/services/Tdarr.vue125
3 files changed, 610 insertions, 1 deletions
diff --git a/docs/customservices.md b/docs/customservices.md
index 82114c2..b28f399 100644
--- a/docs/customservices.md
+++ b/docs/customservices.md
@@ -32,6 +32,7 @@ within Homer:
32 - [What's Up Docker](#whats-up-docker) 32 - [What's Up Docker](#whats-up-docker)
33 - [SABnzbd](#sabnzbd) 33 - [SABnzbd](#sabnzbd)
34 - [OctoPrint](#sabnzbd) 34 - [OctoPrint](#sabnzbd)
35 - [Tdarr](#tdarr)
35 36
36If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page. 37If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page.
37 38
@@ -390,4 +391,17 @@ The OctoPrint service only needs an `apikey` & `url` and optionally a `display`
390 url: "http://192.168.0.151:8080" 391 url: "http://192.168.0.151:8080"
391 display: "text" # 'text' or 'bar'. Default to `text`. 392 display: "text" # 'text' or 'bar'. Default to `text`.
392 type: "OctoPrint" 393 type: "OctoPrint"
393``` \ No newline at end of file 394```
395
396## Tdarr
397
398The Tdarr service can allow you to show the number of currently queued items
399for transcoding on your Tdarr instance as well as the number of errored items.
400
401```yaml
402- name: "Tdarr"
403 logo: "assets/tools/sample.png"
404 url: "http://192.168.0.151:8265"
405 type: "Tdarr"
406 checkInterval: 5000 # (Optional) Interval (in ms) for updating the queue & error counts
407```
diff --git a/dummy-data/tdarr/api/v2/cruddb b/dummy-data/tdarr/api/v2/cruddb
new file mode 100644
index 0000000..2af4863
--- /dev/null
+++ b/dummy-data/tdarr/api/v2/cruddb
@@ -0,0 +1,470 @@
1{
2 "totalFileCount": 3245,
3 "totalTranscodeCount": 3148,
4 "totalHealthCheckCount": 7278,
5 "sizeDiff": 5265.423687950708,
6 "_id": "statistics",
7 "tdarrScore": "99.97",
8 "healthCheckScore": "99.97",
9 "table0Count": 0,
10 "table2Count": 3244,
11 "table3Count": 0,
12 "table4Count": 1,
13 "table5Count": 3244,
14 "table6Count": 0,
15 "table1Count": 1,
16 "pies": [
17 [
18 "All",
19 "all",
20 3245,
21 3148,
22 5265.423687950708,
23 7278,
24 [
25 {
26 "name": "Transcode success",
27 "value": 1995
28 },
29 {
30 "name": "Not required",
31 "value": 1249
32 },
33 {
34 "name": "Queued",
35 "value": 1
36 }
37 ],
38 [
39 {
40 "name": "Success",
41 "value": 3244
42 },
43 {
44 "name": "Queued",
45 "value": 1
46 }
47 ],
48 [
49 {
50 "name": "hevc",
51 "value": 3172
52 },
53 {
54 "name": "vp9",
55 "value": 48
56 },
57 {
58 "name": "h264",
59 "value": 24
60 }
61 ],
62 [
63 {
64 "name": "mkv",
65 "value": 3115
66 },
67 {
68 "name": "webm",
69 "value": 48
70 },
71 {
72 "name": "mp4",
73 "value": 81
74 }
75 ],
76 [
77 {
78 "name": "1080p",
79 "value": 2582
80 },
81 {
82 "name": "480p",
83 "value": 406
84 },
85 {
86 "name": "720p",
87 "value": 224
88 },
89 {
90 "name": "4KUHD",
91 "value": 29
92 },
93 {
94 "name": "576p",
95 "value": 3
96 }
97 ],
98 [],
99 []
100 ],
101 [
102 "Type1",
103 "t7_0knr-z",
104 3,
105 0,
106 0,
107 3,
108 [
109 {
110 "name": "Not required",
111 "value": 3
112 }
113 ],
114 [
115 {
116 "name": "Success",
117 "value": 3
118 }
119 ],
120 [
121 {
122 "name": "hevc",
123 "value": 3
124 }
125 ],
126 [
127 {
128 "name": "mkv",
129 "value": 3
130 }
131 ],
132 [
133 {
134 "name": "480p",
135 "value": 3
136 }
137 ],
138 [],
139 []
140 ],
141 [
142 "Type2",
143 "ekyBRmWbD",
144 9,
145 13,
146 10.722183834761381,
147 65,
148 [
149 {
150 "name": "Transcode success",
151 "value": 9
152 }
153 ],
154 [
155 {
156 "name": "Success",
157 "value": 9
158 }
159 ],
160 [
161 {
162 "name": "hevc",
163 "value": 9
164 }
165 ],
166 [
167 {
168 "name": "mkv",
169 "value": 9
170 }
171 ],
172 [
173 {
174 "name": "480p",
175 "value": 1
176 },
177 {
178 "name": "576p",
179 "value": 1
180 },
181 {
182 "name": "720p",
183 "value": 4
184 },
185 {
186 "name": "1080p",
187 "value": 3
188 }
189 ],
190 [],
191 []
192 ],
193 [
194 "Type3",
195 "-dy1H5yNz",
196 2619,
197 2641,
198 2710.185842271894,
199 5837,
200 [
201 {
202 "name": "Transcode success",
203 "value": 1586
204 },
205 {
206 "name": "Not required",
207 "value": 1033
208 }
209 ],
210 [
211 {
212 "name": "Success",
213 "value": 2619
214 }
215 ],
216 [
217 {
218 "name": "hevc",
219 "value": 2571
220 },
221 {
222 "name": "vp9",
223 "value": 48
224 }
225 ],
226 [
227 {
228 "name": "mkv",
229 "value": 2510
230 },
231 {
232 "name": "webm",
233 "value": 48
234 },
235 {
236 "name": "mp4",
237 "value": 61
238 }
239 ],
240 [
241 {
242 "name": "1080p",
243 "value": 2050
244 },
245 {
246 "name": "720p",
247 "value": 186
248 },
249 {
250 "name": "480p",
251 "value": 383
252 }
253 ],
254 [],
255 []
256 ],
257 [
258 "Type4",
259 "ASRD2TAeP",
260 1,
261 11,
262 83.31165281962603,
263 32,
264 [
265 {
266 "name": "Queued",
267 "value": 1
268 }
269 ],
270 [
271 {
272 "name": "Queued",
273 "value": 1
274 }
275 ],
276 [
277 {
278 "name": "h264",
279 "value": 1
280 }
281 ],
282 [
283 {
284 "name": "mp4",
285 "value": 1
286 }
287 ],
288 [
289 {
290 "name": "1080p",
291 "value": 1
292 }
293 ],
294 [],
295 []
296 ],
297 [
298 "Type5",
299 "KQ03rLWIw",
300 11,
301 14,
302 17.225701110437512,
303 43,
304 [
305 {
306 "name": "Not required",
307 "value": 11
308 }
309 ],
310 [
311 {
312 "name": "Success",
313 "value": 11
314 }
315 ],
316 [
317 {
318 "name": "hevc",
319 "value": 11
320 }
321 ],
322 [
323 {
324 "name": "mkv",
325 "value": 11
326 }
327 ],
328 [
329 {
330 "name": "720p",
331 "value": 6
332 },
333 {
334 "name": "480p",
335 "value": 4
336 },
337 {
338 "name": "1080p",
339 "value": 1
340 }
341 ],
342 [],
343 []
344 ],
345 [
346 "Type6",
347 "RQhHe9OCl",
348 602,
349 473,
350 2420.9242209186777,
351 1300,
352 [
353 {
354 "name": "Not required",
355 "value": 202
356 },
357 {
358 "name": "Transcode success",
359 "value": 400
360 }
361 ],
362 [
363 {
364 "name": "Success",
365 "value": 602
366 }
367 ],
368 [
369 {
370 "name": "hevc",
371 "value": 578
372 },
373 {
374 "name": "h264",
375 "value": 23
376 }
377 ],
378 [
379 {
380 "name": "mkv",
381 "value": 582
382 },
383 {
384 "name": "mp4",
385 "value": 19
386 }
387 ],
388 [
389 {
390 "name": "480p",
391 "value": 15
392 },
393 {
394 "name": "1080p",
395 "value": 527
396 },
397 {
398 "name": "4KUHD",
399 "value": 29
400 },
401 {
402 "name": "720p",
403 "value": 28
404 },
405 {
406 "name": "576p",
407 "value": 2
408 }
409 ],
410 [],
411 []
412 ]
413 ],
414 "streamStats": {
415 "duration": {
416 "average": 3127,
417 "highest": 8548,
418 "total": 253273
419 },
420 "bit_rate": {
421 "average": 2242894,
422 "highest": 20149278,
423 "total": 181674395
424 },
425 "nb_frames": {
426 "average": 75320,
427 "highest": 204941,
428 "total": 6100852
429 }
430 },
431 "avgNumberOfStreamsInVideo": 5.049321824907522,
432 "languages": {
433 "ara": {
434 "count": 181
435 },
436 "est": {
437 "count": 62
438 },
439 "lav": {
440 "count": 62
441 },
442 "may": {
443 "count": 131
444 },
445 "nor": {
446 "count": 110
447 },
448 "chi": {
449 "count": 384
450 },
451 "ind": {
452 "count": 63
453 },
454 "rum": {
455 "count": 138
456 },
457 "nob": {
458 "count": 18
459 },
460 "srp": {
461 "count": 3
462 }
463 },
464 "DBPollPeriod": "1s",
465 "DBFetchTime": "1s",
466 "DBLoadStatus": "Stable",
467 "DBQueue": 0,
468 "processWarning": "",
469 "processWarningQueues": true
470}
diff --git a/src/components/services/Tdarr.vue b/src/components/services/Tdarr.vue
new file mode 100644
index 0000000..a2734f0
--- /dev/null
+++ b/src/components/services/Tdarr.vue
@@ -0,0 +1,125 @@
1<template>
2 <Generic :item="item">
3 <template #indicator>
4 <div class="notifs">
5 <strong
6 v-if="queue > 0"
7 class="notif queue"
8 :title="`${queue} items queued`"
9 >
10 {{ queue }}
11 </strong>
12 <strong
13 v-if="errored > 0"
14 class="notif errored"
15 :title="`${errored} items`"
16 >
17 {{ errored }}
18 </strong>
19 <i
20 v-if="error"
21 class="notif error fa-solid fa-triangle-exclamation"
22 title="Unable to fetch current status"
23 ></i>
24 </div>
25 </template>
26 </Generic>
27</template>
28
29<script>
30import service from "@/mixins/service.js";
31import Generic from "./Generic.vue";
32
33export default {
34 name: "Tdarr",
35 mixins: [service],
36 props: {
37 item: Object,
38 },
39 components: {
40 Generic,
41 },
42 data: () => ({
43 stats: null,
44 error: false,
45 }),
46 computed: {
47 queue: function () {
48 if (!this.stats) {
49 return "";
50 }
51 return this.stats.table1Count;
52 },
53 errored: function () {
54 if (!this.stats) {
55 return "";
56 }
57 return this.stats.table6Count;
58 },
59 },
60 created() {
61 const checkInterval = parseInt(this.item.checkInterval, 10) || 0;
62 if (checkInterval > 0) {
63 setInterval(() => this.fetchStatus(), checkInterval);
64 }
65
66 this.fetchStatus();
67 },
68 methods: {
69 fetchStatus: async function () {
70 try {
71 const options = {
72 method: "POST",
73 headers: {
74 "Content-Type": "application/json",
75 "Accept": "application/json",
76 },
77 body: JSON.stringify({"headers":{"content-Type":"application/json"},"data":{"collection":"StatisticsJSONDB","mode":"getById","docID":"statistics","obj":{}},"timeout":1000}),
78 };
79 const response = await this.fetch(
80 `/api/v2/cruddb`,
81 options
82 );
83 this.error = false;
84 this.stats = response;
85 } catch (e) {
86 this.error = true;
87 console.error(e);
88 }
89 },
90 },
91};
92</script>
93
94<style scoped lang="scss">
95.notifs {
96 position: absolute;
97 color: white;
98 font-family: sans-serif;
99 top: 0.3em;
100 right: 0.5em;
101
102 .notif {
103 display: inline-block;
104 padding: 0.2em 0.35em;
105 border-radius: 0.25em;
106 position: relative;
107 margin-left: 0.3em;
108 font-size: 0.8em;
109
110 &.queue {
111 background-color: #28a9a3;
112 }
113
114 &.errored {
115 background-color: #e51111;
116 }
117
118 &.error {
119 border-radius: 50%;
120 aspect-ratio: 1;
121 background-color: #e51111;
122 }
123 }
124}
125</style>