mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
Fixed: SABnzbd queue checking will not fail when items in queue are being repaired.
SabQueue priority is parsed with a custom converter to prevent blowing up because SAB decides to use Repair as a queue priority type.
This commit is contained in:
parent
11434a347b
commit
c4b57c4a23
6 changed files with 270 additions and 1 deletions
33
NzbDrone.Core/Helpers/SabnzbdPriorityTypeConverter.cs
Normal file
33
NzbDrone.Core/Helpers/SabnzbdPriorityTypeConverter.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.Model.Sabnzbd;
|
||||
|
||||
namespace NzbDrone.Core.Helpers
|
||||
{
|
||||
public class SabnzbdPriorityTypeConverter : JsonConverter
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
var priorityType = (SabPriorityType)value;
|
||||
writer.WriteValue(priorityType.ToString());
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
var queuePriority = reader.Value.ToString();
|
||||
|
||||
SabPriorityType output;
|
||||
Enum.TryParse(queuePriority, out output);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(SabPriorityType);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue