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
28 lines
1.2 KiB
C#
28 lines
1.2 KiB
C#
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();
|
|
}
|
|
|
|
} |