DigiKam4 Archive
Change to only need the one json file and changed AppSettings to not need a binder file Editorconfig for no new line before open braces Nuget package bumps Database lowest-version-history
This commit is contained in:
28
src/ImmichToSlideshow/Models/DigiKam/Images.cs
Normal file
28
src/ImmichToSlideshow/Models/DigiKam/Images.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ImmichToSlideshow.Models.DigiKam;
|
||||
|
||||
public record Images([property: JsonPropertyName("album")] int? Album,
|
||||
[property: JsonPropertyName("category")] int Category,
|
||||
[property: JsonPropertyName("fileSize")] object FileSize,
|
||||
[property: JsonPropertyName("id")] int Id,
|
||||
[property: JsonPropertyName("manualOrder")] object ManualOrder,
|
||||
[property: JsonPropertyName("modificationDate")] DateTime ModificationDate,
|
||||
[property: JsonPropertyName("name")] string Name,
|
||||
[property: JsonPropertyName("status")] int Status,
|
||||
[property: JsonPropertyName("uniqueHash")] string UniqueHash) {
|
||||
|
||||
internal static ReadOnlyCollection<Images>? GetImages(string? path) {
|
||||
Images[]? results;
|
||||
if (string.IsNullOrEmpty(path) || !File.Exists(path)) {
|
||||
results = null;
|
||||
} else {
|
||||
string json = File.ReadAllText(path);
|
||||
results = JsonSerializer.Deserialize<Images[]>(json);
|
||||
}
|
||||
return results?.AsReadOnly();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user