chunker ui redo
This commit is contained in:
42
ui/common/api/media.ts
Normal file
42
ui/common/api/media.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Shared media API functions — identical across all MPR UI apps.
|
||||
*/
|
||||
|
||||
import type { MediaAsset } from "../types/generated";
|
||||
import { gql } from "./graphql";
|
||||
|
||||
/** Fetch all media assets. */
|
||||
export async function getAssets(): Promise<MediaAsset[]> {
|
||||
const data = await gql<{ assets: MediaAsset[] }>(`
|
||||
query {
|
||||
assets {
|
||||
id filename file_path status error_message file_size duration
|
||||
video_codec audio_codec width height framerate bitrate
|
||||
properties comments tags created_at updated_at
|
||||
}
|
||||
}
|
||||
`);
|
||||
return data.assets;
|
||||
}
|
||||
|
||||
/** Scan media/in/ folder for new files. */
|
||||
export async function scanMediaFolder(): Promise<{
|
||||
found: number;
|
||||
registered: number;
|
||||
skipped: number;
|
||||
files: string[];
|
||||
}> {
|
||||
const data = await gql<{
|
||||
scan_media_folder: {
|
||||
found: number;
|
||||
registered: number;
|
||||
skipped: number;
|
||||
files: string[];
|
||||
};
|
||||
}>(`
|
||||
mutation {
|
||||
scan_media_folder { found registered skipped files }
|
||||
}
|
||||
`);
|
||||
return data.scan_media_folder;
|
||||
}
|
||||
Reference in New Issue
Block a user