- type: custom-api title: qBittorrent cache: 10s options: view: "basic" # "basic" or "detailed" mode: "default" # "default" or "upload" subrequests: transfer: url: http://192.168.50.108:8080/api/v2/transfer/info seeding: url: http://192.168.50.108:8080/api/v2/torrents/info parameters: filter: seeding leeching: url: http://192.168.50.108:8080/api/v2/torrents/info parameters: filter: downloading template: | {{ $transfer := .Subrequest "transfer" }} {{ $seeding := .Subrequest "seeding" }} {{ $leeching := .Subrequest "leeching" }} {{ if and (eq $transfer.Response.StatusCode 200) (eq $seeding.Response.StatusCode 200) (eq $leeching.Response.StatusCode 200) }} {{ $isDetailed := eq (.Options.StringOr "view" "detailed") "detailed" }} {{ $mode := .Options.StringOr "mode" "default" }} {{ if $isDetailed }}
{{ $dlSpeed := $transfer.JSON.Float "dl_info_speed" }} {{ if eq $mode "upload" }}
{{ printf "%.1f MB/s" (div $dlSpeed 1000000.0) }}
{{ else }} {{ if lt $dlSpeed 1048576.0 }}
{{ printf "%.0f KiB/s" (div $dlSpeed 1024.0) }}
{{ else }}
{{ printf "%.1f MiB/s" (div $dlSpeed 1048576.0) }}
{{ end }} {{ end }}
DOWNLOADING
{{ if eq $mode "upload" }}
{{ $ulSpeed := $transfer.JSON.Float "up_info_speed" }}
{{ printf "%.1f MB/s" (div $ulSpeed 1000000.0) }}
UPLOADING
{{ end }}
{{ len ($seeding.JSON.Array "") }}
SEEDING
{{ if eq $mode "default" }}
{{ len ($leeching.JSON.Array "") }}
LEECHING
{{ end }}
{{ $downloadingTorrents := $leeching.JSON.Array "" }} {{ if gt (len $downloadingTorrents) 0 }}
{{ end }} {{ if eq $mode "upload" }} {{ $seedingTorrents := $seeding.JSON.Array "" }} {{ if gt (len $seedingTorrents) 0 }}
{{ end }} {{ end }}
{{ else }}
{{ $dlSpeed := $transfer.JSON.Float "dl_info_speed" }}
{{ printf "%.1f MB/s" (div $dlSpeed 1000000.0) }}
DOWNLOADING
{{ if eq $mode "upload" }}
{{ $ulSpeed := $transfer.JSON.Float "up_info_speed" }}
{{ printf "%.1f MB/s" (div $ulSpeed 1000000.0) }}
UPLOADING
{{ end }}
{{ len ($seeding.JSON.Array "") }}
SEEDING
{{ if eq $mode "default" }}
{{ len ($leeching.JSON.Array "") }}
LEECHING
{{ end }}
{{ end }} {{ else }}

Error fetching qBittorrent data.

Check URL and authentication bypass settings.

{{ end }}