Files
tunarr/server/src/db/schema/ProgramSubtitles.ts
Christian Benincasa a748408fcc feat!: implement local media libraries (#1406)
Initial implementation of local media libraries. Includes local scanners
for movie and TV library types. Saves extracted metadata locally.

Some things are missing, including:
* Saving all metadata locally, including genres, actors, etc.
* blurhash extraction - this is computationally expensive at scale and
  should be done async
* Hooking up subtitle extraction to new subtitle DB tables
2025-10-14 16:41:58 -04:00

36 lines
1.3 KiB
TypeScript

import type { InferInsertModel, InferSelectModel } from 'drizzle-orm';
import { relations } from 'drizzle-orm';
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
import { Program } from './Program.ts';
export const ProgramSubtitles = sqliteTable('program_subtitles', {
uuid: text().primaryKey(),
subtitleType: text({ enum: ['embedded', 'sidecar'] }).notNull(),
streamIndex: integer(),
codec: text().notNull(),
default: integer({ mode: 'boolean' }).notNull().default(false),
forced: integer({ mode: 'boolean' }).notNull().default(false),
sdh: integer({ mode: 'boolean' }).notNull().default(false),
language: text().notNull(),
path: text(),
programId: text()
.notNull()
.references(() => Program.uuid, { onDelete: 'cascade' }),
createdAt: integer({ mode: 'timestamp_ms' }).notNull(),
updatedAt: integer({ mode: 'timestamp_ms' }).notNull(),
isExtracted: integer({ mode: 'boolean' }).default(false),
});
export const ProgramSubtitlesRelations = relations(
ProgramSubtitles,
({ one }) => ({
program: one(Program, {
fields: [ProgramSubtitles.programId],
references: [Program.uuid],
}),
}),
);
export type ProgramSubtitles = InferSelectModel<typeof ProgramSubtitles>;
export type NewProgramSubtitles = InferInsertModel<typeof ProgramSubtitles>;