Added download rate & added dummy-data for SABnzbd

Signed-off-by: Matt Bentley <mbentley@mbentley.net>
pull/661/head
Matt Bentley 2023-06-24 10:41:54 -04:00
parent df903a2c04
commit a842400294
No known key found for this signature in database
GPG Key ID: 0DB8E02112B69FAC
3 changed files with 96 additions and 2 deletions

View File

@ -381,7 +381,8 @@ the "Config" > "General" section of the SABnzbd config in the SABnzbd web UI.
url: "http://192.168.0.151:8080"
type: "SABnzbd"
apikey: "MY-SUPER-SECRET-API-KEY"
downloadInterval: 5000 # (Optional) Interval (in ms) for updating the download count
downloadInterval: 5000 # (Optional) Interval (in ms) for updating the stats
rateDisabled: false
```
## OctoPrint/Moonraker

59
dummy-data/SABnzbd/api Normal file
View File

@ -0,0 +1,59 @@
{
"queue": {
"version": "4.0.2",
"paused": false,
"pause_int": "0",
"paused_all": false,
"diskspace1": "900.28",
"diskspace2": "900.28",
"diskspace1_norm": "900.3 G",
"diskspace2_norm": "900.3 G",
"diskspacetotal1": "901.23",
"diskspacetotal2": "901.23",
"speedlimit": "1",
"speedlimit_abs": "1310720",
"have_warnings": "0",
"finishaction": null,
"quota": "0 ",
"have_quota": false,
"left_quota": "0 ",
"cache_art": "16",
"cache_size": "10.9 MB",
"kbpersec": "1286.74",
"speed": "1.3 M",
"mbleft": "9492.27",
"mb": "11629.75",
"sizeleft": "9.3 GB",
"size": "11.4 GB",
"noofslots_total": 1,
"noofslots": 1,
"start": 0,
"limit": 0,
"finish": 0,
"status": "Downloading",
"timeleft": "2:05:54",
"slots": [
{
"index": 0,
"nzo_id": "SABnzbd_nzo_nviz7k64",
"unpackopts": "3",
"priority": "Force",
"script": "None",
"filename": "test_download_10GB",
"labels": [],
"password": "",
"cat": "*",
"mbleft": "9492.27",
"mb": "11629.75",
"size": "11.4 GB",
"sizeleft": "9.3 GB",
"percentage": "18",
"mbmissing": "0.00",
"direct_unpack": null,
"status": "Downloading",
"timeleft": "2:05:54",
"avg_age": "335d"
}
]
}
}

View File

@ -12,7 +12,21 @@
<i
v-if="error"
class="notif error fa-solid fa-triangle-exclamation"
title="Unable to fetch current status"
title="Unable to fetch current download count"
></i>
</div>
<div class="notifs notifs-down">
<strong
v-if="!this.item.rateDisabled && downloads > 0"
class="notif downloading"
:title="`${downRate}B/s `"
>
{{ downRate }}B/s
</strong>
<i
v-if="error"
class="notif error fa-solid fa-triangle-exclamation"
title="Unable to fetch current download speed"
></i>
</div>
</template>
@ -43,9 +57,24 @@ export default {
}
return this.stats.noofslots;
},
downRate: function() {
if (!this.stats) {
return "";
}
return this.stats.speed;
},
},
created() {
const downloadInterval = parseInt(this.item.downloadInterval, 10) || 0;
const apikey = this.item.apikey;
if (!apikey) {
console.error(
"apikey is not present in config.yml for the SABnzbd entry!"
);
return;
}
if (downloadInterval > 0) {
setInterval(() => this.fetchStatus(), downloadInterval);
}
@ -70,6 +99,11 @@ export default {
</script>
<style scoped lang="scss">
.notifs-down {
top: unset !important;
bottom: 0.3em;
}
.notifs {
position: absolute;
color: white;