diff --git a/.vscode/settings.json b/.vscode/settings.json index 5a34a0a..3568a0b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,100 +1,107 @@ { - "[markdown]": { - "editor.wordWrap": "off" + "files.associations": { + "*.ffs_gui": "xml", + "*.hurl": "http", + "*.org": "ini", + "*.net": "ini", + "default": "ini" + }, + "[markdown]": { + "editor.wordWrap": "off" + }, + "files.exclude": { + "**/.git": false, + "**/node_modules": true + }, + "files.watcherExclude": { + "**/node_modules": true + }, + "cSpell.words": [ + "accessibilities", + "ackages", + "Acks", + "aspnet", + "ASPNETCORE", + "binlog", + "buildhelp", + "cachefile", + "CAXXXX", + "checkin", + "codegen", + "coveragexml", + "csdef", + "dbmdl", + "dbproj", + "DENITED", + "Digi", + "dlldata", + "docstates", + "ebug", + "elease", + "eleases", + "esult", + "Fractors", + "gitea", + "Immich", + "Infineon", + "Installshield", + "iobj", + "ipch", + "ipdb", + "jmconfig", + "mfractor", + "Npgsql", + "Nsight", + "ntvs", + "NUNIT", + "nupkg", + "nvuser", + "opendb", + "opensdf", + "paket", + "Paket", + "pidb", + "psess", + "PTVS", + "publishproj", + "publishsettings", + "pycache", + "rptproj", + "rsuser", + "schemaview", + "Silverlight", + "svclog", + "Telerik's", + "Thumbhash", + "ublish", + "uild", + "userosscache", + "userprefs", + "vspscc", + "vspx", + "vssscc", + "wwwroot", + "xpress" + ], + "rest-client.environmentVariables": { + "$shared": { + "productId": "asdfasdf", + "reviewId": "asdfasdf" }, - "files.exclude": { - "**/.git": false, - "**/node_modules": true + "dev": { + "ownerId": "5f0b1052-466d-44de-a554-226d7256850d", + "host": "https://localhost:5003", + "token": "ey..dev", }, - "files.watcherExclude": { - "**/node_modules": true + "affirm": { + "ownerId": "5f0b1052-466d-44de-a554-226d7256850d", + "host": "https://immich-to-slideshow.affirm.duckdns.org/", + "token": "ey..affirm" }, - "cSpell.words": [ - "accessibilities", - "ackages", - "Acks", - "aspnet", - "ASPNETCORE", - "binlog", - "buildhelp", - "cachefile", - "CAXXXX", - "checkin", - "codegen", - "coveragexml", - "csdef", - "dbmdl", - "dbproj", - "DENITED", - "Digi", - "dlldata", - "docstates", - "ebug", - "elease", - "eleases", - "esult", - "Fractors", - "gitea", - "Immich", - "Infineon", - "Installshield", - "iobj", - "ipch", - "ipdb", - "jmconfig", - "mfractor", - "Npgsql", - "Nsight", - "ntvs", - "NUNIT", - "nupkg", - "nvuser", - "opendb", - "opensdf", - "paket", - "Paket", - "pidb", - "psess", - "PTVS", - "publishproj", - "publishsettings", - "pycache", - "rptproj", - "rsuser", - "schemaview", - "Silverlight", - "svclog", - "Telerik's", - "Thumbhash", - "ublish", - "uild", - "userosscache", - "userprefs", - "vspscc", - "vspx", - "vssscc", - "wwwroot", - "xpress" - ], - "rest-client.environmentVariables": { - "$shared": { - "productId": "asdfasdf", - "reviewId": "asdfasdf" - }, - "dev": { - "ownerId": "5f0b1052-466d-44de-a554-226d7256850d", - "host": "https://localhost:5003", - "token": "ey..dev", - }, - "affirm": { - "ownerId": "5f0b1052-466d-44de-a554-226d7256850d", - "host": "https://immich-to-slideshow.affirm.duckdns.org/", - "token": "ey..affirm" - }, - "phares": { - "ownerId": "5f0b1052-466d-44de-a554-226d7256850d", - "host": "https://immich-to-slideshow.phares.duckdns.org/", - "token": "ey..phares" - } + "phares": { + "ownerId": "5f0b1052-466d-44de-a554-226d7256850d", + "host": "https://immich-to-slideshow.phares.duckdns.org/", + "token": "ey..phares" } + } } \ No newline at end of file diff --git a/requests/ImmichToSlideshow.http b/requests/ImmichToSlideshow.http deleted file mode 100644 index 8099e47..0000000 --- a/requests/ImmichToSlideshow.http +++ /dev/null @@ -1,46 +0,0 @@ -@host = http://0.0.0.0:5001 - -GET {{host}}/api/v1/assets/columns/ -Accept: application/json - -### - -GET {{host}}/api/v1/assets/owner-ids/ -Accept: application/json - -### - -GET {{host}}/api/v1/assets/{{ownerId}} -Accept: application/json - -### - -GET {{host}}/api/v1/assets/{{ownerId}}/random-paths/ -Accept: application/json - -### - -GET {{host}}/api/v1/assets/{{ownerId}}/save-random-paths/ -Accept: application/json - -### - -GET {{host}}/api/v1/assets/{{ownerId}}/sync-immich/ -Accept: application/json - -### - -GET {{host}}/api/v1/assets/{{ownerId}}/set-archive-immich/ -Accept: application/json - -### - -GET {{host}}/api/v1/assets/{{ownerId}}/set-digi-kam-4-archive-immich/ -Accept: application/json - -### - -GET {{host}}/api/v1/assets/{{ownerId}}/archived-tag/ -Accept: application/json - -### diff --git a/requests/ImmichToSlideshow.hurl b/requests/ImmichToSlideshow.hurl new file mode 100644 index 0000000..8ed2c06 --- /dev/null +++ b/requests/ImmichToSlideshow.hurl @@ -0,0 +1,80 @@ +GET http://127.0.0.1:5001/api/v1/assets/columns/ +Accept: application/json + +HTTP 200 +[Asserts] +header "Content-Type" == "application/json" + +### + +GET http://127.0.0.1:5001/api/v1/assets/owner-ids/ +Accept: application/json + +HTTP 200 +[Asserts] +header "Content-Type" == "application/json" + +### + +GET http://127.0.0.1:5001/api/v1/assets/5f0b1052-466d-44de-a554-226d7256850d +Accept: application/json + +HTTP 200 +[Asserts] +header "Content-Type" == "application/json" + +### + +GET http://127.0.0.1:5001/api/v1/assets/5f0b1052-466d-44de-a554-226d7256850d/random-paths/ +Accept: application/json + +HTTP 200 +[Asserts] +header "Content-Type" == "application/json" + +### + +GET http://127.0.0.1:5001/api/v1/assets/5f0b1052-466d-44de-a554-226d7256850d/save-random-paths/ +Accept: application/json + +HTTP 200 +[Asserts] +header "Content-Type" == "application/json" + +### + +GET http://127.0.0.1:5001/api/v1/assets/5f0b1052-466d-44de-a554-226d7256850d/sync-immich/ +Accept: application/json + +HTTP 200 +[Asserts] +header "Content-Type" == "application/json" + +### + +GET http://127.0.0.1:5001/api/v1/assets/5f0b1052-466d-44de-a554-226d7256850d/set-archive-immich/ +Accept: application/json + +HTTP 200 +[Asserts] +header "Content-Type" == "application/json" + +### + +GET http://127.0.0.1:5001/api/v1/assets/5f0b1052-466d-44de-a554-226d7256850d/set-digi-kam-4-archive-immich/ +Accept: application/json + +HTTP 200 +[Asserts] +header "Content-Type" == "application/json" + +### + +GET http://127.0.0.1:5001/api/v1/assets/5f0b1052-466d-44de-a554-226d7256850d/archived-tag/ +Accept: application/json + +HTTP 200 +[Asserts] +header "Content-Type" == "application/json" + +### diff --git a/src/ImmichToSlideshow/DependencyInjection/ServiceCollectionExtensions.cs b/src/ImmichToSlideshow/DependencyInjection/ServiceCollectionExtensions.cs index 89bcdb9..931aa89 100644 --- a/src/ImmichToSlideshow/DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/ImmichToSlideshow/DependencyInjection/ServiceCollectionExtensions.cs @@ -6,6 +6,7 @@ namespace ImmichToSlideshow.DependencyInjection; public static class ServiceCollectionExtensions { public static IServiceCollection AddServices(this IServiceCollection services, AppSettings appSettings) { + _ = services.AddControllers(); _ = services.AddScoped(); _ = services.AddSingleton(_ => appSettings); return services; diff --git a/src/ImmichToSlideshow/Models/AppSettings.cs b/src/ImmichToSlideshow/Models/AppSettings.cs index e316a2f..c344d12 100644 --- a/src/ImmichToSlideshow/Models/AppSettings.cs +++ b/src/ImmichToSlideshow/Models/AppSettings.cs @@ -11,28 +11,39 @@ public record AppSettings(string Company, Settings Settings, string URLs, string } private static void Verify(AppSettings appSettings) { - if (appSettings?.Company is null) + if (appSettings?.Company is null) { throw new NullReferenceException(nameof(Company)); - if (appSettings?.URLs is null) + } + if (appSettings?.URLs is null) { throw new NullReferenceException(nameof(URLs)); - if (appSettings?.WithOrigins is null) + } + if (appSettings?.WithOrigins is null) { throw new NullReferenceException(nameof(WithOrigins)); - if (appSettings?.Settings?.AddDays is null) + } + if (appSettings?.Settings?.AddDays is null) { throw new NullReferenceException(nameof(Settings.AddDays)); - if (appSettings?.Settings?.ArchivedTag is null) + } + if (appSettings?.Settings?.ArchivedTag is null) { throw new NullReferenceException(nameof(Settings.ArchivedTag)); - if (appSettings?.Settings?.ConnectionString is null) + } + if (appSettings?.Settings?.ConnectionString is null) { throw new NullReferenceException(nameof(Settings.ConnectionString)); - if (appSettings?.Settings?.DigiKam4 is null) + } + if (appSettings?.Settings?.DigiKam4 is null) { throw new NullReferenceException(nameof(Settings.DigiKam4)); - if (appSettings?.Settings?.FilterTags is null) + } + if (appSettings?.Settings?.FilterTags is null) { throw new NullReferenceException(nameof(Settings.FilterTags)); - if (appSettings?.Settings?.ImmichUploadDirectory is null) + } + if (appSettings?.Settings?.ImmichUploadDirectory is null) { throw new NullReferenceException(nameof(Settings.ImmichUploadDirectory)); - if (appSettings?.Settings?.RandomResultsDirectory is null) + } + if (appSettings?.Settings?.RandomResultsDirectory is null) { throw new NullReferenceException(nameof(Settings.RandomResultsDirectory)); - if (appSettings?.Settings?.SyncDirectory is null) + } + if (appSettings?.Settings?.SyncDirectory is null) { throw new NullReferenceException(nameof(Settings.SyncDirectory)); + } } public static AppSettings Get(IConfigurationRoot configurationRoot) { @@ -46,10 +57,12 @@ public record AppSettings(string Company, Settings Settings, string URLs, string if (company is null || settings is null || urls is null || withOrigins is null) { List paths = []; foreach (IConfigurationProvider configurationProvider in configurationRoot.Providers) { - if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider) + if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider) { continue; - if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider) + } + if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider) { continue; + } paths.Add(physicalFileProvider.Root); } throw new NotSupportedException($"Not found!{Environment.NewLine}{string.Join(Environment.NewLine, paths.Distinct())}"); diff --git a/src/ImmichToSlideshow/Program.cs b/src/ImmichToSlideshow/Program.cs index 52358ca..f326f8c 100644 --- a/src/ImmichToSlideshow/Program.cs +++ b/src/ImmichToSlideshow/Program.cs @@ -10,7 +10,6 @@ public class Program { WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args); _ = webApplicationBuilder.Configuration.AddUserSecrets(); AppSettings appSettings = AppSettings.Get(webApplicationBuilder.Configuration); - _ = webApplicationBuilder.Services.AddControllers(); _ = webApplicationBuilder.Services.AddServices(appSettings); WebApplication webApplication = webApplicationBuilder.Build(); ILogger? logger = webApplication.Services.GetRequiredService>(); diff --git a/src/ImmichToSlideshow/Services/CommandText.cs b/src/ImmichToSlideshow/Services/CommandText.cs index af84293..b7afd7c 100644 --- a/src/ImmichToSlideshow/Services/CommandText.cs +++ b/src/ImmichToSlideshow/Services/CommandText.cs @@ -79,7 +79,7 @@ internal static class CommandText { } else { results.Add(" FROM public.asset a "); } - results.AddRange(" INNER "); + results.Add(" INNER "); if (lowestVersionHistory <= 1.129) { results.Add(" JOIN asset_files f "); } else {