1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Adding preview from sub dirs to freshly scanned photos: #31

This commit is contained in:
Patrik J. Braun 2021-05-11 17:39:58 +02:00
parent 94d57cf6a1
commit d53af51be2
2 changed files with 8 additions and 3 deletions

View File

@ -15,6 +15,5 @@ before_install:
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
install:
- npm ci
- npm run lint
- npm run build
after_success: npm run coverage

View File

@ -60,7 +60,13 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
if (dir.lastModified !== lastModified) {
Logger.silly(LOG_TAG, 'Reindexing reason: lastModified mismatch: known: '
+ dir.lastModified + ', current:' + lastModified);
return ObjectManagers.getInstance().IndexingManager.indexDirectory(relativeDirectoryName);
const ret = await ObjectManagers.getInstance().IndexingManager.indexDirectory(relativeDirectoryName);
for (const subDir of ret.directories) {
if (!subDir.preview) { // if sub directories does not have photos, so cannot show a preview, try get one from DB
await this.fillPreviewFromSubDir(connection, subDir);
}
}
return ret;
}
@ -213,7 +219,7 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
return await query.getOne();
}
protected async fillPreviewFromSubDir(connection: Connection, dir: DirectoryEntity): Promise<void> {
protected async fillPreviewFromSubDir(connection: Connection, dir: DirectoryDTO): Promise<void> {
dir.media = [];
const query = connection
.getRepository(MediaEntity)