From ed5075151838a945b30413c326ff511c3995d4ab Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Thu, 29 Aug 2019 21:26:00 -0400 Subject: [PATCH] Use port value for transmission client --- modules/transmission/settings.go | 4 ++-- modules/transmission/widget.go | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/transmission/settings.go b/modules/transmission/settings.go index 5fc18635..bf5d431a 100644 --- a/modules/transmission/settings.go +++ b/modules/transmission/settings.go @@ -12,7 +12,7 @@ type Settings struct { host string `help:"The address of the machine the Transmission daemon is running on"` https bool `help:"Whether or not to connect to the host via HTTPS"` password string `help:"The password for the Transmission user"` - port int `help:"The port to connect to the Transmission daemon on"` + port uint16 `help:"The port to connect to the Transmission daemon on"` url string `help:"The RPC URI that the daemon is accessible at"` username string `help:"The username of the Transmission user"` } @@ -29,7 +29,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co host: ymlConfig.UString("host"), https: ymlConfig.UBool("https", false), password: ymlConfig.UString("password"), - port: ymlConfig.UInt("port", 9091), + port: uint16(ymlConfig.UInt("port", 9091)), url: ymlConfig.UString("url", "/transmission/"), username: ymlConfig.UString("username", ""), } diff --git a/modules/transmission/widget.go b/modules/transmission/widget.go index 599aba68..5a174aa4 100644 --- a/modules/transmission/widget.go +++ b/modules/transmission/widget.go @@ -35,7 +35,10 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) * widget.KeyboardWidget.SetView(widget.View) // Create a persisten transmission client for use in the calls below - client, err := transmissionrpc.New(widget.settings.host, widget.settings.username, widget.settings.password, nil) + client, err := transmissionrpc.New(widget.settings.host, widget.settings.username, widget.settings.password, + &transmissionrpc.AdvancedConfig{ + Port: widget.settings.port, + }) if err != nil { client = nil }