mirror of
https://github.com/chrisbenincasa/tunarr.git
synced 2026-04-18 09:03:35 -04:00
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
36 lines
1.3 KiB
TypeScript
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>;
|