makes log output during scan less verbose
All checks were successful
PiwigoDirectorySync/pipeline/head This commit looks good

This commit is contained in:
Philipp Häfelfinger 2023-09-30 15:17:16 +02:00
parent 72e88319f3
commit ec6e062971

View File

@ -48,7 +48,7 @@ internal class FileIndexer : IFileIndexer
return; return;
} }
_logger.Information("Indexing file {FullFilePath}", fullFilePath); _logger.Debug("Indexing file {FullFilePath}", fullFilePath);
var fileInfo = new FileInfo(fullFilePath); var fileInfo = new FileInfo(fullFilePath);
if (!fileInfo.Exists) if (!fileInfo.Exists)
@ -88,21 +88,25 @@ internal class FileIndexer : IFileIndexer
} }
} }
private static async Task<ImageEntity> GetOrAddImageAsync(PersistenceContext db, int albumId, string relativePath, CancellationToken ct) private async Task<ImageEntity> GetOrAddImageAsync(PersistenceContext db, int albumId, string relativePath, CancellationToken ct)
{ {
var imageEntity = await db.PiwigoImages.Where(i => i.AlbumId == albumId && i.FilePath == relativePath).FirstOrDefaultAsync(ct); var imageEntity = await db.PiwigoImages.Where(i => i.AlbumId == albumId && i.FilePath == relativePath).FirstOrDefaultAsync(ct);
if (imageEntity is null) if (imageEntity is not null)
{ {
imageEntity = new ImageEntity _logger.Debug("Found file {RelativePath}", relativePath);
{ return imageEntity;
AlbumId = albumId,
FilePath = relativePath,
UploadRequired = true,
DeleteRequired = false
};
db.PiwigoImages.Add(imageEntity);
} }
_logger.Information("Adding new file {RelativePath}", relativePath);
imageEntity = new ImageEntity
{
AlbumId = albumId,
FilePath = relativePath,
UploadRequired = true,
DeleteRequired = false
};
db.PiwigoImages.Add(imageEntity);
return imageEntity; return imageEntity;
} }