0.2.72 - Magic button, Next up fixes
This commit is contained in:
@@ -720,14 +720,28 @@ func (c *Client) SubtitleURL(cred Credentials, itemID, mediaSourceID string, ind
|
||||
return c.DeliveryURL(cred, path)
|
||||
}
|
||||
|
||||
// Ping checks that Emby is reachable, for readiness probes.
|
||||
func (c *Client) Ping(ctx context.Context) error {
|
||||
// Ping checks that Emby is reachable, for readiness probes, and reports the version it
|
||||
// answered with.
|
||||
//
|
||||
// The version is read off the reply the probe was already making rather than through a
|
||||
// call of its own: `/System/Info/Public` carries it, this runs on a timer against a server
|
||||
// whose version changes a few times a year, and a second request per probe to learn a
|
||||
// string that rarely moves would be the wrong trade. An Emby that answers without one
|
||||
// returns an empty version and no error — reachability is what this is for, and refusing a
|
||||
// probe over a missing field would report a working server as down.
|
||||
func (c *Client) Ping(ctx context.Context) (string, error) {
|
||||
req, err := c.newRequest(ctx, http.MethodGet, "/System/Info/Public", nil,
|
||||
Credentials{Gateway: true}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
return c.do(req, nil)
|
||||
var info struct {
|
||||
Version string `json:"Version"`
|
||||
}
|
||||
if err := c.do(req, &info); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return info.Version, nil
|
||||
}
|
||||
|
||||
func (c *Client) items(ctx context.Context, cred Credentials, path string, params url.Values) (*ItemsResult, error) {
|
||||
|
||||
Reference in New Issue
Block a user