From dc34c85834bf6a6a9727d9a3d18d544c23e28838 Mon Sep 17 00:00:00 2001 From: Guillermo Marcel Date: Mon, 17 Feb 2025 13:37:00 -0300 Subject: [PATCH] feat: enable run dry options to skip download --- src/CasaBot/AutoScan/Implementations/ShinobiConnector.cs | 5 +++++ src/CasaBot/AutoScan/Options/ShinobiOptions.cs | 1 + src/CasaBot/CasaBotApp/appsettings.json | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/CasaBot/AutoScan/Implementations/ShinobiConnector.cs b/src/CasaBot/AutoScan/Implementations/ShinobiConnector.cs index f968bdb..e519a80 100644 --- a/src/CasaBot/AutoScan/Implementations/ShinobiConnector.cs +++ b/src/CasaBot/AutoScan/Implementations/ShinobiConnector.cs @@ -63,6 +63,11 @@ public class ShinobiConnector : IDVRConnector _logger.LogDebug("Downloading video..."); var videoData = await _httpClient.GetByteArrayAsync(endpoint); + if(_options.RunDry) + { + _logger.LogInformation("RunDry is enabled, skipping video download"); + return; + } //Write the video to the file await File.WriteAllBytesAsync(videoPath, videoData); _logger.LogInformation("Video downloaded successfully!"); diff --git a/src/CasaBot/AutoScan/Options/ShinobiOptions.cs b/src/CasaBot/AutoScan/Options/ShinobiOptions.cs index a5b710d..da72cfd 100644 --- a/src/CasaBot/AutoScan/Options/ShinobiOptions.cs +++ b/src/CasaBot/AutoScan/Options/ShinobiOptions.cs @@ -6,4 +6,5 @@ public class ShinobiOptions public string? APIKey { get; set; } public string? GroupId { get; set; } public string? MonitorId { get; set; } + public bool RunDry { get; set; } = false; } \ No newline at end of file diff --git a/src/CasaBot/CasaBotApp/appsettings.json b/src/CasaBot/CasaBotApp/appsettings.json index f8d2336..27a8631 100644 --- a/src/CasaBot/CasaBotApp/appsettings.json +++ b/src/CasaBot/CasaBotApp/appsettings.json @@ -16,7 +16,8 @@ "URL": "http://localhost:8080", "APIKey": "APIKEY", "GroupId": "Group", - "MonitorId": "Monitor" + "MonitorId": "Monitor", + "RunDry": false }, "AutoScan": { "Enabled": false,