Get stats from a remote Transmission instance
Go to file
Jeffrey Serio 3585533a81 Update css stylesheet path 2023-08-21 02:02:50 -05:00
html Update css stylesheet path 2023-08-21 02:02:50 -05:00
LICENSE Initial commit 2023-03-24 23:14:51 -05:00
README.md Add support for Gemini files 2023-03-26 06:38:37 -05:00
go.mod Use hyperreal64's transmissionrpc 2023-07-19 11:35:00 -05:00
go.sum Use hyperreal64's transmissionrpc 2023-07-19 11:35:00 -05:00
main.go Remove AdvancedConfig 2023-07-24 19:46:49 -05:00

README.md

go-transmission-stats

Get stats from a remote Transmission instance using the Transmission RPC API, and output the stats into a HTML document using Go's html/template library.

For other people using this, change the stylesheet in template.html to your preferred one. Also edit the following for your remote Transmission instance:

export RPC_HOST="<ip address of Transmission server>"
export RPC_USER="<rpc username>"
export RPC_PASSWORD="<rpc password>"
export HTML_FILE="/path/to/html/output/file.html"
export GMI_FILE="/path/to/gemini/output/file.gmi"

My personal use case for this involves running the Go binary go-transmission-stats on a systemd timer that triggers the corresponding service every 12 hours.

First build the binary:

git clone https://codeberg.org/hyperreal/go-transmission-stats
cd go-transmission-stats
go build

Move the binary to a location in PATH:

sudo mv go-transmission-stats /usr/local/bin/

Create the systemd service:

[Unit]
Description=go-transmission-stats service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/go-transmission-stats
User=<your user>
Group=<your user's group>
WorkingDirectory=/home/user/go-transmission-stats
Environment="RPC_HOST=<ip address of Transmission server>"
Environment="RPC_USER=<rpc username>"
Environment="RPC_PASSWORD=<rpc password>"
Environment="HTML_FILE=/path/to/html/output/file.html"
Environment="GMI_FILE=/path/to/gemini/output/file.gmi"

Create the systemd timer:

[Unit]
Description=go-transmission-stats timer

[Timer]
OnCalendar=00/12:00

[Install]
WantedBy=default.target

Move the files to systemd directory and enable the systemd timer:

sudo mv go-transmission-stats.service go-transmission-stats.timer /etc/systemd/system/
sudo systemctl enable --now go-transmission-stats.timer