Radarr/src/Radarr.Api.V3/Blacklist/BlacklistResource.cs

56 lines
1.7 KiB
C#
Raw Normal View History

2018-11-23 07:03:32 +00:00
using System;
using System.Collections.Generic;
using NzbDrone.Core.CustomFormats;
2018-11-23 07:03:32 +00:00
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Languages;
2018-11-23 07:03:32 +00:00
using NzbDrone.Core.Qualities;
using Radarr.Api.V3.CustomFormats;
using Radarr.Api.V3.Movies;
2018-11-23 07:03:32 +00:00
using Radarr.Http.REST;
namespace Radarr.Api.V3.Blacklist
2018-11-23 07:03:32 +00:00
{
public class BlacklistResource : RestResource
{
public int MovieId { get; set; }
public string SourceTitle { get; set; }
public List<Language> Languages { get; set; }
2018-11-23 07:03:32 +00:00
public QualityModel Quality { get; set; }
public List<CustomFormatResource> CustomFormats { get; set; }
2018-11-23 07:03:32 +00:00
public DateTime Date { get; set; }
public DownloadProtocol Protocol { get; set; }
public string Indexer { get; set; }
public string Message { get; set; }
public MovieResource Movie { get; set; }
}
public static class BlacklistResourceMapper
{
public static BlacklistResource MapToResource(this NzbDrone.Core.Blacklisting.Blacklist model, ICustomFormatCalculationService formatCalculator)
2018-11-23 07:03:32 +00:00
{
2019-12-22 22:08:53 +00:00
if (model == null)
{
return null;
}
2018-11-23 07:03:32 +00:00
return new BlacklistResource
{
Id = model.Id,
MovieId = model.MovieId,
SourceTitle = model.SourceTitle,
Languages = model.Languages,
2018-11-23 07:03:32 +00:00
Quality = model.Quality,
CustomFormats = formatCalculator.ParseCustomFormat(model).ToResource(),
2018-11-23 07:03:32 +00:00
Date = model.Date,
Protocol = model.Protocol,
Indexer = model.Indexer,
Message = model.Message,
Movie = model.Movie.ToResource(0)
2018-11-23 07:03:32 +00:00
};
}
}
}