add scan listener and query invalidation on tag editor save

This commit is contained in:
jeffvli
2026-07-19 21:03:13 -07:00
parent e62242824d
commit 173efa9bfd
17 changed files with 326 additions and 5 deletions
@@ -206,6 +206,14 @@ export const contract = c.router({
400: jfType._response.error,
},
},
getScheduledTasks: {
method: 'GET',
path: 'ScheduledTasks',
responses: {
200: jfType._response.scheduledTasks,
400: jfType._response.error,
},
},
getServerInfo: {
method: 'GET',
path: 'system/info',
@@ -1161,6 +1161,34 @@ export const JellyfinController: InternalControllerEndpoint = {
};
},
getRoles: async () => [],
getScanStatus: async (args) => {
const { apiClientProps } = args;
const res = await jfApiClient(apiClientProps).getScheduledTasks();
if (res.status !== 200) {
throw new Error('Failed to get scan status');
}
const task =
res.body.find((t) => t.Key === 'RefreshLibrary') ||
res.body.find((t) => t.Name === 'Scan Media Library');
if (!task) {
return {
count: 0,
folderCount: 0,
scanning: false,
};
}
return {
count: 0,
folderCount: 0,
lastScan: task.LastExecutionResult?.EndTimeUtc ?? undefined,
scanning: task.State === 'Running' || task.State === 'Cancelling',
};
},
getServerInfo: async (args) => {
const { apiClientProps } = args;