jellyfin-server/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs

58 lines
1.3 KiB
C#
Raw Normal View History

2013-12-19 21:51:32 +00:00
using MediaBrowser.Controller.Entities;
2013-12-22 18:58:51 +00:00
using MediaBrowser.Model.LiveTv;
2014-01-12 15:58:47 +00:00
using System;
2013-12-19 21:51:32 +00:00
namespace MediaBrowser.Controller.LiveTv
{
public class LiveTvProgram : BaseItem
{
/// <summary>
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
{
return GetClientTypeName() + "-" + Name;
}
public ProgramInfo ProgramInfo { get; set; }
2013-12-22 18:58:51 +00:00
public ChannelType ChannelType { get; set; }
2013-12-19 21:51:32 +00:00
public string ServiceName { get; set; }
public override string MediaType
{
get
{
2013-12-22 18:58:51 +00:00
return ChannelType == ChannelType.TV ? Model.Entities.MediaType.Video : Model.Entities.MediaType.Audio;
2013-12-19 21:51:32 +00:00
}
}
2014-01-12 15:58:47 +00:00
public bool IsAiring
{
get
{
var now = DateTime.UtcNow;
return now >= ProgramInfo.StartDate && now < ProgramInfo.EndDate;
}
}
public bool HasAired
{
get
{
var now = DateTime.UtcNow;
return now >= ProgramInfo.EndDate;
}
}
2013-12-19 21:51:32 +00:00
public override string GetClientTypeName()
{
return "Program";
}
}
}