1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-03-05 15:15:59 +02:00
Sonarr/NzbDrone.Core/Tv/Episode.cs

63 lines
1.9 KiB
C#
Raw Normal View History

2013-03-06 12:30:53 -08:00
using System;
using Marr.Data;
using NzbDrone.Core.Datastore;
2013-02-28 23:03:41 -08:00
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Model;
2013-03-23 21:16:00 -07:00
namespace NzbDrone.Core.Tv
2010-10-04 23:21:18 -07:00
{
public class Episode : ModelBase
2010-10-04 23:21:18 -07:00
{
2013-02-24 16:00:17 -08:00
public int TvDbEpisodeId { get; set; }
public int SeriesId { get; set; }
2013-04-19 17:46:09 -07:00
public int EpisodeFileId { get; set; }
public int SeasonNumber { get; set; }
public int EpisodeNumber { get; set; }
public string Title { get; set; }
2011-06-22 23:56:17 -07:00
public DateTime? AirDate { get; set; }
public string Overview { get; set; }
public Boolean Ignored { get; set; }
public Nullable<Int32> AbsoluteEpisodeNumber { get; set; }
2012-10-16 22:00:28 -07:00
public int SceneSeasonNumber { get; set; }
public int SceneEpisodeNumber { get; set; }
public bool HasFile
{
get { return EpisodeFileId != 0; }
}
public EpisodeStatuses Status
{
get
{
if (HasFile) return EpisodeStatuses.Ready;
if (AirDate != null && AirDate.Value.Date == DateTime.Today)
return EpisodeStatuses.AirsToday;
2011-06-22 23:56:17 -07:00
if (AirDate != null && AirDate.Value.Date < DateTime.Now)
return EpisodeStatuses.Missing;
return EpisodeStatuses.NotAired;
}
}
2013-05-01 22:50:34 -07:00
public String SeriesTitle { get; private set; }
public Series Series { get; set; }
public LazyLoaded<EpisodeFile> EpisodeFile { get; set; }
public override string ToString()
{
string seriesTitle = Series == null ? "[NULL]" : Series.Title;
2013-03-23 21:16:00 -07:00
if (Series != null && Series.SeriesType == SeriesTypes.Daily && AirDate.HasValue)
return string.Format("{0} - {1:yyyy-MM-dd}", seriesTitle, AirDate.Value);
2011-05-28 12:23:35 -07:00
return string.Format("{0} - S{1:00}E{2:00}", seriesTitle, SeasonNumber, EpisodeNumber);
}
2010-10-04 23:21:18 -07:00
}
2011-04-09 19:44:01 -07:00
}