0.2.59 - Settings save fixes

This commit is contained in:
ponzischeme89
2026-08-12 15:39:08 +12:00
parent 613f203cf9
commit 4fb68f4bbc
14 changed files with 227 additions and 25 deletions
+20
View File
@@ -452,6 +452,10 @@ type heroItemFacts struct {
Type string
Premiere time.Time
Playable bool
// Watched is Emby's own answer for this viewer. The rows are fetched per person and
// carry their user data, so it costs nothing to read.
Watched bool
}
func heroFactsOf(raw json.RawMessage) (heroItemFacts, bool) {
@@ -462,6 +466,9 @@ func heroFactsOf(raw json.RawMessage) (heroItemFacts, bool) {
PremiereDate string `json:"PremiereDate"`
Source string `json:"MembySource"`
Playable *bool `json:"MembyPlayable"`
UserData struct {
Played bool `json:"Played"`
} `json:"UserData"`
}
if json.Unmarshal(raw, &payload) != nil || strings.TrimSpace(payload.ID) == "" {
return heroItemFacts{}, false
@@ -474,6 +481,7 @@ func heroFactsOf(raw json.RawMessage) (heroItemFacts, bool) {
// Anything from Emby carries neither field, and is.
Playable: strings.TrimSpace(payload.Source) == "" &&
(payload.Playable == nil || *payload.Playable),
Watched: payload.UserData.Played,
}
if parsed, err := parseEmbyDate(payload.PremiereDate); err == nil {
facts.Premiere = parsed
@@ -837,6 +845,18 @@ func heroMovieCandidates(rows []recommend.Row) ([]heroCandidate, map[string]hero
!strings.EqualFold(fact.Type, "Movie") {
continue
}
// A film somebody has already seen is not something to lead the launcher
// with: the hero exists to be pressed, and the answer to "watch this
// tonight" cannot be a film that finished last week. It is only ever the
// whole title here — a film halfway through belongs to Continue Watching,
// which is not a candidate row at all.
//
// Series are deliberately not filtered this way. A show marked watched is
// one somebody is up to date with, which is exactly who a season premiere
// is news for, and premieres come from Sonarr rather than from here.
if fact.Watched {
continue
}
seen[fact.ID] = true
facts[fact.ID] = fact
rating, rated := heroRatingOf(raw)