mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-03 09:09:42 +02:00
SabProvider can now get the entire Queue for additional processing.
This commit is contained in:
@@ -10,6 +10,7 @@ using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
@@ -103,6 +104,34 @@ namespace NzbDrone.Core.Providers
|
||||
return false; //Not in Queue
|
||||
}
|
||||
|
||||
public virtual List<SabQueueItem> GetQueue()
|
||||
{
|
||||
const string action = "mode=queue&output=xml";
|
||||
string request = GetSabRequest(action);
|
||||
string response = _httpProvider.DownloadString(request);
|
||||
|
||||
XDocument xDoc = XDocument.Parse(response);
|
||||
|
||||
//If an Error Occurred, return)
|
||||
if (xDoc.Descendants("error").Count() != 0)
|
||||
throw new ApplicationException(xDoc.Descendants("error").FirstOrDefault().Value);
|
||||
|
||||
if (!xDoc.Descendants("queue").Any())
|
||||
{
|
||||
Logger.Debug("SAB Queue is empty.");
|
||||
return new List<SabQueueItem>();
|
||||
}
|
||||
|
||||
var items = xDoc.Descendants("slot")
|
||||
.Select(s => new SabQueueItem
|
||||
{
|
||||
Title = s.Element("filename").Value,
|
||||
Id = s.Element("nzo_id").Value
|
||||
});
|
||||
|
||||
return items.ToList();
|
||||
}
|
||||
|
||||
public virtual String GetSabTitle(EpisodeParseResult parseResult)
|
||||
{
|
||||
//Handle Full Naming
|
||||
|
Reference in New Issue
Block a user