Skip to content

Commit

Permalink
Adding preview from sub dirs to freshly scanned photos: #31
Browse files Browse the repository at this point in the history
  • Loading branch information
bpatrik committed May 11, 2021
1 parent 94d57cf commit d53af51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 8 additions & 2 deletions src/backend/model/database/sql/GalleryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d53af51

Please sign in to comment.