Jellyfin: who is watching, and don't update a machine mid-film
New Jellyfin integration (read-only, every 2 minutes): version, restart wanted, streams and transcoding, failed scheduled tasks, item counts, failed sign-ins. Monitoring -> Jellyfin page with a peak-streams history, three alerts, /metrics. When Jellyfin runs on a managed server, an update run asks first if people are streaming (409 "watching" unless startAnyway), and a patch plan waits up to two hours for them before updating that server. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f082ca5c2
commit
0146eb8bca
38 files changed
+8136
-13
No files matched your search
@@ -553,6 +553,7 @@ export const integrationTypes = [
|
||||
"npm",
|
||||
"homeassistant",
|
||||
"ups",
|
||||
"jellyfin",
|
||||
] as const;
|
||||
export type IntegrationType = (typeof integrationTypes)[number];
|
||||
|
||||
@@ -1159,6 +1160,44 @@ export const haReadings = sqliteTable(
|
||||
(t) => [index("ha_readings_lookup_idx").on(t.integrationId, t.entityId, t.at)],
|
||||
);
|
||||
|
||||
// ─── Jellyfin ───────────────────────────────────────────────────────────────
|
||||
|
||||
// How a Jellyfin server (an integration of type "jellyfin") is right now, one row each, replaced at every read: its version, whether it wants a restart, who is streaming, how its
|
||||
// scheduled tasks last ended, and how many sign-ins failed lately. Read by services/jellyfinSync.ts.
|
||||
export const jellyfinState = sqliteTable("jellyfin_state", {
|
||||
integrationId: integer("integration_id")
|
||||
.primaryKey()
|
||||
.references(() => integrations.id, { onDelete: "cascade" }),
|
||||
serverName: text("server_name"),
|
||||
version: text("version"),
|
||||
os: text("os"),
|
||||
pendingRestart: integer("pending_restart", { mode: "boolean" }).notNull().default(false),
|
||||
updateAvailable: integer("update_available", { mode: "boolean" }).notNull().default(false),
|
||||
streams: text("streams").notNull().default("[]"), // JSON: who is streaming what
|
||||
tasks: text("tasks").notNull().default("[]"), // JSON: the scheduled tasks and how they last ended
|
||||
movies: integer("movies"),
|
||||
series: integer("series"),
|
||||
episodes: integer("episodes"),
|
||||
songs: integer("songs"),
|
||||
failedLogins24h: integer("failed_logins_24h"),
|
||||
updatedAt: text("updated_at").notNull(), // ISO
|
||||
});
|
||||
|
||||
// How many were streaming (and how many of those were being transcoded) at a moment, for the chart: one every five minutes, and at once when it changes. Kept 35 days.
|
||||
export const jellyfinReadings = sqliteTable(
|
||||
"jellyfin_readings",
|
||||
{
|
||||
id: integer("id").primaryKey({ autoIncrement: true }),
|
||||
integrationId: integer("integration_id")
|
||||
.notNull()
|
||||
.references(() => integrations.id, { onDelete: "cascade" }),
|
||||
at: text("at").notNull(), // ISO
|
||||
streams: integer("streams").notNull(),
|
||||
transcodes: integer("transcodes").notNull(),
|
||||
},
|
||||
(t) => [index("jellyfin_readings_idx").on(t.integrationId, t.at)],
|
||||
);
|
||||
|
||||
// ─── Duplicati ──────────────────────────────────────────────────────────────
|
||||
|
||||
// A Duplicati that reports to this app: one row per machine running it, with the secret token its reports carry in their address (only the hash is kept). Duplicati pushes a
|
||||
|
||||
Reference in new issue
Block a user