2023-10-09 16:25:03 +02:00
|
|
|
import { JobName, QueueName } from '../job/job.constants';
|
2023-09-20 13:16:33 +02:00
|
|
|
|
2023-03-03 03:47:08 +01:00
|
|
|
import {
|
2023-10-06 09:01:14 +02:00
|
|
|
IAssetDeletionJob,
|
2023-05-17 19:07:17 +02:00
|
|
|
IAssetFaceJob,
|
2023-03-20 16:55:28 +01:00
|
|
|
IBaseJob,
|
2023-03-18 14:44:42 +01:00
|
|
|
IBulkEntityJob,
|
2023-03-03 03:47:08 +01:00
|
|
|
IDeleteFilesJob,
|
2023-05-26 21:43:24 +02:00
|
|
|
IEntityJob,
|
2023-09-20 13:16:33 +02:00
|
|
|
ILibraryFileJob,
|
|
|
|
ILibraryRefreshJob,
|
2023-10-09 16:25:03 +02:00
|
|
|
} from '../job/job.interface';
|
2023-01-22 05:13:36 +01:00
|
|
|
|
|
|
|
export interface JobCounts {
|
|
|
|
active: number;
|
|
|
|
completed: number;
|
|
|
|
failed: number;
|
|
|
|
delayed: number;
|
|
|
|
waiting: number;
|
2023-03-29 17:33:03 +02:00
|
|
|
paused: number;
|
2023-01-22 05:13:36 +01:00
|
|
|
}
|
2023-01-21 17:11:55 +01:00
|
|
|
|
2023-04-01 22:46:07 +02:00
|
|
|
export interface QueueStatus {
|
|
|
|
isActive: boolean;
|
|
|
|
isPaused: boolean;
|
|
|
|
}
|
|
|
|
|
2023-01-21 17:11:55 +01:00
|
|
|
export type JobItem =
|
2023-03-20 16:55:28 +01:00
|
|
|
// Transcoding
|
|
|
|
| { name: JobName.QUEUE_VIDEO_CONVERSION; data: IBaseJob }
|
2023-05-26 21:43:24 +02:00
|
|
|
| { name: JobName.VIDEO_CONVERSION; data: IEntityJob }
|
2023-03-20 16:55:28 +01:00
|
|
|
|
|
|
|
// Thumbnails
|
|
|
|
| { name: JobName.QUEUE_GENERATE_THUMBNAILS; data: IBaseJob }
|
2023-05-26 21:43:24 +02:00
|
|
|
| { name: JobName.GENERATE_JPEG_THUMBNAIL; data: IEntityJob }
|
|
|
|
| { name: JobName.GENERATE_WEBP_THUMBNAIL; data: IEntityJob }
|
2023-06-18 05:22:31 +02:00
|
|
|
| { name: JobName.GENERATE_THUMBHASH_THUMBNAIL; data: IEntityJob }
|
2023-03-20 16:55:28 +01:00
|
|
|
|
|
|
|
// User Deletion
|
2023-06-01 12:32:51 +02:00
|
|
|
| { name: JobName.USER_DELETE_CHECK; data?: IBaseJob }
|
2023-05-26 21:43:24 +02:00
|
|
|
| { name: JobName.USER_DELETION; data: IEntityJob }
|
2023-03-20 16:55:28 +01:00
|
|
|
|
|
|
|
// Storage Template
|
2023-06-01 12:32:51 +02:00
|
|
|
| { name: JobName.STORAGE_TEMPLATE_MIGRATION; data?: IBaseJob }
|
2023-05-26 21:43:24 +02:00
|
|
|
| { name: JobName.STORAGE_TEMPLATE_MIGRATION_SINGLE; data: IEntityJob }
|
2023-06-01 12:32:51 +02:00
|
|
|
| { name: JobName.SYSTEM_CONFIG_CHANGE; data?: IBaseJob }
|
2023-03-20 16:55:28 +01:00
|
|
|
|
2023-09-25 17:07:21 +02:00
|
|
|
// Migration
|
|
|
|
| { name: JobName.QUEUE_MIGRATION; data?: IBaseJob }
|
|
|
|
| { name: JobName.MIGRATE_ASSET; data?: IEntityJob }
|
|
|
|
| { name: JobName.MIGRATE_PERSON; data?: IEntityJob }
|
|
|
|
|
2023-03-20 16:55:28 +01:00
|
|
|
// Metadata Extraction
|
|
|
|
| { name: JobName.QUEUE_METADATA_EXTRACTION; data: IBaseJob }
|
2023-05-26 21:43:24 +02:00
|
|
|
| { name: JobName.METADATA_EXTRACTION; data: IEntityJob }
|
2023-08-16 03:34:57 +02:00
|
|
|
| { name: JobName.LINK_LIVE_PHOTOS; data: IEntityJob }
|
2023-03-20 16:55:28 +01:00
|
|
|
|
feat(server): xmp sidecar metadata (#2466)
* initial commit for XMP sidecar support
* Added support for 'missing' metadata files to include those without sidecar files, now detects sidecar files in the filesystem for media already ingested but the sidecar was created afterwards
* didn't mean to commit default log level during testing
* new sidecar logic for video metadata as well
* Added xml mimetype for sidecars only
* don't need capture group for this regex
* wrong default value reverted
* simplified the move here - keep it in the same try catch since the outcome is to move the media back anyway
* simplified setter logic
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* simplified logic per suggestions
* sidecar is now its own queue with a discover and sync, updated UI for the new job queueing
* queue a sidecar job for every asset based on discovery or sync, though the logic is almost identical aside from linking the sidecar
* now queue sidecar jobs for each assset, though logic is mostly the same between discovery and sync
* simplified logic of filename extraction and asset instantiation
* not sure how that got deleted..
* updated code per suggestions and comments in the PR
* stat was not being used, removed the variable set
* better type checking, using in-scope variables for exif getter instead of passing in every time
* removed commented out test
* ran and resolved all lints, formats, checks, and tests
* resolved suggested change in PR
* made getExifProperty more dynamic with multiple possible args for fallbacks, fixed typo, used generic in function for better type checking
* better error handling and moving files back to positions on move or save failure
* regenerated api
* format fixes
* Added XMP documentation
* documentation typo
* Merged in main
* missed merge conflict
* more changes due to a merge
* Resolving conflicts
* added icon for sidecar jobs
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
2023-05-25 03:59:30 +02:00
|
|
|
// Sidecar Scanning
|
|
|
|
| { name: JobName.QUEUE_SIDECAR; data: IBaseJob }
|
2023-05-26 21:43:24 +02:00
|
|
|
| { name: JobName.SIDECAR_DISCOVERY; data: IEntityJob }
|
|
|
|
| { name: JobName.SIDECAR_SYNC; data: IEntityJob }
|
feat(server): xmp sidecar metadata (#2466)
* initial commit for XMP sidecar support
* Added support for 'missing' metadata files to include those without sidecar files, now detects sidecar files in the filesystem for media already ingested but the sidecar was created afterwards
* didn't mean to commit default log level during testing
* new sidecar logic for video metadata as well
* Added xml mimetype for sidecars only
* don't need capture group for this regex
* wrong default value reverted
* simplified the move here - keep it in the same try catch since the outcome is to move the media back anyway
* simplified setter logic
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* simplified logic per suggestions
* sidecar is now its own queue with a discover and sync, updated UI for the new job queueing
* queue a sidecar job for every asset based on discovery or sync, though the logic is almost identical aside from linking the sidecar
* now queue sidecar jobs for each assset, though logic is mostly the same between discovery and sync
* simplified logic of filename extraction and asset instantiation
* not sure how that got deleted..
* updated code per suggestions and comments in the PR
* stat was not being used, removed the variable set
* better type checking, using in-scope variables for exif getter instead of passing in every time
* removed commented out test
* ran and resolved all lints, formats, checks, and tests
* resolved suggested change in PR
* made getExifProperty more dynamic with multiple possible args for fallbacks, fixed typo, used generic in function for better type checking
* better error handling and moving files back to positions on move or save failure
* regenerated api
* format fixes
* Added XMP documentation
* documentation typo
* Merged in main
* missed merge conflict
* more changes due to a merge
* Resolving conflicts
* added icon for sidecar jobs
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
2023-05-25 03:59:30 +02:00
|
|
|
|
2023-03-20 16:55:28 +01:00
|
|
|
// Object Tagging
|
|
|
|
| { name: JobName.QUEUE_OBJECT_TAGGING; data: IBaseJob }
|
2023-05-26 21:43:24 +02:00
|
|
|
| { name: JobName.CLASSIFY_IMAGE; data: IEntityJob }
|
2023-03-20 16:55:28 +01:00
|
|
|
|
2023-05-17 19:07:17 +02:00
|
|
|
// Recognize Faces
|
|
|
|
| { name: JobName.QUEUE_RECOGNIZE_FACES; data: IBaseJob }
|
2023-05-26 21:43:24 +02:00
|
|
|
| { name: JobName.RECOGNIZE_FACES; data: IEntityJob }
|
2023-09-26 09:03:22 +02:00
|
|
|
| { name: JobName.GENERATE_PERSON_THUMBNAIL; data: IEntityJob }
|
2023-10-03 03:15:11 +02:00
|
|
|
| { name: JobName.PERSON_DELETE; data: IEntityJob }
|
2023-05-17 19:07:17 +02:00
|
|
|
|
2023-03-20 16:55:28 +01:00
|
|
|
// Clip Embedding
|
|
|
|
| { name: JobName.QUEUE_ENCODE_CLIP; data: IBaseJob }
|
2023-05-26 21:43:24 +02:00
|
|
|
| { name: JobName.ENCODE_CLIP; data: IEntityJob }
|
2023-03-20 16:55:28 +01:00
|
|
|
|
|
|
|
// Filesystem
|
2023-03-03 03:47:08 +01:00
|
|
|
| { name: JobName.DELETE_FILES; data: IDeleteFilesJob }
|
2023-03-20 16:55:28 +01:00
|
|
|
|
2023-08-24 21:28:50 +02:00
|
|
|
// Audit log cleanup
|
|
|
|
| { name: JobName.CLEAN_OLD_AUDIT_LOGS; data?: IBaseJob }
|
|
|
|
|
2023-05-17 19:07:17 +02:00
|
|
|
// Asset Deletion
|
2023-06-01 12:32:51 +02:00
|
|
|
| { name: JobName.PERSON_CLEANUP; data?: IBaseJob }
|
2023-10-06 09:01:14 +02:00
|
|
|
| { name: JobName.ASSET_DELETION; data: IAssetDeletionJob }
|
|
|
|
| { name: JobName.ASSET_DELETION_CHECK; data?: IBaseJob }
|
2023-05-17 19:07:17 +02:00
|
|
|
|
2023-09-20 13:16:33 +02:00
|
|
|
// Library Managment
|
|
|
|
| { name: JobName.LIBRARY_SCAN_ASSET; data: ILibraryFileJob }
|
|
|
|
| { name: JobName.LIBRARY_SCAN; data: ILibraryRefreshJob }
|
|
|
|
| { name: JobName.LIBRARY_REMOVE_OFFLINE; data: IEntityJob }
|
|
|
|
| { name: JobName.LIBRARY_DELETE; data: IEntityJob }
|
|
|
|
| { name: JobName.LIBRARY_QUEUE_SCAN_ALL; data: IBaseJob }
|
|
|
|
| { name: JobName.LIBRARY_QUEUE_CLEANUP; data: IBaseJob }
|
|
|
|
|
2023-03-20 16:55:28 +01:00
|
|
|
// Search
|
2023-06-01 12:32:51 +02:00
|
|
|
| { name: JobName.SEARCH_INDEX_ASSETS; data?: IBaseJob }
|
2023-03-18 14:44:42 +01:00
|
|
|
| { name: JobName.SEARCH_INDEX_ASSET; data: IBulkEntityJob }
|
2023-06-01 12:32:51 +02:00
|
|
|
| { name: JobName.SEARCH_INDEX_FACES; data?: IBaseJob }
|
2023-05-17 19:07:17 +02:00
|
|
|
| { name: JobName.SEARCH_INDEX_FACE; data: IAssetFaceJob }
|
2023-06-01 12:32:51 +02:00
|
|
|
| { name: JobName.SEARCH_INDEX_ALBUMS; data?: IBaseJob }
|
2023-03-18 14:44:42 +01:00
|
|
|
| { name: JobName.SEARCH_INDEX_ALBUM; data: IBulkEntityJob }
|
|
|
|
| { name: JobName.SEARCH_REMOVE_ASSET; data: IBulkEntityJob }
|
2023-05-17 19:07:17 +02:00
|
|
|
| { name: JobName.SEARCH_REMOVE_ALBUM; data: IBulkEntityJob }
|
|
|
|
| { name: JobName.SEARCH_REMOVE_FACE; data: IAssetFaceJob };
|
2023-01-21 17:11:55 +01:00
|
|
|
|
2023-06-01 12:32:51 +02:00
|
|
|
export type JobHandler<T = any> = (data: T) => boolean | Promise<boolean>;
|
2023-10-06 23:32:28 +02:00
|
|
|
export type JobItemHandler = (item: JobItem) => Promise<void>;
|
2023-06-01 12:32:51 +02:00
|
|
|
|
2023-01-21 17:11:55 +01:00
|
|
|
export const IJobRepository = 'IJobRepository';
|
|
|
|
|
|
|
|
export interface IJobRepository {
|
2023-10-06 23:32:28 +02:00
|
|
|
addHandler(queueName: QueueName, concurrency: number, handler: JobItemHandler): void;
|
2023-06-01 12:32:51 +02:00
|
|
|
setConcurrency(queueName: QueueName, concurrency: number): void;
|
2023-02-25 15:12:03 +01:00
|
|
|
queue(item: JobItem): Promise<void>;
|
2023-03-20 16:55:28 +01:00
|
|
|
pause(name: QueueName): Promise<void>;
|
2023-03-28 20:25:22 +02:00
|
|
|
resume(name: QueueName): Promise<void>;
|
2023-01-22 05:13:36 +01:00
|
|
|
empty(name: QueueName): Promise<void>;
|
2023-04-01 22:46:07 +02:00
|
|
|
getQueueStatus(name: QueueName): Promise<QueueStatus>;
|
2023-01-22 05:13:36 +01:00
|
|
|
getJobCounts(name: QueueName): Promise<JobCounts>;
|
2023-01-21 17:11:55 +01:00
|
|
|
}
|