0.2.72 - Magic button, Next up fixes

This commit is contained in:
ponzischeme89
2026-08-17 11:41:36 +12:00
parent 36cb1324fd
commit 12b27c77c3
2655 changed files with 5435 additions and 254 deletions
+13 -1
View File
@@ -41,6 +41,10 @@ type embyHealthState struct {
checkedAt time.Time
retryEvery time.Duration
consecutive int
// version is what Emby last said it was. Kept across a failed probe on purpose: the
// About page reads it, and blanking it during an outage would replace a fact that is
// still true with nothing.
version string
}
func (h *embyHealth) get() embyHealthState {
@@ -60,10 +64,13 @@ func (h *embyHealth) begin(interval time.Duration, now time.Time) {
}
// record folds one probe result in and reports whether the published verdict changed.
func (h *embyHealth) record(ok bool, now time.Time) {
func (h *embyHealth) record(ok bool, version string, now time.Time) {
h.mu.Lock()
defer h.mu.Unlock()
h.state.checkedAt = now
if version != "" {
h.state.version = version
}
if ok {
h.state.consecutive = 0
if !h.state.reachable {
@@ -90,6 +97,10 @@ type embyHealthPayload struct {
Since string `json:"since,omitempty"`
CheckedAt string `json:"checkedAt,omitempty"`
RetrySeconds int `json:"retrySeconds"`
// Version is Emby's own, for the television's About page. Omitted rather than sent
// empty, so a client can tell "not known yet" from "known to be blank" — the first
// probe may not have completed, and with the probe switched off none ever will.
Version string `json:"version,omitempty"`
}
func embyHealthFor(state embyHealthState) embyHealthPayload {
@@ -97,6 +108,7 @@ func embyHealthFor(state embyHealthState) embyHealthPayload {
Monitored: state.monitored,
Reachable: state.reachable || !state.monitored,
RetrySeconds: int(state.retryEvery / time.Second),
Version: state.version,
}
if !state.since.IsZero() {
payload.Since = state.since.UTC().Format(time.RFC3339)