From 3501e337223af44693880ea8d03d10a6588a0ab5 Mon Sep 17 00:00:00 2001 From: margaale Date: Wed, 22 Feb 2017 13:57:14 -0300 Subject: [PATCH] turn task type enum into string --- .../TorrentDownloadStationFixture.cs | 18 +++++++++--------- .../UsenetDownloadStationFixture.cs | 10 +++++----- .../DownloadStation/DownloadStationTask.cs | 8 +++++--- .../Proxies/DownloadStationProxy.cs | 2 +- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs index f49ad27dd..34c48cea9 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs @@ -60,7 +60,7 @@ public void Setup() Id = "id1", Size = 1000, Status = DownloadStationTaskStatus.Waiting, - Type = DownloadStationTaskType.BT, + Type = DownloadStationTaskType.BT.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -83,7 +83,7 @@ public void Setup() Id = "id2", Size = 1000, Status = DownloadStationTaskStatus.Finished, - Type = DownloadStationTaskType.BT, + Type = DownloadStationTaskType.BT.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -106,7 +106,7 @@ public void Setup() Id = "id2", Size = 1000, Status = DownloadStationTaskStatus.Seeding, - Type = DownloadStationTaskType.BT, + Type = DownloadStationTaskType.BT.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -129,7 +129,7 @@ public void Setup() Id = "id3", Size = 1000, Status = DownloadStationTaskStatus.Downloading, - Type = DownloadStationTaskType.BT, + Type = DownloadStationTaskType.BT.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -152,7 +152,7 @@ public void Setup() Id = "id4", Size = 1000, Status = DownloadStationTaskStatus.Error, - Type = DownloadStationTaskType.BT, + Type = DownloadStationTaskType.BT.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -175,7 +175,7 @@ public void Setup() Id = "id5", Size = 1000, Status = DownloadStationTaskStatus.Seeding, - Type = DownloadStationTaskType.BT, + Type = DownloadStationTaskType.BT.ToString(), Username = "admin", Title = "a.mkv", Additional = new DownloadStationTaskAdditional @@ -198,7 +198,7 @@ public void Setup() Id = "id6", Size = 1000, Status = DownloadStationTaskStatus.Seeding, - Type = DownloadStationTaskType.BT, + Type = DownloadStationTaskType.BT.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -221,7 +221,7 @@ public void Setup() Id = "id6", Size = 1000, Status = DownloadStationTaskStatus.Finished, - Type = DownloadStationTaskType.BT, + Type = DownloadStationTaskType.BT.ToString(), Username = "admin", Title = "a.mkv", Additional = new DownloadStationTaskAdditional @@ -244,7 +244,7 @@ public void Setup() Id = "id6", Size = 1000, Status = DownloadStationTaskStatus.Finished, - Type = DownloadStationTaskType.BT, + Type = DownloadStationTaskType.BT.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs index f578465ff..c9b672f75 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs @@ -58,7 +58,7 @@ public void Setup() Id = "id1", Size = 1000, Status = DownloadStationTaskStatus.Waiting, - Type = DownloadStationTaskType.NZB, + Type = DownloadStationTaskType.NZB.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -81,7 +81,7 @@ public void Setup() Id = "id2", Size = 1000, Status = DownloadStationTaskStatus.Finished, - Type = DownloadStationTaskType.NZB, + Type = DownloadStationTaskType.NZB.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -104,7 +104,7 @@ public void Setup() Id = "id2", Size = 1000, Status = DownloadStationTaskStatus.Seeding, - Type = DownloadStationTaskType.NZB, + Type = DownloadStationTaskType.NZB.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -127,7 +127,7 @@ public void Setup() Id = "id3", Size = 1000, Status = DownloadStationTaskStatus.Downloading, - Type = DownloadStationTaskType.NZB, + Type = DownloadStationTaskType.NZB.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional @@ -150,7 +150,7 @@ public void Setup() Id = "id4", Size = 1000, Status = DownloadStationTaskStatus.Error, - Type = DownloadStationTaskType.NZB, + Type = DownloadStationTaskType.NZB.ToString(), Username = "admin", Title = "title", Additional = new DownloadStationTaskAdditional diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/DownloadStationTask.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/DownloadStationTask.cs index 1714ac3ba..a22cc7296 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/DownloadStationTask.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/DownloadStationTask.cs @@ -15,8 +15,10 @@ public class DownloadStationTask public long Size { get; set; } - [JsonConverter(typeof(StringEnumConverter))] - public DownloadStationTaskType Type { get; set; } + /// + /// /// Possible values are: BT, NZB, http, ftp, eMule and https + /// + public string Type { get; set; } [JsonProperty(PropertyName = "status_extra")] public Dictionary StatusExtra { get; set; } @@ -34,7 +36,7 @@ public override string ToString() public enum DownloadStationTaskType { - BT, NZB, http, ftp, eMule + BT, NZB, http, ftp, eMule, https } public enum DownloadStationTaskStatus diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/Proxies/DownloadStationProxy.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/Proxies/DownloadStationProxy.cs index ab823e884..823ac9ad9 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/Proxies/DownloadStationProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/Proxies/DownloadStationProxy.cs @@ -76,7 +76,7 @@ public IEnumerable GetTasks(DownloadStationTaskType type, D { var response = ProcessRequest(DiskStationApi.DownloadStationTask, arguments, settings, "get tasks"); - return response.Data.Tasks.Where(t => t.Type == type); + return response.Data.Tasks.Where(t => t.Type == type.ToString()); } catch (DownloadClientException e) {