Keep Studio 2 family tiles tied to existing library files
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { records, saveRecord } from '../../utils/studio2/store';
|
||||
import { listStudioJobs } from '../../utils/studioQueue';
|
||||
export default defineEventHandler(event => {
|
||||
const { owner } = assertLibraryOwner(event), queue=listStudioJobs(owner);
|
||||
let cleared=0;
|
||||
for (const r of records(owner)) {
|
||||
try { assertFolderAccess(event,r.request.folderId); } catch { continue; }
|
||||
const status=queue.find(q=>q.id===r.queueId)?.status;
|
||||
if (['complete','failed','cancelled'].includes(r.state) || ['cancelled','error'].includes(status || '')) {
|
||||
r.dismissed=true; saveRecord(r); cleared++;
|
||||
}
|
||||
}
|
||||
// Retain internal manifests for cleanup retries; remove these records from the visible jobs list.
|
||||
return {cleared};
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import { records } from '../../utils/studio2/store';
|
||||
import { listStudioJobs } from '../../utils/studioQueue';
|
||||
export default defineEventHandler(event => { const { owner } = assertLibraryOwner(event); const rows = listStudioJobs(owner); return records(owner).filter(r => { try {
|
||||
export default defineEventHandler(event => { const { owner } = assertLibraryOwner(event); const rows = listStudioJobs(owner); return records(owner).filter(r => !r.dismissed).filter(r => { try {
|
||||
assertFolderAccess(event, r.request.folderId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import { existsSync } from 'node:fs';
|
||||
import { publicLibrary, stillPath, clipVideoPath } from '../../utils/library';
|
||||
export default defineEventHandler(event => {
|
||||
const { owner } = assertLibraryOwner(event);
|
||||
const library = publicLibrary(event);
|
||||
return {...library, stills:library.stills.filter(s=>existsSync(stillPath(owner,s.id))), clips:library.clips.filter(c=>existsSync(clipVideoPath(owner,c.id)))};
|
||||
});
|
||||
Reference in New Issue
Block a user