forked from Cutlery/immich
use library batch size
This commit is contained in:
parent
f28f8992ab
commit
894107126e
@ -477,7 +477,7 @@ describe('/library', () => {
|
|||||||
expect(body).toEqual(errorDto.badRequest('Can only scan external libraries'));
|
expect(body).toEqual(errorDto.badRequest('Can only scan external libraries'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should scan external library', async () => {
|
it('should scan an external library', async () => {
|
||||||
const library = await utils.createLibrary(admin.accessToken, {
|
const library = await utils.createLibrary(admin.accessToken, {
|
||||||
ownerId: admin.userId,
|
ownerId: admin.userId,
|
||||||
type: LibraryType.External,
|
type: LibraryType.External,
|
||||||
|
1
mobile/openapi/README.md
generated
1
mobile/openapi/README.md
generated
@ -139,7 +139,6 @@ Class | Method | HTTP request | Description
|
|||||||
*LibraryApi* | [**getLibrary**](doc//LibraryApi.md#getlibrary) | **GET** /library/{id} |
|
*LibraryApi* | [**getLibrary**](doc//LibraryApi.md#getlibrary) | **GET** /library/{id} |
|
||||||
*LibraryApi* | [**getLibraryStatistics**](doc//LibraryApi.md#getlibrarystatistics) | **GET** /library/{id}/statistics |
|
*LibraryApi* | [**getLibraryStatistics**](doc//LibraryApi.md#getlibrarystatistics) | **GET** /library/{id}/statistics |
|
||||||
*LibraryApi* | [**removeOfflineFiles**](doc//LibraryApi.md#removeofflinefiles) | **POST** /library/{id}/removeOffline |
|
*LibraryApi* | [**removeOfflineFiles**](doc//LibraryApi.md#removeofflinefiles) | **POST** /library/{id}/removeOffline |
|
||||||
*LibraryApi* | [**scanDeletedFiles**](doc//LibraryApi.md#scandeletedfiles) | **POST** /library/{id}/scanDeleted |
|
|
||||||
*LibraryApi* | [**scanLibrary**](doc//LibraryApi.md#scanlibrary) | **POST** /library/{id}/scan |
|
*LibraryApi* | [**scanLibrary**](doc//LibraryApi.md#scanlibrary) | **POST** /library/{id}/scan |
|
||||||
*LibraryApi* | [**updateLibrary**](doc//LibraryApi.md#updatelibrary) | **PUT** /library/{id} |
|
*LibraryApi* | [**updateLibrary**](doc//LibraryApi.md#updatelibrary) | **PUT** /library/{id} |
|
||||||
*LibraryApi* | [**validate**](doc//LibraryApi.md#validate) | **POST** /library/{id}/validate |
|
*LibraryApi* | [**validate**](doc//LibraryApi.md#validate) | **POST** /library/{id}/validate |
|
||||||
|
55
mobile/openapi/doc/LibraryApi.md
generated
55
mobile/openapi/doc/LibraryApi.md
generated
@ -15,7 +15,6 @@ Method | HTTP request | Description
|
|||||||
[**getLibrary**](LibraryApi.md#getlibrary) | **GET** /library/{id} |
|
[**getLibrary**](LibraryApi.md#getlibrary) | **GET** /library/{id} |
|
||||||
[**getLibraryStatistics**](LibraryApi.md#getlibrarystatistics) | **GET** /library/{id}/statistics |
|
[**getLibraryStatistics**](LibraryApi.md#getlibrarystatistics) | **GET** /library/{id}/statistics |
|
||||||
[**removeOfflineFiles**](LibraryApi.md#removeofflinefiles) | **POST** /library/{id}/removeOffline |
|
[**removeOfflineFiles**](LibraryApi.md#removeofflinefiles) | **POST** /library/{id}/removeOffline |
|
||||||
[**scanDeletedFiles**](LibraryApi.md#scandeletedfiles) | **POST** /library/{id}/scanDeleted |
|
|
||||||
[**scanLibrary**](LibraryApi.md#scanlibrary) | **POST** /library/{id}/scan |
|
[**scanLibrary**](LibraryApi.md#scanlibrary) | **POST** /library/{id}/scan |
|
||||||
[**updateLibrary**](LibraryApi.md#updatelibrary) | **PUT** /library/{id} |
|
[**updateLibrary**](LibraryApi.md#updatelibrary) | **PUT** /library/{id} |
|
||||||
[**validate**](LibraryApi.md#validate) | **POST** /library/{id}/validate |
|
[**validate**](LibraryApi.md#validate) | **POST** /library/{id}/validate |
|
||||||
@ -349,60 +348,6 @@ void (empty response body)
|
|||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
# **scanDeletedFiles**
|
|
||||||
> scanDeletedFiles(id)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure API key authorization: cookie
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
|
|
||||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
|
|
||||||
// TODO Configure API key authorization: api_key
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
|
|
||||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
|
|
||||||
// TODO Configure HTTP Bearer authorization: bearer
|
|
||||||
// Case 1. Use String Token
|
|
||||||
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
|
|
||||||
// Case 2. Use Function which generate token.
|
|
||||||
// String yourTokenGeneratorFunction() { ... }
|
|
||||||
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
|
|
||||||
|
|
||||||
final api_instance = LibraryApi();
|
|
||||||
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.scanDeletedFiles(id);
|
|
||||||
} catch (e) {
|
|
||||||
print('Exception when calling LibraryApi->scanDeletedFiles: $e\n');
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**id** | **String**| |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **Accept**: Not defined
|
|
||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
# **scanLibrary**
|
# **scanLibrary**
|
||||||
> scanLibrary(id, scanLibraryDto)
|
> scanLibrary(id, scanLibraryDto)
|
||||||
|
|
||||||
|
40
mobile/openapi/lib/api/library_api.dart
generated
40
mobile/openapi/lib/api/library_api.dart
generated
@ -293,46 +293,6 @@ class LibraryApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Performs an HTTP 'POST /library/{id}/scanDeleted' operation and returns the [Response].
|
|
||||||
/// Parameters:
|
|
||||||
///
|
|
||||||
/// * [String] id (required):
|
|
||||||
Future<Response> scanDeletedFilesWithHttpInfo(String id,) async {
|
|
||||||
// ignore: prefer_const_declarations
|
|
||||||
final path = r'/library/{id}/scanDeleted'
|
|
||||||
.replaceAll('{id}', id);
|
|
||||||
|
|
||||||
// ignore: prefer_final_locals
|
|
||||||
Object? postBody;
|
|
||||||
|
|
||||||
final queryParams = <QueryParam>[];
|
|
||||||
final headerParams = <String, String>{};
|
|
||||||
final formParams = <String, String>{};
|
|
||||||
|
|
||||||
const contentTypes = <String>[];
|
|
||||||
|
|
||||||
|
|
||||||
return apiClient.invokeAPI(
|
|
||||||
path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentTypes.isEmpty ? null : contentTypes.first,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Parameters:
|
|
||||||
///
|
|
||||||
/// * [String] id (required):
|
|
||||||
Future<void> scanDeletedFiles(String id,) async {
|
|
||||||
final response = await scanDeletedFilesWithHttpInfo(id,);
|
|
||||||
if (response.statusCode >= HttpStatus.badRequest) {
|
|
||||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Performs an HTTP 'POST /library/{id}/scan' operation and returns the [Response].
|
/// Performs an HTTP 'POST /library/{id}/scan' operation and returns the [Response].
|
||||||
/// Parameters:
|
/// Parameters:
|
||||||
///
|
///
|
||||||
|
5
mobile/openapi/test/library_api_test.dart
generated
5
mobile/openapi/test/library_api_test.dart
generated
@ -47,11 +47,6 @@ void main() {
|
|||||||
// TODO
|
// TODO
|
||||||
});
|
});
|
||||||
|
|
||||||
//Future scanDeletedFiles(String id) async
|
|
||||||
test('test scanDeletedFiles', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
//Future scanLibrary(String id, ScanLibraryDto scanLibraryDto) async
|
//Future scanLibrary(String id, ScanLibraryDto scanLibraryDto) async
|
||||||
test('test scanLibrary', () async {
|
test('test scanLibrary', () async {
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -3603,41 +3603,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/library/{id}/scanDeleted": {
|
|
||||||
"post": {
|
|
||||||
"operationId": "scanDeletedFiles",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"required": true,
|
|
||||||
"in": "path",
|
|
||||||
"schema": {
|
|
||||||
"format": "uuid",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"204": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"bearer": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cookie": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"api_key": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"Library"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/library/{id}/statistics": {
|
"/library/{id}/statistics": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "getLibraryStatistics",
|
"operationId": "getLibraryStatistics",
|
||||||
|
@ -1942,14 +1942,6 @@ export function scanLibrary({ id, scanLibraryDto }: {
|
|||||||
body: scanLibraryDto
|
body: scanLibraryDto
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
export function scanDeletedFiles({ id }: {
|
|
||||||
id: string;
|
|
||||||
}, opts?: Oazapfts.RequestOpts) {
|
|
||||||
return oazapfts.ok(oazapfts.fetchText(`/library/${encodeURIComponent(id)}/scanDeleted`, {
|
|
||||||
...opts,
|
|
||||||
method: "POST"
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
export function getLibraryStatistics({ id }: {
|
export function getLibraryStatistics({ id }: {
|
||||||
id: string;
|
id: string;
|
||||||
}, opts?: Oazapfts.RequestOpts) {
|
}, opts?: Oazapfts.RequestOpts) {
|
||||||
|
@ -305,8 +305,6 @@ export class LibraryService extends EventEmitter {
|
|||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.logger.verbose('Asset refresh queued');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async validateImportPath(importPath: string): Promise<ValidateLibraryImportPathResponseDto> {
|
private async validateImportPath(importPath: string): Promise<ValidateLibraryImportPathResponseDto> {
|
||||||
@ -639,7 +637,7 @@ export class LibraryService extends EventEmitter {
|
|||||||
exclusionPatterns: library.exclusionPatterns,
|
exclusionPatterns: library.exclusionPatterns,
|
||||||
});
|
});
|
||||||
|
|
||||||
const existingAssets = usePagination(JOBS_ASSET_PAGINATION_SIZE, (pagination) =>
|
const existingAssets = usePagination(LIBRARY_SCAN_BATCH_SIZE, (pagination) =>
|
||||||
this.assetRepository.getWith(pagination, WithProperty.IS_ONLINE, job.id),
|
this.assetRepository.getWith(pagination, WithProperty.IS_ONLINE, job.id),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -476,14 +476,14 @@ export class AssetRepository implements IAssetRepository {
|
|||||||
if (!libraryId) {
|
if (!libraryId) {
|
||||||
throw new Error('Library id is required when finding offline assets');
|
throw new Error('Library id is required when finding offline assets');
|
||||||
}
|
}
|
||||||
where = [{ isOffline: true, libraryId: libraryId }];
|
where = [{ isOffline: true, libraryId }];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WithProperty.IS_ONLINE: {
|
case WithProperty.IS_ONLINE: {
|
||||||
if (!libraryId) {
|
if (!libraryId) {
|
||||||
throw new Error('Library id is required when finding online assets');
|
throw new Error('Library id is required when finding online assets');
|
||||||
}
|
}
|
||||||
where = [{ isOffline: false, libraryId: libraryId }];
|
where = [{ isOffline: false, libraryId }];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
type LibraryResponseDto,
|
type LibraryResponseDto,
|
||||||
type LibraryStatsResponseDto,
|
type LibraryStatsResponseDto,
|
||||||
type UserResponseDto,
|
type UserResponseDto,
|
||||||
scanDeletedFiles,
|
|
||||||
} from '@immich/sdk';
|
} from '@immich/sdk';
|
||||||
import { mdiDatabase, mdiDotsVertical, mdiPlusBoxOutline, mdiSync, mdiUpload } from '@mdi/js';
|
import { mdiDatabase, mdiDotsVertical, mdiPlusBoxOutline, mdiSync, mdiUpload } from '@mdi/js';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
@ -200,18 +199,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleScanDeleted = async (libraryId: string) => {
|
|
||||||
try {
|
|
||||||
await scanDeletedFiles({ id: libraryId });
|
|
||||||
notificationController.show({
|
|
||||||
message: `Scanning library for deleted files`,
|
|
||||||
type: NotificationType.Info,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
handleError(error, 'Unable to scan library');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleScanChanges = async (libraryId: string) => {
|
const handleScanChanges = async (libraryId: string) => {
|
||||||
try {
|
try {
|
||||||
await scanLibrary({ id: libraryId, scanLibraryDto: { refreshModifiedFiles: true } });
|
await scanLibrary({ id: libraryId, scanLibraryDto: { refreshModifiedFiles: true } });
|
||||||
@ -268,14 +255,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onScanDeletedLibraryClicked = async () => {
|
|
||||||
closeAll();
|
|
||||||
|
|
||||||
if (selectedLibrary) {
|
|
||||||
await handleScanDeleted(selectedLibrary.id);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onScanSettingClicked = () => {
|
const onScanSettingClicked = () => {
|
||||||
closeAll();
|
closeAll();
|
||||||
editScanSettings = selectedLibraryIndex;
|
editScanSettings = selectedLibraryIndex;
|
||||||
@ -425,10 +404,6 @@
|
|||||||
<MenuOption on:click={() => onScanSettingClicked()} text="Scan Settings" />
|
<MenuOption on:click={() => onScanSettingClicked()} text="Scan Settings" />
|
||||||
<hr />
|
<hr />
|
||||||
<MenuOption on:click={() => onScanNewLibraryClicked()} text="Scan New Library Files" />
|
<MenuOption on:click={() => onScanNewLibraryClicked()} text="Scan New Library Files" />
|
||||||
<MenuOption
|
|
||||||
on:click={() => onScanDeletedLibraryClicked()}
|
|
||||||
text="Scan Deleted Library Files"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<MenuOption
|
<MenuOption
|
||||||
on:click={() => onScanAllLibraryFilesClicked()}
|
on:click={() => onScanAllLibraryFilesClicked()}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user