Skip to content

Commit

Permalink
Adding an ingesting property
Browse files Browse the repository at this point in the history
  • Loading branch information
JackLewis-digirati committed Dec 20, 2024
1 parent 3bc4607 commit f4ac07a
Show file tree
Hide file tree
Showing 8 changed files with 468 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ public class CanvasPaintingResolver(
CustomerId = customerId,
CanvasOrder = count,
AssetId = $"{customerId}/{space}/{id}",
ChoiceOrder = -1
ChoiceOrder = -1,
Ingesting = true
};

count++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private async Task UpdateAssetsIfRequired(BatchCompletionMessage batchCompletion

private void CompleteBatch(Batch batch)
{
batch.Finished = DateTime.UtcNow; //todo: change to actual batch completion time?
batch.Processed = DateTime.UtcNow;
batch.Status = BatchStatus.Completed;
}

Expand All @@ -86,7 +86,7 @@ private void UpdateCanvasPaintings(HydraCollection<Asset> assets, Batch batch)

foreach (var canvasPainting in batch.Manifest.CanvasPaintings)
{
if (canvasPainting.CanvasOriginalId == null) // Trying to figure out an asset that hasn't been updated
if (canvasPainting.Ingesting)
{
var assetId = AssetId.FromString(canvasPainting.AssetId!);

Expand All @@ -98,7 +98,8 @@ private void UpdateCanvasPaintings(HydraCollection<Asset> assets, Batch batch)
$"{dlcsSettings.OrchestratorUri}/iiif-img/{assetId.Customer}/{assetId.Space}/{assetId.Asset}/full/max/0/default.jpg"); //todo: do we need this? Supposed to be null for an asset really
canvasPainting.Thumbnail =
new Uri(
$"{dlcsSettings.OrchestratorUri}/thumbs/{assetId.Customer}/{assetId.Space}/{assetId.Asset}/100,/max/0/default.jpg"); //todo: move this to class
$"{dlcsSettings.OrchestratorUri}/thumbs/{assetId.Customer}/{assetId.Space}/{assetId.Asset}/100,/max/0/default.jpg"); //todo: how to get this?
canvasPainting.Ingesting = false;
canvasPainting.Modified = DateTime.UtcNow;
canvasPainting.StaticHeight = asset.Height;
canvasPainting.StaticWidth = asset.Width;
Expand Down
2 changes: 1 addition & 1 deletion src/IIIFPresentation/DLCS/DlcsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ public class DlcsSettings
/// <summary>
/// Used to authenticate requests that do not go via the HttpContextAccessor
/// </summary>
public string ApiLocalAuth { get; set; } //Todo: is this right? is there a better way of setting auth
public string? ApiLocalAuth { get; set; }
}
5 changes: 5 additions & 0 deletions src/IIIFPresentation/Models/Database/CanvasPainting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public int? ChoiceOrder
/// An asset id showing this asset is an internal item
/// </summary>
public string? AssetId { get; set; }

/// <summary>
/// Whether the asset is currently being ingested into the DLCS
/// </summary>
public bool Ingesting { get; set; } = false;
}

public static class CanvasPaintingX
Expand Down
2 changes: 1 addition & 1 deletion src/IIIFPresentation/Models/Database/General/Batch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Batch
/// <summary>
/// When the batch was added to the DLCS
/// </summary>
public DateTime? Finished { get; set; }
public DateTime? Processed { get; set; }

/// <summary>
/// Id of related manifest
Expand Down
Loading

0 comments on commit f4ac07a

Please sign in to comment.