2013-08-21 06:46:23 +00:00
|
|
|
|
using System;
|
2016-03-25 00:56:29 +00:00
|
|
|
|
using System.IO;
|
2013-08-21 06:46:23 +00:00
|
|
|
|
using NzbDrone.Api.REST;
|
2014-01-18 11:44:36 +00:00
|
|
|
|
using NzbDrone.Core.Qualities;
|
2013-08-21 06:46:23 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.EpisodeFiles
|
|
|
|
|
{
|
|
|
|
|
public class EpisodeFileResource : RestResource
|
|
|
|
|
{
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public int SeriesId { get; set; }
|
|
|
|
|
public int SeasonNumber { get; set; }
|
|
|
|
|
public string RelativePath { get; set; }
|
|
|
|
|
public string Path { get; set; }
|
|
|
|
|
public long Size { get; set; }
|
2013-08-21 06:46:23 +00:00
|
|
|
|
public DateTime DateAdded { get; set; }
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public string SceneName { get; set; }
|
2013-08-21 06:46:23 +00:00
|
|
|
|
public QualityModel Quality { get; set; }
|
2014-08-18 22:24:44 +00:00
|
|
|
|
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public bool QualityCutoffNotMet { get; set; }
|
2013-08-21 06:46:23 +00:00
|
|
|
|
}
|
2016-03-25 00:56:29 +00:00
|
|
|
|
|
|
|
|
|
public static class EpisodeFileResourceMapper
|
|
|
|
|
{
|
|
|
|
|
private static EpisodeFileResource ToResource(this Core.MediaFiles.EpisodeFile model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null) return null;
|
|
|
|
|
|
|
|
|
|
return new EpisodeFileResource
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
|
|
|
|
|
SeriesId = model.SeriesId,
|
|
|
|
|
SeasonNumber = model.SeasonNumber,
|
|
|
|
|
RelativePath = model.RelativePath,
|
|
|
|
|
//Path
|
|
|
|
|
Size = model.Size,
|
|
|
|
|
DateAdded = model.DateAdded,
|
|
|
|
|
SceneName = model.SceneName,
|
|
|
|
|
Quality = model.Quality,
|
|
|
|
|
//QualityCutoffNotMet
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static EpisodeFileResource ToResource(this Core.MediaFiles.EpisodeFile model, Core.Tv.Series series, Core.DecisionEngine.IQualityUpgradableSpecification qualityUpgradableSpecification)
|
|
|
|
|
{
|
|
|
|
|
if (model == null) return null;
|
|
|
|
|
|
|
|
|
|
return new EpisodeFileResource
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
|
|
|
|
|
SeriesId = model.SeriesId,
|
|
|
|
|
SeasonNumber = model.SeasonNumber,
|
|
|
|
|
RelativePath = model.RelativePath,
|
|
|
|
|
Path = Path.Combine(series.Path, model.RelativePath),
|
|
|
|
|
Size = model.Size,
|
|
|
|
|
DateAdded = model.DateAdded,
|
|
|
|
|
SceneName = model.SceneName,
|
|
|
|
|
Quality = model.Quality,
|
|
|
|
|
QualityCutoffNotMet = qualityUpgradableSpecification.CutoffNotMet(series.Profile.Value, model.Quality)
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-08-21 06:46:23 +00:00
|
|
|
|
}
|