Added episode status to back end, getting ready for backlog

This commit is contained in:
kay.one 2011-05-22 09:53:06 -07:00
parent 3bfa1c52b7
commit f33c2c4939
7 changed files with 177 additions and 31 deletions

View file

@ -23,12 +23,40 @@ namespace NzbDrone.Core.Repository
[SubSonicLongString]
public string Overview { get; set; }
public string Language { get; set; }
public EpisodeStatusType Status { get; set; }
public Boolean Ignored { get; set; }
public DateTime? LastInfoSync { get; set; }
public DateTime? LastDiskSync { get; set; }
/// <summary>
/// Gets or sets the grab date.
/// </summary>
/// <remarks>
/// Used to specify when the episode was grapped.
/// this filed is used by status as an expirable "Grabbed" status.
/// </remarks>
public DateTime? GrabDate { get; set; }
[SubSonicIgnore]
public EpisodeStatusType Status
{
get
{
if (Ignored || (Season != null && !Season.Monitored)) return EpisodeStatusType.Ignored;
if (GrabDate != null && GrabDate.Value.AddDays(1) >= DateTime.Now)
{
return EpisodeStatusType.Downloading;
}
if (EpisodeFileId != 0) return EpisodeStatusType.Ready;
if (DateTime.Now.Date >= AirDate.Date)
{
return EpisodeStatusType.Missing;
}
return EpisodeStatusType.NotAired;
}
}
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
public virtual Season Season { get; set; }