mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-22 10:26:33 +02:00
add scan listener and query invalidation on tag editor save
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user