mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Add unmatched paths in GET /videos
(for scanner)
This commit is contained in:
parent
6194d806cc
commit
ce66dba0c8
@ -84,7 +84,23 @@ export const videosH = new Elysia({ prefix: "/videos", tags: ["videos"] })
|
||||
|
||||
const paths = await db.select({ path: videos.path }).from(videos);
|
||||
|
||||
return { paths: paths.map((x) => x.path), guesses };
|
||||
const unmatched = await db
|
||||
.select({ path: videos.path })
|
||||
.from(videos)
|
||||
.where(
|
||||
notExists(
|
||||
db
|
||||
.select()
|
||||
.from(entryVideoJoin)
|
||||
.where(eq(entryVideoJoin.videoPk, videos.pk)),
|
||||
),
|
||||
);
|
||||
|
||||
return {
|
||||
paths: paths.map((x) => x.path),
|
||||
guesses,
|
||||
unmatched: unmatched.map((x) => x.path),
|
||||
};
|
||||
},
|
||||
{
|
||||
detail: { description: "Get all video registered & guessed made" },
|
||||
|
@ -137,6 +137,7 @@ export const Guesses = t.Object({
|
||||
Resource(),
|
||||
),
|
||||
),
|
||||
unmatched: t.Array(t.String()),
|
||||
});
|
||||
export type Guesses = typeof Guesses.static;
|
||||
|
||||
@ -144,6 +145,7 @@ registerExamples(Guesses, {
|
||||
paths: [
|
||||
"/videos/Evangelion S01E02.mkv",
|
||||
"/videos/Evangelion (1995) S01E26.mkv",
|
||||
"/videos/SomeUnknownThing.mkv",
|
||||
],
|
||||
guesses: {
|
||||
Evangelion: {
|
||||
@ -157,4 +159,5 @@ registerExamples(Guesses, {
|
||||
},
|
||||
},
|
||||
},
|
||||
unmatched: ["/videos/SomeUnknownThing.mkv"],
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user