2018-02-19 07:18:14 +00:00
|
|
|
using System;
|
2014-09-13 23:13:00 +00:00
|
|
|
using System.Collections.Generic;
|
2019-12-22 22:08:53 +00:00
|
|
|
using System.Linq;
|
2018-02-19 07:18:14 +00:00
|
|
|
using NzbDrone.Api.Movies;
|
2014-12-19 00:26:42 +00:00
|
|
|
using NzbDrone.Core.Download.TrackedDownloads;
|
2015-01-31 08:24:09 +00:00
|
|
|
using NzbDrone.Core.Indexers;
|
2019-12-22 22:08:53 +00:00
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
using Radarr.Http.REST;
|
2013-10-02 05:20:30 +00:00
|
|
|
|
|
|
|
namespace NzbDrone.Api.Queue
|
|
|
|
{
|
|
|
|
public class QueueResource : RestResource
|
|
|
|
{
|
2017-01-02 21:01:11 +00:00
|
|
|
public MovieResource Movie { get; set; }
|
2013-10-02 05:20:30 +00:00
|
|
|
public QualityModel Quality { get; set; }
|
2015-10-03 17:45:26 +00:00
|
|
|
public decimal Size { get; set; }
|
|
|
|
public string Title { get; set; }
|
|
|
|
public decimal Sizeleft { get; set; }
|
2014-05-24 10:50:34 +00:00
|
|
|
public TimeSpan? Timeleft { get; set; }
|
2014-08-02 01:08:32 +00:00
|
|
|
public DateTime? EstimatedCompletionTime { get; set; }
|
2015-10-03 17:45:26 +00:00
|
|
|
public string Status { get; set; }
|
|
|
|
public string TrackedDownloadStatus { get; set; }
|
2014-09-13 23:13:00 +00:00
|
|
|
public List<TrackedDownloadStatusMessage> StatusMessages { get; set; }
|
2015-10-03 17:45:26 +00:00
|
|
|
public string DownloadId { get; set; }
|
2015-01-31 08:24:09 +00:00
|
|
|
public DownloadProtocol Protocol { get; set; }
|
2013-10-02 05:20:30 +00:00
|
|
|
}
|
2016-03-25 00:56:29 +00:00
|
|
|
|
|
|
|
public static class QueueResourceMapper
|
|
|
|
{
|
|
|
|
public static QueueResource ToResource(this Core.Queue.Queue model)
|
|
|
|
{
|
2019-12-22 22:08:53 +00:00
|
|
|
if (model == null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2016-03-25 00:56:29 +00:00
|
|
|
|
|
|
|
return new QueueResource
|
|
|
|
{
|
|
|
|
Id = model.Id,
|
|
|
|
Quality = model.Quality,
|
|
|
|
Size = model.Size,
|
|
|
|
Title = model.Title,
|
|
|
|
Sizeleft = model.Sizeleft,
|
|
|
|
Timeleft = model.Timeleft,
|
|
|
|
EstimatedCompletionTime = model.EstimatedCompletionTime,
|
|
|
|
Status = model.Status,
|
|
|
|
TrackedDownloadStatus = model.TrackedDownloadStatus,
|
|
|
|
StatusMessages = model.StatusMessages,
|
|
|
|
DownloadId = model.DownloadId,
|
2017-01-02 21:01:11 +00:00
|
|
|
Protocol = model.Protocol,
|
|
|
|
Movie = model.Movie.ToResource()
|
2016-03-25 00:56:29 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public static List<QueueResource> ToResource(this IEnumerable<Core.Queue.Queue> models)
|
|
|
|
{
|
|
|
|
return models.Select(ToResource).ToList();
|
|
|
|
}
|
|
|
|
}
|
2013-10-02 05:20:30 +00:00
|
|
|
}
|