Skip to content

Commit e3fdfb5

Browse files
committed
Added download rate & added dummy-data for SABnzbd
Signed-off-by: Matt Bentley <[email protected]>
1 parent df903a2 commit e3fdfb5

File tree

3 files changed

+96
-2
lines changed

3 files changed

+96
-2
lines changed

docs/customservices.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ the "Config" > "General" section of the SABnzbd config in the SABnzbd web UI.
381381
url: "http://192.168.0.151:8080"
382382
type: "SABnzbd"
383383
apikey: "MY-SUPER-SECRET-API-KEY"
384-
downloadInterval: 5000 # (Optional) Interval (in ms) for updating the download count
384+
downloadInterval: 5000 # (Optional) Interval (in ms) for updating the stats
385+
rateDisabled: false
385386
```
386387

387388
## OctoPrint/Moonraker

dummy-data/SABnzbd/api

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"queue": {
3+
"version": "4.0.2",
4+
"paused": false,
5+
"pause_int": "0",
6+
"paused_all": false,
7+
"diskspace1": "900.28",
8+
"diskspace2": "900.28",
9+
"diskspace1_norm": "900.3 G",
10+
"diskspace2_norm": "900.3 G",
11+
"diskspacetotal1": "901.23",
12+
"diskspacetotal2": "901.23",
13+
"speedlimit": "1",
14+
"speedlimit_abs": "1310720",
15+
"have_warnings": "0",
16+
"finishaction": null,
17+
"quota": "0 ",
18+
"have_quota": false,
19+
"left_quota": "0 ",
20+
"cache_art": "16",
21+
"cache_size": "10.9 MB",
22+
"kbpersec": "1286.74",
23+
"speed": "1.3 M",
24+
"mbleft": "9492.27",
25+
"mb": "11629.75",
26+
"sizeleft": "9.3 GB",
27+
"size": "11.4 GB",
28+
"noofslots_total": 1,
29+
"noofslots": 1,
30+
"start": 0,
31+
"limit": 0,
32+
"finish": 0,
33+
"status": "Downloading",
34+
"timeleft": "2:05:54",
35+
"slots": [
36+
{
37+
"index": 0,
38+
"nzo_id": "SABnzbd_nzo_nviz7k64",
39+
"unpackopts": "3",
40+
"priority": "Force",
41+
"script": "None",
42+
"filename": "test_download_10GB",
43+
"labels": [],
44+
"password": "",
45+
"cat": "*",
46+
"mbleft": "9492.27",
47+
"mb": "11629.75",
48+
"size": "11.4 GB",
49+
"sizeleft": "9.3 GB",
50+
"percentage": "18",
51+
"mbmissing": "0.00",
52+
"direct_unpack": null,
53+
"status": "Downloading",
54+
"timeleft": "2:05:54",
55+
"avg_age": "335d"
56+
}
57+
]
58+
}
59+
}

src/components/services/SABnzbd.vue

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,21 @@
1212
<i
1313
v-if="error"
1414
class="notif error fa-solid fa-triangle-exclamation"
15-
title="Unable to fetch current status"
15+
title="Unable to fetch current download count"
16+
></i>
17+
</div>
18+
<div class="notifs notifs-down">
19+
<strong
20+
v-if="!this.item.rateDisabled"
21+
class="notif downloading"
22+
:title="`${downRate}B/s `"
23+
>
24+
{{ downRate }}B/s
25+
</strong>
26+
<i
27+
v-if="error"
28+
class="notif error fa-solid fa-triangle-exclamation"
29+
title="Unable to fetch current download speed"
1630
></i>
1731
</div>
1832
</template>
@@ -43,9 +57,24 @@ export default {
4357
}
4458
return this.stats.noofslots;
4559
},
60+
downRate: function() {
61+
if (!this.stats) {
62+
return "";
63+
}
64+
return this.stats.speed;
65+
},
4666
},
4767
created() {
4868
const downloadInterval = parseInt(this.item.downloadInterval, 10) || 0;
69+
const apikey = this.item.apikey;
70+
71+
if (!apikey) {
72+
console.error(
73+
"apikey is not present in config.yml for the SABnzbd entry!"
74+
);
75+
return;
76+
}
77+
4978
if (downloadInterval > 0) {
5079
setInterval(() => this.fetchStatus(), downloadInterval);
5180
}
@@ -70,6 +99,11 @@ export default {
7099
</script>
71100

72101
<style scoped lang="scss">
102+
.notifs-down {
103+
top: unset !important;
104+
bottom: 0.3em;
105+
}
106+
73107
.notifs {
74108
position: absolute;
75109
color: white;

0 commit comments

Comments
 (0)