diff --git a/PiwigoDirectorySync/Services/AlbumSynchronizer.cs b/PiwigoDirectorySync/Services/AlbumSynchronizer.cs index 4f02bcd..808f459 100644 --- a/PiwigoDirectorySync/Services/AlbumSynchronizer.cs +++ b/PiwigoDirectorySync/Services/AlbumSynchronizer.cs @@ -44,7 +44,7 @@ internal class AlbumSynchronizer : IAlbumSynchronizer public async Task GetPendingChangesAsync(int piwigoServerId, CancellationToken ct) { - var getOrAdds = await _persistenceContext.PiwigoAlbums.Where(a => a.ServerAlbumId == null).CountAsync(ct); + var getOrAdds = await _persistenceContext.PiwigoAlbums.Where(a => a.ServerAlbumId == null && a.ServerId == piwigoServerId).CountAsync(ct); const int updates = 0; // not yet supported const int deletes = 0; // not yet supported diff --git a/PiwigoDirectorySync/Services/ImageSynchronizer.cs b/PiwigoDirectorySync/Services/ImageSynchronizer.cs index cbd0dbe..a44bec3 100644 --- a/PiwigoDirectorySync/Services/ImageSynchronizer.cs +++ b/PiwigoDirectorySync/Services/ImageSynchronizer.cs @@ -23,9 +23,9 @@ internal class ImageSynchronizer : IImageSynchronizer public async Task GetPendingChangesAsync(int piwigoServerId, CancellationToken ct) { - var getOrAdds = await _persistenceContext.PiwigoImages.Where(i => i.ServerImageId == null).CountAsync(ct); - var updates = await _persistenceContext.PiwigoImages.Where(i => i.ServerImageId != null && i.UploadRequired).CountAsync(ct); - var deletes = await _persistenceContext.PiwigoImages.Where(i => i.ServerImageId != null && i.DeleteRequired).CountAsync(ct); + var getOrAdds = await _persistenceContext.PiwigoImages.Where(i => i.Album.ServerId == piwigoServerId && i.ServerImageId == null).CountAsync(ct); + var updates = await _persistenceContext.PiwigoImages.Where(i => i.Album.ServerId == piwigoServerId && i.ServerImageId != null && i.UploadRequired).CountAsync(ct); + var deletes = await _persistenceContext.PiwigoImages.Where(i => i.Album.ServerId == piwigoServerId && i.ServerImageId != null && i.DeleteRequired).CountAsync(ct); return new PendingChange(getOrAdds, updates, deletes); } @@ -216,7 +216,7 @@ internal class ImageSynchronizer : IImageSynchronizer } catch (PiwigoException ex) { - _logger.Error(ex,"Could not update image {ImageEntityPath} ({ImageEntityId}) on piwigo server with id {ImageEntityServerImageId}", imageEntity.FilePath, + _logger.Error(ex, "Could not update image {ImageEntityPath} ({ImageEntityId}) on piwigo server with id {ImageEntityServerImageId}", imageEntity.FilePath, imageEntity.Id, imageEntity.ServerImageId); } }