diff --git a/backend/servermanager.go b/backend/servermanager.go index 042943e..0e8483d 100644 --- a/backend/servermanager.go +++ b/backend/servermanager.go @@ -3,6 +3,7 @@ package backend import ( "context" "errors" + "log" "net/http" "time" @@ -161,21 +162,22 @@ func (s *ServerManager) connect(connection ServerConnection, password string) (m var cli, altCli mediaprovider.Server if connection.ServerType == ServerTypeJellyfin { + client, err := jellyfin.NewClient(connection.Hostname, res.AppName, res.AppVersion, jellyfin.WithTimeout(10*time.Second)) + if err != nil { + log.Print("Error creating Jellyfin client") + return nil, err + } cli = &jellyfinMP.JellyfinServer{ - Client: jellyfin.Client{ - HTTPClient: &http.Client{Timeout: 10 * time.Second}, - BaseURL: connection.Hostname, - ClientName: res.AppName, - ClientVersion: res.AppVersion, - }, + Client: *client, + } + + altClient, err := jellyfin.NewClient(connection.AltHostname, res.AppName, res.AppVersion, jellyfin.WithTimeout(10*time.Second)) + if err != nil { + log.Print("Error creating Jellyfin alternative client") + return nil, err } altCli = &jellyfinMP.JellyfinServer{ - Client: jellyfin.Client{ - HTTPClient: &http.Client{Timeout: 10 * time.Second}, - BaseURL: connection.AltHostname, - ClientName: res.AppName, - ClientVersion: res.AppVersion, - }, + Client: *altClient, } } else { cli = &subsonicMP.SubsonicServer{ diff --git a/go.mod b/go.mod index 0376039..a386531 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( fyne.io/fyne/v2 v2.4.4 github.com/20after4/configdir v0.1.1 github.com/deluan/sanitize v0.0.0-20230310221930-6e18967d9fc1 - github.com/dweymouth/go-jellyfin v0.0.0-20231116161116-e800860bdacc + github.com/dweymouth/go-jellyfin v0.0.0-20240324234906-fd6aa188b773 github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee github.com/dweymouth/go-subsonic v0.0.0-20240305034202-6193dca1c9de github.com/fsnotify/fsnotify v1.6.0 @@ -40,7 +40,7 @@ require ( github.com/stretchr/testify v1.8.4 // indirect github.com/tevino/abool v1.2.0 // indirect github.com/yuin/goldmark v1.5.5 // indirect - golang.org/x/image v0.14.0 // indirect + golang.org/x/image v0.15.0 // indirect golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda // indirect golang.org/x/sys v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 2f86d86..a598e6e 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,8 @@ github.com/deluan/sanitize v0.0.0-20230310221930-6e18967d9fc1 h1:mGvOb3zxl4vCLv+ github.com/deluan/sanitize v0.0.0-20230310221930-6e18967d9fc1/go.mod h1:ZNCLJfehvEf34B7BbLKjgpsL9lyW7q938w/GY1XgV4E= github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20240313160419-e8b6f75cfa12 h1:fCY8VgSZMau2383XeRkVhQHIm+mgWSpuldDKHYD+HG4= github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20240313160419-e8b6f75cfa12/go.mod h1:VyrxAOZ3NRZRWBvNIJbfqoKOG4DdbewoPk7ozqJKNPY= -github.com/dweymouth/go-jellyfin v0.0.0-20231116161116-e800860bdacc h1:wJy4U12Ys5Jgt08dgh5AW4suRZgKTwI1PUEmDu8aOmY= -github.com/dweymouth/go-jellyfin v0.0.0-20231116161116-e800860bdacc/go.mod h1:BMwS4vdjEYf1gmjPGSKCzWP/I6YlI6fkefJ9nsjBjaU= +github.com/dweymouth/go-jellyfin v0.0.0-20240324234906-fd6aa188b773 h1:nM5gPfIvwIIhz28TzYQZE09N0lmQp9E8pJVm2sI1Wnc= +github.com/dweymouth/go-jellyfin v0.0.0-20240324234906-fd6aa188b773/go.mod h1:fcUagHBaQnt06GmBAllNE0J4O/7064zXRWdqnTTtVjI= github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee h1:ZGyJ6wp7CAfT31BugypcF/TPKEy2RrGR9JFq1JOjOpY= github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee/go.mod h1:Ov0ieN90M7i+0k3OxhA/g1dozGs+UcPHDsMKqPgRDk0= github.com/dweymouth/go-subsonic v0.0.0-20240305034202-6193dca1c9de h1:RVYHvjT01YSLphWlTA/uaGtfVp2x6/4UfOIYYp9vMis= @@ -339,8 +339,8 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.13.0/go.mod h1:6mmbMOeV28HuMTgA6OSRkdXKYw/t5W9Uwn2Yv1r3Yxk= -golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4= -golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= +golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= +golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=