Skip to content

Usenet streaming with a WebDAV server and a SABnzbd-compatible API

C#

[Refactor] Move usenet clients to `NzbWebDAV.Clients.Usenet` namespace.

nzbdav-dev24191ad71e52
diff --git a/backend/Api/Controllers/TestUsenetConnection/TestUsenetConnectionController.cs b/backend/Api/Controllers/TestUsenetConnection/TestUsenetConnectionController.cs
index 4b3b6fb8..6e27ef85 100644
--- a/backend/Api/Controllers/TestUsenetConnection/TestUsenetConnectionController.cs
+++ b/backend/Api/Controllers/TestUsenetConnection/TestUsenetConnectionController.cs
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Exceptions;
namespace NzbWebDAV.Api.Controllers.TestUsenetConnection;
diff --git a/backend/Clients/CachingNntpClient.cs b/backend/Clients/Usenet/CachingNntpClient.cs
similarity index 97%
rename from backend/Clients/CachingNntpClient.cs
rename to backend/Clients/Usenet/CachingNntpClient.cs
index 2f70897b..60108e89 100644
--- a/backend/Clients/CachingNntpClient.cs
+++ b/backend/Clients/Usenet/CachingNntpClient.cs
@@ -3,7 +3,7 @@ using NzbWebDAV.Streams;
using Usenet.Nzb;
using Usenet.Yenc;
-namespace NzbWebDAV.Clients;
+namespace NzbWebDAV.Clients.Usenet;
public class CachingNntpClient(INntpClient client, MemoryCache cache) : WrappingNntpClient(client)
{
diff --git a/backend/Clients/Connections/ConnectionLock.cs b/backend/Clients/Usenet/Connections/ConnectionLock.cs
similarity index 98%
rename from backend/Clients/Connections/ConnectionLock.cs
rename to backend/Clients/Usenet/Connections/ConnectionLock.cs
index a828b3b3..e2c6d555 100644
--- a/backend/Clients/Connections/ConnectionLock.cs
+++ b/backend/Clients/Usenet/Connections/ConnectionLock.cs
@@ -1,4 +1,4 @@
-namespace NzbWebDAV.Clients.Connections;
+namespace NzbWebDAV.Clients.Usenet.Connections;
/// <summary>
/// Disposable wrapper that automatically returns a borrowed connection to the
diff --git a/backend/Clients/Connections/ConnectionPool.cs b/backend/Clients/Usenet/Connections/ConnectionPool.cs
similarity index 99%
rename from backend/Clients/Connections/ConnectionPool.cs
rename to backend/Clients/Usenet/Connections/ConnectionPool.cs
index bb99ce9b..3b2c1b83 100644
--- a/backend/Clients/Connections/ConnectionPool.cs
+++ b/backend/Clients/Usenet/Connections/ConnectionPool.cs
@@ -2,7 +2,7 @@ using System.Collections.Concurrent;
using System.Runtime.CompilerServices;
using NzbWebDAV.Extensions;
-namespace NzbWebDAV.Clients.Connections;
+namespace NzbWebDAV.Clients.Usenet.Connections;
/// <summary>
/// Thread-safe, lazy connection pool.
diff --git a/backend/Clients/Connections/ExtendedSemaphoreSlim.cs b/backend/Clients/Usenet/Connections/ExtendedSemaphoreSlim.cs
similarity index 99%
rename from backend/Clients/Connections/ExtendedSemaphoreSlim.cs
rename to backend/Clients/Usenet/Connections/ExtendedSemaphoreSlim.cs
index b19e96ce..b1a1da63 100644
--- a/backend/Clients/Connections/ExtendedSemaphoreSlim.cs
+++ b/backend/Clients/Usenet/Connections/ExtendedSemaphoreSlim.cs
@@ -1,4 +1,4 @@
-namespace NzbWebDAV.Clients.Connections
+namespace NzbWebDAV.Clients.Usenet.Connections
{
/// <summary>
/// A semaphore-like primitive where each waiter specifies the number of
diff --git a/backend/Clients/Connections/ReservedConnectionsContext.cs b/backend/Clients/Usenet/Connections/ReservedConnectionsContext.cs
similarity index 68%
rename from backend/Clients/Connections/ReservedConnectionsContext.cs
rename to backend/Clients/Usenet/Connections/ReservedConnectionsContext.cs
index 090ae8d6..918dc6dd 100644
--- a/backend/Clients/Connections/ReservedConnectionsContext.cs
+++ b/backend/Clients/Usenet/Connections/ReservedConnectionsContext.cs
@@ -1,4 +1,4 @@
-namespace NzbWebDAV.Clients.Connections;
+namespace NzbWebDAV.Clients.Usenet.Connections;
public readonly struct ReservedConnectionsContext(int reservedCount)
{
diff --git a/backend/Clients/INntpClient.cs b/backend/Clients/Usenet/INntpClient.cs
similarity index 95%
rename from backend/Clients/INntpClient.cs
rename to backend/Clients/Usenet/INntpClient.cs
index a00a1dfb..583a39d0 100644
--- a/backend/Clients/INntpClient.cs
+++ b/backend/Clients/Usenet/INntpClient.cs
@@ -3,7 +3,7 @@ using Usenet.Nntp.Responses;
using Usenet.Nzb;
using Usenet.Yenc;
-namespace NzbWebDAV.Clients;
+namespace NzbWebDAV.Clients.Usenet;
public interface INntpClient: IDisposable
{
diff --git a/backend/Clients/MultiConnectionNntpClient.cs b/backend/Clients/Usenet/MultiConnectionNntpClient.cs
similarity index 97%
rename from backend/Clients/MultiConnectionNntpClient.cs
rename to backend/Clients/Usenet/MultiConnectionNntpClient.cs
index 5785e943..0dc02f86 100644
--- a/backend/Clients/MultiConnectionNntpClient.cs
+++ b/backend/Clients/Usenet/MultiConnectionNntpClient.cs
@@ -1,11 +1,11 @@
-using NzbWebDAV.Clients.Connections;
+using NzbWebDAV.Clients.Usenet.Connections;
using NzbWebDAV.Streams;
using Usenet.Exceptions;
using Usenet.Nntp.Responses;
using Usenet.Nzb;
using Usenet.Yenc;
-namespace NzbWebDAV.Clients;
+namespace NzbWebDAV.Clients.Usenet;
public class MultiConnectionNntpClient(ConnectionPool<INntpClient> connectionPool) : INntpClient
{
diff --git a/backend/Clients/ThreadSafeNntpClient.cs b/backend/Clients/Usenet/ThreadSafeNntpClient.cs
similarity index 99%
rename from backend/Clients/ThreadSafeNntpClient.cs
rename to backend/Clients/Usenet/ThreadSafeNntpClient.cs
index 54fffd3a..0c6ed3bf 100644
--- a/backend/Clients/ThreadSafeNntpClient.cs
+++ b/backend/Clients/Usenet/ThreadSafeNntpClient.cs
@@ -7,7 +7,7 @@ using Usenet.Nntp.Responses;
using Usenet.Nzb;
using Usenet.Yenc;
-namespace NzbWebDAV.Clients;
+namespace NzbWebDAV.Clients.Usenet;
public class ThreadSafeNntpClient : INntpClient
{
diff --git a/backend/Clients/UsenetStreamingClient.cs b/backend/Clients/Usenet/UsenetStreamingClient.cs
similarity index 98%
rename from backend/Clients/UsenetStreamingClient.cs
rename to backend/Clients/Usenet/UsenetStreamingClient.cs
index 1cad6928..d0a3e5d1 100644
--- a/backend/Clients/UsenetStreamingClient.cs
+++ b/backend/Clients/Usenet/UsenetStreamingClient.cs
@@ -1,5 +1,5 @@
using Microsoft.Extensions.Caching.Memory;
-using NzbWebDAV.Clients.Connections;
+using NzbWebDAV.Clients.Usenet.Connections;
using NzbWebDAV.Config;
using NzbWebDAV.Exceptions;
using NzbWebDAV.Extensions;
@@ -8,7 +8,7 @@ using NzbWebDAV.Websocket;
using Usenet.Nntp.Responses;
using Usenet.Nzb;
-namespace NzbWebDAV.Clients;
+namespace NzbWebDAV.Clients.Usenet;
public class UsenetStreamingClient
{
diff --git a/backend/Clients/WrappingNntpClient.cs b/backend/Clients/Usenet/WrappingNntpClient.cs
similarity index 97%
rename from backend/Clients/WrappingNntpClient.cs
rename to backend/Clients/Usenet/WrappingNntpClient.cs
index 4a6b72a1..2d5180f6 100644
--- a/backend/Clients/WrappingNntpClient.cs
+++ b/backend/Clients/Usenet/WrappingNntpClient.cs
@@ -3,7 +3,7 @@ using Usenet.Nntp.Responses;
using Usenet.Nzb;
using Usenet.Yenc;
-namespace NzbWebDAV.Clients;
+namespace NzbWebDAV.Clients.Usenet;
public abstract class WrappingNntpClient(INntpClient client) : INntpClient
{
diff --git a/backend/Program.cs b/backend/Program.cs
index 5bd45227..08c83a07 100644
--- a/backend/Program.cs
+++ b/backend/Program.cs
@@ -8,7 +8,7 @@ using NWebDav.Server;
using NWebDav.Server.Authentication;
using NWebDav.Server.Stores;
using NzbWebDAV.Api.SabControllers;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Extensions;
diff --git a/backend/Queue/DeobfuscationSteps/1.FetchFirstSegment/FetchFirstSegmentsStep.cs b/backend/Queue/DeobfuscationSteps/1.FetchFirstSegment/FetchFirstSegmentsStep.cs
index 255e8a1d..dbfc1bb4 100644
--- a/backend/Queue/DeobfuscationSteps/1.FetchFirstSegment/FetchFirstSegmentsStep.cs
+++ b/backend/Queue/DeobfuscationSteps/1.FetchFirstSegment/FetchFirstSegmentsStep.cs
@@ -1,6 +1,6 @@
// ReSharper disable InconsistentNaming
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Exceptions;
using NzbWebDAV.Extensions;
diff --git a/backend/Queue/DeobfuscationSteps/2.GetPar2FileDescriptors/GetPar2FileDescriptorsStep.cs b/backend/Queue/DeobfuscationSteps/2.GetPar2FileDescriptors/GetPar2FileDescriptorsStep.cs
index e6e60be7..2329e9c0 100644
--- a/backend/Queue/DeobfuscationSteps/2.GetPar2FileDescriptors/GetPar2FileDescriptorsStep.cs
+++ b/backend/Queue/DeobfuscationSteps/2.GetPar2FileDescriptors/GetPar2FileDescriptorsStep.cs
@@ -1,4 +1,4 @@
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Extensions;
using NzbWebDAV.Par2Recovery;
using NzbWebDAV.Par2Recovery.Packets;
diff --git a/backend/Queue/FileProcessors/FileProcessor.cs b/backend/Queue/FileProcessors/FileProcessor.cs
index 0cf8a7d5..643d27ee 100644
--- a/backend/Queue/FileProcessors/FileProcessor.cs
+++ b/backend/Queue/FileProcessors/FileProcessor.cs
@@ -1,4 +1,4 @@
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Exceptions;
using NzbWebDAV.Queue.DeobfuscationSteps._3.GetFileInfos;
using NzbWebDAV.Utils;
diff --git a/backend/Queue/FileProcessors/MultipartMkvProcessor.cs b/backend/Queue/FileProcessors/MultipartMkvProcessor.cs
index b7d8ca5a..7bfd176c 100644
--- a/backend/Queue/FileProcessors/MultipartMkvProcessor.cs
+++ b/backend/Queue/FileProcessors/MultipartMkvProcessor.cs
@@ -1,5 +1,5 @@
using System.Text.RegularExpressions;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Database.Models;
using NzbWebDAV.Extensions;
using NzbWebDAV.Queue.DeobfuscationSteps._3.GetFileInfos;
diff --git a/backend/Queue/FileProcessors/RarProcessor.cs b/backend/Queue/FileProcessors/RarProcessor.cs
index dafa4904..9b015d3a 100644
--- a/backend/Queue/FileProcessors/RarProcessor.cs
+++ b/backend/Queue/FileProcessors/RarProcessor.cs
@@ -1,5 +1,5 @@
using System.Text.RegularExpressions;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Exceptions;
using NzbWebDAV.Extensions;
using NzbWebDAV.Queue.DeobfuscationSteps._3.GetFileInfos;
diff --git a/backend/Queue/FileProcessors/SevenZipProcessor.cs b/backend/Queue/FileProcessors/SevenZipProcessor.cs
index f2ea7b14..34689e5d 100644
--- a/backend/Queue/FileProcessors/SevenZipProcessor.cs
+++ b/backend/Queue/FileProcessors/SevenZipProcessor.cs
@@ -1,5 +1,5 @@
using System.Text.RegularExpressions;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Database.Models;
using NzbWebDAV.Exceptions;
using NzbWebDAV.Extensions;
diff --git a/backend/Queue/QueueItemProcessor.cs b/backend/Queue/QueueItemProcessor.cs
index 2586d977..e828881e 100644
--- a/backend/Queue/QueueItemProcessor.cs
+++ b/backend/Queue/QueueItemProcessor.cs
@@ -1,8 +1,8 @@
using System.Text;
using Microsoft.EntityFrameworkCore;
using NzbWebDAV.Api.SabControllers.GetHistory;
-using NzbWebDAV.Clients;
-using NzbWebDAV.Clients.Connections;
+using NzbWebDAV.Clients.Usenet;
+using NzbWebDAV.Clients.Usenet.Connections;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Database.Models;
diff --git a/backend/Queue/QueueManager.cs b/backend/Queue/QueueManager.cs
index ab58249d..2f57c174 100644
--- a/backend/Queue/QueueManager.cs
+++ b/backend/Queue/QueueManager.cs
@@ -1,4 +1,4 @@
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Database.Models;
diff --git a/backend/Streams/MultipartFileStream.cs b/backend/Streams/MultipartFileStream.cs
index 1a85f7a5..2ee09646 100644
--- a/backend/Streams/MultipartFileStream.cs
+++ b/backend/Streams/MultipartFileStream.cs
@@ -1,4 +1,4 @@
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Models;
using NzbWebDAV.Utils;
diff --git a/backend/Streams/NzbFileStream.cs b/backend/Streams/NzbFileStream.cs
index d7921ec3..9b8c5fa3 100644
--- a/backend/Streams/NzbFileStream.cs
+++ b/backend/Streams/NzbFileStream.cs
@@ -1,4 +1,4 @@
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Extensions;
using NzbWebDAV.Models;
using NzbWebDAV.Utils;
diff --git a/backend/Streams/RarFileStream.cs b/backend/Streams/RarFileStream.cs
index 6e31d396..c3861f1b 100644
--- a/backend/Streams/RarFileStream.cs
+++ b/backend/Streams/RarFileStream.cs
@@ -1,4 +1,4 @@
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Database.Models;
using NzbWebDAV.Extensions;
diff --git a/backend/WebDav/DatabaseStore.cs b/backend/WebDav/DatabaseStore.cs
index ce67e0a7..3353cbd3 100644
--- a/backend/WebDav/DatabaseStore.cs
+++ b/backend/WebDav/DatabaseStore.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Http;
using NWebDav.Server.Stores;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Database.Models;
diff --git a/backend/WebDav/DatabaseStoreCollection.cs b/backend/WebDav/DatabaseStoreCollection.cs
index 1f349f7b..891acf52 100644
--- a/backend/WebDav/DatabaseStoreCollection.cs
+++ b/backend/WebDav/DatabaseStoreCollection.cs
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Http;
using NWebDav.Server;
using NWebDav.Server.Stores;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Database.Models;
diff --git a/backend/WebDav/DatabaseStoreIdFile.cs b/backend/WebDav/DatabaseStoreIdFile.cs
index 861c06c6..7a2e3544 100644
--- a/backend/WebDav/DatabaseStoreIdFile.cs
+++ b/backend/WebDav/DatabaseStoreIdFile.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Http;
using NWebDav.Server.Stores;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Database.Models;
diff --git a/backend/WebDav/DatabaseStoreIdsCollection.cs b/backend/WebDav/DatabaseStoreIdsCollection.cs
index a812e4c0..651c8ee1 100644
--- a/backend/WebDav/DatabaseStoreIdsCollection.cs
+++ b/backend/WebDav/DatabaseStoreIdsCollection.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Http;
using NWebDav.Server.Stores;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Database.Models;
diff --git a/backend/WebDav/DatabaseStoreNzbFile.cs b/backend/WebDav/DatabaseStoreNzbFile.cs
index c3083a60..2935f735 100644
--- a/backend/WebDav/DatabaseStoreNzbFile.cs
+++ b/backend/WebDav/DatabaseStoreNzbFile.cs
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Http;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Database.Models;
diff --git a/backend/WebDav/DatabaseStoreRarFile.cs b/backend/WebDav/DatabaseStoreRarFile.cs
index 090efad6..5073d3d8 100644
--- a/backend/WebDav/DatabaseStoreRarFile.cs
+++ b/backend/WebDav/DatabaseStoreRarFile.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Database.Models;
diff --git a/backend/WebDav/DatabaseStoreWatchFolder.cs b/backend/WebDav/DatabaseStoreWatchFolder.cs
index 71bb95b9..b4960e29 100644
--- a/backend/WebDav/DatabaseStoreWatchFolder.cs
+++ b/backend/WebDav/DatabaseStoreWatchFolder.cs
@@ -4,7 +4,7 @@ using NWebDav.Server;
using NWebDav.Server.Stores;
using NzbWebDAV.Api.SabControllers.AddFile;
using NzbWebDAV.Api.SabControllers.RemoveFromQueue;
-using NzbWebDAV.Clients;
+using NzbWebDAV.Clients.Usenet;
using NzbWebDAV.Config;
using NzbWebDAV.Database;
using NzbWebDAV.Database.Models;