jukebox-media-server 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/client/assets/Watch-DNFM488K.js +203 -0
- package/dist/client/assets/index-BYBYJ0kS.css +1 -0
- package/dist/client/assets/index-COFfIwFC.js +58 -0
- package/dist/client/assets/workbox-window.prod.es5-BIl4cyR9.js +2 -0
- package/dist/client/index.html +24 -4
- package/dist/client/{images/site.webmanifest → manifest.webmanifest} +9 -6
- package/dist/client/offline.html +107 -0
- package/dist/client/sw.js +1 -0
- package/dist/client/workbox-d3da0cfa.js +1 -0
- package/dist/server/index.js +2997 -239
- package/drizzle/0001_steady_puma.sql +1 -1
- package/drizzle/0003_public_speedball.sql +42 -0
- package/drizzle/0004_motionless_bug.sql +13 -0
- package/drizzle/0005_settings_table.sql +5 -0
- package/drizzle/0006_watch_progress_cascade.sql +20 -0
- package/drizzle/0007_scan_jobs.sql +10 -0
- package/drizzle/0008_search_fts.sql +154 -0
- package/drizzle/0009_subtitles.sql +10 -0
- package/drizzle/meta/0003_snapshot.json +804 -0
- package/drizzle/meta/0004_snapshot.json +880 -0
- package/drizzle/meta/0005_snapshot.json +911 -0
- package/drizzle/meta/0006_snapshot.json +911 -0
- package/drizzle/meta/0007_snapshot.json +980 -0
- package/drizzle/meta/0008_snapshot.json +980 -0
- package/drizzle/meta/0009_snapshot.json +1059 -0
- package/drizzle/meta/_journal.json +49 -0
- package/package.json +7 -2
- package/dist/client/assets/Watch-CXouQzhW.js +0 -203
- package/dist/client/assets/index-Bxm6Lfvp.css +0 -1
- package/dist/client/assets/index-Db82pRvr.js +0 -52
|
@@ -59,7 +59,7 @@ CREATE TABLE `__new_watch_progress` (
|
|
|
59
59
|
FOREIGN KEY (`episode_id`) REFERENCES `episodes`(`id`) ON UPDATE no action ON DELETE no action
|
|
60
60
|
);
|
|
61
61
|
--> statement-breakpoint
|
|
62
|
-
INSERT INTO `__new_watch_progress`("id", "movie_id", "episode_id", "current_time", "duration", "updated_at") SELECT "id", "movie_id",
|
|
62
|
+
INSERT INTO `__new_watch_progress`("id", "movie_id", "episode_id", "current_time", "duration", "updated_at") SELECT "id", "movie_id", NULL, "current_time", "duration", "updated_at" FROM `watch_progress`;--> statement-breakpoint
|
|
63
63
|
DROP TABLE `watch_progress`;--> statement-breakpoint
|
|
64
64
|
ALTER TABLE `__new_watch_progress` RENAME TO `watch_progress`;--> statement-breakpoint
|
|
65
65
|
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
CREATE TABLE `profiles` (
|
|
2
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
+
`name` text NOT NULL,
|
|
4
|
+
`emoji` text NOT NULL,
|
|
5
|
+
`created_at` integer NOT NULL
|
|
6
|
+
);
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
CREATE UNIQUE INDEX `profiles_name_unique` ON `profiles` (`name`);--> statement-breakpoint
|
|
9
|
+
INSERT INTO `profiles` (`id`, `name`, `emoji`, `created_at`) VALUES (1, 'Default', '🍿', unixepoch());--> statement-breakpoint
|
|
10
|
+
CREATE TABLE `favorites` (
|
|
11
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
12
|
+
`profile_id` integer NOT NULL,
|
|
13
|
+
`movie_id` integer,
|
|
14
|
+
`show_id` integer,
|
|
15
|
+
`created_at` integer NOT NULL,
|
|
16
|
+
FOREIGN KEY (`profile_id`) REFERENCES `profiles`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
17
|
+
FOREIGN KEY (`movie_id`) REFERENCES `movies`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
18
|
+
FOREIGN KEY (`show_id`) REFERENCES `shows`(`id`) ON UPDATE no action ON DELETE cascade
|
|
19
|
+
);
|
|
20
|
+
--> statement-breakpoint
|
|
21
|
+
CREATE UNIQUE INDEX `favorites_profile_movie_idx` ON `favorites` (`profile_id`,`movie_id`);--> statement-breakpoint
|
|
22
|
+
CREATE UNIQUE INDEX `favorites_profile_show_idx` ON `favorites` (`profile_id`,`show_id`);--> statement-breakpoint
|
|
23
|
+
CREATE TABLE `__new_watch_progress` (
|
|
24
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
25
|
+
`profile_id` integer NOT NULL,
|
|
26
|
+
`movie_id` integer,
|
|
27
|
+
`episode_id` integer,
|
|
28
|
+
`current_time` integer NOT NULL,
|
|
29
|
+
`duration` integer,
|
|
30
|
+
`updated_at` integer NOT NULL,
|
|
31
|
+
FOREIGN KEY (`profile_id`) REFERENCES `profiles`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
32
|
+
FOREIGN KEY (`movie_id`) REFERENCES `movies`(`id`) ON UPDATE no action ON DELETE no action,
|
|
33
|
+
FOREIGN KEY (`episode_id`) REFERENCES `episodes`(`id`) ON UPDATE no action ON DELETE no action
|
|
34
|
+
);
|
|
35
|
+
--> statement-breakpoint
|
|
36
|
+
INSERT INTO `__new_watch_progress` (`id`, `profile_id`, `movie_id`, `episode_id`, `current_time`, `duration`, `updated_at`)
|
|
37
|
+
SELECT `id`, 1, `movie_id`, `episode_id`, `current_time`, `duration`, `updated_at` FROM `watch_progress`;
|
|
38
|
+
--> statement-breakpoint
|
|
39
|
+
DROP TABLE `watch_progress`;--> statement-breakpoint
|
|
40
|
+
ALTER TABLE `__new_watch_progress` RENAME TO `watch_progress`;--> statement-breakpoint
|
|
41
|
+
CREATE UNIQUE INDEX `watch_progress_profile_movie_idx` ON `watch_progress` (`profile_id`,`movie_id`);--> statement-breakpoint
|
|
42
|
+
CREATE UNIQUE INDEX `watch_progress_profile_episode_idx` ON `watch_progress` (`profile_id`,`episode_id`);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE `auth_config` (
|
|
2
|
+
`id` integer PRIMARY KEY NOT NULL,
|
|
3
|
+
`password_hash` text,
|
|
4
|
+
`updated_at` integer NOT NULL
|
|
5
|
+
);
|
|
6
|
+
--> statement-breakpoint
|
|
7
|
+
CREATE TABLE `sessions` (
|
|
8
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
9
|
+
`created_at` integer NOT NULL,
|
|
10
|
+
`expires_at` integer NOT NULL,
|
|
11
|
+
`last_seen_at` integer NOT NULL,
|
|
12
|
+
`user_agent` text
|
|
13
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_watch_progress` (
|
|
3
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
4
|
+
`profile_id` integer NOT NULL,
|
|
5
|
+
`movie_id` integer,
|
|
6
|
+
`episode_id` integer,
|
|
7
|
+
`current_time` integer NOT NULL,
|
|
8
|
+
`duration` integer,
|
|
9
|
+
`updated_at` integer NOT NULL,
|
|
10
|
+
FOREIGN KEY (`profile_id`) REFERENCES `profiles`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
11
|
+
FOREIGN KEY (`movie_id`) REFERENCES `movies`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
12
|
+
FOREIGN KEY (`episode_id`) REFERENCES `episodes`(`id`) ON UPDATE no action ON DELETE cascade
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
INSERT INTO `__new_watch_progress`("id", "profile_id", "movie_id", "episode_id", "current_time", "duration", "updated_at") SELECT "id", "profile_id", "movie_id", "episode_id", "current_time", "duration", "updated_at" FROM `watch_progress`;--> statement-breakpoint
|
|
16
|
+
DROP TABLE `watch_progress`;--> statement-breakpoint
|
|
17
|
+
ALTER TABLE `__new_watch_progress` RENAME TO `watch_progress`;--> statement-breakpoint
|
|
18
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
19
|
+
CREATE UNIQUE INDEX `watch_progress_profile_movie_idx` ON `watch_progress` (`profile_id`,`movie_id`);--> statement-breakpoint
|
|
20
|
+
CREATE UNIQUE INDEX `watch_progress_profile_episode_idx` ON `watch_progress` (`profile_id`,`episode_id`);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
CREATE TABLE `scan_jobs` (
|
|
2
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
+
`started_at` integer NOT NULL,
|
|
4
|
+
`ended_at` integer,
|
|
5
|
+
`status` text NOT NULL,
|
|
6
|
+
`added` integer DEFAULT 0 NOT NULL,
|
|
7
|
+
`updated` integer DEFAULT 0 NOT NULL,
|
|
8
|
+
`total` integer DEFAULT 0 NOT NULL,
|
|
9
|
+
`error_message` text
|
|
10
|
+
);
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
-- Full-text search across movies, shows, and episodes via SQLite FTS5.
|
|
2
|
+
--
|
|
3
|
+
-- We use external-content virtual tables (content='<source>',
|
|
4
|
+
-- content_rowid='rowid') so the FTS tables don't duplicate the underlying
|
|
5
|
+
-- title/overview text. Triggers keep the FTS shadow tables in sync with the
|
|
6
|
+
-- real source tables on every INSERT, UPDATE, and DELETE.
|
|
7
|
+
--
|
|
8
|
+
-- Episodes also need to match against the parent show title, which FTS5 can't
|
|
9
|
+
-- JOIN on. Triggers on `episodes` resolve `shows.title` at write time and
|
|
10
|
+
-- store it in the episodes_fts virtual table as a third column.
|
|
11
|
+
|
|
12
|
+
CREATE VIRTUAL TABLE `movies_fts` USING fts5(
|
|
13
|
+
title,
|
|
14
|
+
overview,
|
|
15
|
+
genres,
|
|
16
|
+
content='movies',
|
|
17
|
+
content_rowid='rowid'
|
|
18
|
+
);
|
|
19
|
+
--> statement-breakpoint
|
|
20
|
+
|
|
21
|
+
CREATE VIRTUAL TABLE `shows_fts` USING fts5(
|
|
22
|
+
title,
|
|
23
|
+
overview,
|
|
24
|
+
genres,
|
|
25
|
+
content='shows',
|
|
26
|
+
content_rowid='rowid'
|
|
27
|
+
);
|
|
28
|
+
--> statement-breakpoint
|
|
29
|
+
|
|
30
|
+
CREATE VIRTUAL TABLE `episodes_fts` USING fts5(
|
|
31
|
+
title,
|
|
32
|
+
overview,
|
|
33
|
+
show_title,
|
|
34
|
+
content='episodes',
|
|
35
|
+
content_rowid='rowid'
|
|
36
|
+
);
|
|
37
|
+
--> statement-breakpoint
|
|
38
|
+
|
|
39
|
+
CREATE TRIGGER `movies_fts_insert` AFTER INSERT ON `movies` BEGIN
|
|
40
|
+
INSERT INTO `movies_fts`(rowid, title, overview, genres)
|
|
41
|
+
VALUES (NEW.rowid, NEW.title, NEW.overview, NEW.genres);
|
|
42
|
+
END;
|
|
43
|
+
--> statement-breakpoint
|
|
44
|
+
|
|
45
|
+
CREATE TRIGGER `movies_fts_delete` AFTER DELETE ON `movies` BEGIN
|
|
46
|
+
INSERT INTO `movies_fts`(`movies_fts`, rowid, title, overview, genres)
|
|
47
|
+
VALUES ('delete', OLD.rowid, OLD.title, OLD.overview, OLD.genres);
|
|
48
|
+
END;
|
|
49
|
+
--> statement-breakpoint
|
|
50
|
+
|
|
51
|
+
CREATE TRIGGER `movies_fts_update` AFTER UPDATE ON `movies` BEGIN
|
|
52
|
+
INSERT INTO `movies_fts`(`movies_fts`, rowid, title, overview, genres)
|
|
53
|
+
VALUES ('delete', OLD.rowid, OLD.title, OLD.overview, OLD.genres);
|
|
54
|
+
INSERT INTO `movies_fts`(rowid, title, overview, genres)
|
|
55
|
+
VALUES (NEW.rowid, NEW.title, NEW.overview, NEW.genres);
|
|
56
|
+
END;
|
|
57
|
+
--> statement-breakpoint
|
|
58
|
+
|
|
59
|
+
CREATE TRIGGER `shows_fts_insert` AFTER INSERT ON `shows` BEGIN
|
|
60
|
+
INSERT INTO `shows_fts`(rowid, title, overview, genres)
|
|
61
|
+
VALUES (NEW.rowid, NEW.title, NEW.overview, NEW.genres);
|
|
62
|
+
END;
|
|
63
|
+
--> statement-breakpoint
|
|
64
|
+
|
|
65
|
+
CREATE TRIGGER `shows_fts_delete` AFTER DELETE ON `shows` BEGIN
|
|
66
|
+
INSERT INTO `shows_fts`(`shows_fts`, rowid, title, overview, genres)
|
|
67
|
+
VALUES ('delete', OLD.rowid, OLD.title, OLD.overview, OLD.genres);
|
|
68
|
+
END;
|
|
69
|
+
--> statement-breakpoint
|
|
70
|
+
|
|
71
|
+
CREATE TRIGGER `shows_fts_update` AFTER UPDATE ON `shows` BEGIN
|
|
72
|
+
INSERT INTO `shows_fts`(`shows_fts`, rowid, title, overview, genres)
|
|
73
|
+
VALUES ('delete', OLD.rowid, OLD.title, OLD.overview, OLD.genres);
|
|
74
|
+
INSERT INTO `shows_fts`(rowid, title, overview, genres)
|
|
75
|
+
VALUES (NEW.rowid, NEW.title, NEW.overview, NEW.genres);
|
|
76
|
+
END;
|
|
77
|
+
--> statement-breakpoint
|
|
78
|
+
|
|
79
|
+
CREATE TRIGGER `episodes_fts_insert` AFTER INSERT ON `episodes` BEGIN
|
|
80
|
+
INSERT INTO `episodes_fts`(rowid, title, overview, show_title)
|
|
81
|
+
VALUES (
|
|
82
|
+
NEW.rowid,
|
|
83
|
+
NEW.title,
|
|
84
|
+
NEW.overview,
|
|
85
|
+
(SELECT `title` FROM `shows` WHERE `id` = NEW.show_id)
|
|
86
|
+
);
|
|
87
|
+
END;
|
|
88
|
+
--> statement-breakpoint
|
|
89
|
+
|
|
90
|
+
CREATE TRIGGER `episodes_fts_delete` AFTER DELETE ON `episodes` BEGIN
|
|
91
|
+
INSERT INTO `episodes_fts`(`episodes_fts`, rowid, title, overview, show_title)
|
|
92
|
+
VALUES (
|
|
93
|
+
'delete',
|
|
94
|
+
OLD.rowid,
|
|
95
|
+
OLD.title,
|
|
96
|
+
OLD.overview,
|
|
97
|
+
(SELECT `title` FROM `shows` WHERE `id` = OLD.show_id)
|
|
98
|
+
);
|
|
99
|
+
END;
|
|
100
|
+
--> statement-breakpoint
|
|
101
|
+
|
|
102
|
+
CREATE TRIGGER `episodes_fts_update` AFTER UPDATE ON `episodes` BEGIN
|
|
103
|
+
INSERT INTO `episodes_fts`(`episodes_fts`, rowid, title, overview, show_title)
|
|
104
|
+
VALUES (
|
|
105
|
+
'delete',
|
|
106
|
+
OLD.rowid,
|
|
107
|
+
OLD.title,
|
|
108
|
+
OLD.overview,
|
|
109
|
+
(SELECT `title` FROM `shows` WHERE `id` = OLD.show_id)
|
|
110
|
+
);
|
|
111
|
+
INSERT INTO `episodes_fts`(rowid, title, overview, show_title)
|
|
112
|
+
VALUES (
|
|
113
|
+
NEW.rowid,
|
|
114
|
+
NEW.title,
|
|
115
|
+
NEW.overview,
|
|
116
|
+
(SELECT `title` FROM `shows` WHERE `id` = NEW.show_id)
|
|
117
|
+
);
|
|
118
|
+
END;
|
|
119
|
+
--> statement-breakpoint
|
|
120
|
+
|
|
121
|
+
-- When a show's title changes, refresh the show_title column on every
|
|
122
|
+
-- matching episode_fts row. We can't use 'rebuild' here because
|
|
123
|
+
-- episodes_fts is external-content backed by `episodes`, which doesn't
|
|
124
|
+
-- know about the show title — so we issue a manual delete/insert per
|
|
125
|
+
-- affected episode rowid.
|
|
126
|
+
CREATE TRIGGER `episodes_fts_show_title_update` AFTER UPDATE OF `title` ON `shows` BEGIN
|
|
127
|
+
INSERT INTO `episodes_fts`(`episodes_fts`, rowid, title, overview, show_title)
|
|
128
|
+
SELECT 'delete', `episodes`.rowid, `episodes`.`title`, `episodes`.`overview`, OLD.`title`
|
|
129
|
+
FROM `episodes`
|
|
130
|
+
WHERE `episodes`.`show_id` = NEW.`id`;
|
|
131
|
+
INSERT INTO `episodes_fts`(rowid, title, overview, show_title)
|
|
132
|
+
SELECT `episodes`.rowid, `episodes`.`title`, `episodes`.`overview`, NEW.`title`
|
|
133
|
+
FROM `episodes`
|
|
134
|
+
WHERE `episodes`.`show_id` = NEW.`id`;
|
|
135
|
+
END;
|
|
136
|
+
--> statement-breakpoint
|
|
137
|
+
|
|
138
|
+
-- One-time backfill for any rows that already exist before this migration ran.
|
|
139
|
+
INSERT INTO `movies_fts`(rowid, title, overview, genres)
|
|
140
|
+
SELECT rowid, title, overview, genres FROM `movies`;
|
|
141
|
+
--> statement-breakpoint
|
|
142
|
+
|
|
143
|
+
INSERT INTO `shows_fts`(rowid, title, overview, genres)
|
|
144
|
+
SELECT rowid, title, overview, genres FROM `shows`;
|
|
145
|
+
--> statement-breakpoint
|
|
146
|
+
|
|
147
|
+
INSERT INTO `episodes_fts`(rowid, title, overview, show_title)
|
|
148
|
+
SELECT
|
|
149
|
+
`episodes`.rowid,
|
|
150
|
+
`episodes`.`title`,
|
|
151
|
+
`episodes`.`overview`,
|
|
152
|
+
`shows`.`title`
|
|
153
|
+
FROM `episodes`
|
|
154
|
+
LEFT JOIN `shows` ON `shows`.`id` = `episodes`.`show_id`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
CREATE TABLE `subtitles` (
|
|
2
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
+
`movie_id` integer,
|
|
4
|
+
`episode_id` integer,
|
|
5
|
+
`file_path` text NOT NULL,
|
|
6
|
+
`language` text NOT NULL,
|
|
7
|
+
`format` text NOT NULL,
|
|
8
|
+
FOREIGN KEY (`movie_id`) REFERENCES `movies`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
9
|
+
FOREIGN KEY (`episode_id`) REFERENCES `episodes`(`id`) ON UPDATE no action ON DELETE cascade
|
|
10
|
+
);
|