jellyfin/MediaBrowser.Controller/Entities/Book.cs

83 lines
2.1 KiB
C#
Raw Normal View History

2016-07-04 23:01:31 -07:00
using System;
using MediaBrowser.Controller.Providers;
2014-02-06 20:10:13 -07:00
using MediaBrowser.Model.Configuration;
2014-02-22 22:52:30 -07:00
using System.Linq;
2016-10-25 12:02:04 -07:00
using MediaBrowser.Model.Serialization;
2015-02-05 22:39:07 -07:00
using MediaBrowser.Model.Entities;
2013-12-05 20:39:44 -07:00
2013-08-30 16:54:49 -07:00
namespace MediaBrowser.Controller.Entities
{
2016-06-02 10:43:29 -07:00
public class Book : BaseItem, IHasLookupInfo<BookInfo>, IHasSeries
2013-08-30 16:54:49 -07:00
{
2016-03-17 23:36:58 -07:00
[IgnoreDataMember]
2013-08-30 16:54:49 -07:00
public override string MediaType
{
get
{
return Model.Entities.MediaType.Book;
}
}
2016-12-06 01:24:29 -07:00
[IgnoreDataMember]
public string SeriesPresentationUniqueKey { get; set; }
2016-07-04 13:11:30 -07:00
[IgnoreDataMember]
2013-08-30 16:54:49 -07:00
public string SeriesName { get; set; }
2016-07-07 20:22:02 -07:00
[IgnoreDataMember]
2016-07-04 23:01:31 -07:00
public Guid? SeriesId { get; set; }
2016-07-10 08:44:53 -07:00
[IgnoreDataMember]
public string SeriesSortName { get; set; }
2013-08-30 16:54:49 -07:00
2016-07-10 08:44:53 -07:00
public string FindSeriesSortName()
{
return SeriesSortName;
}
2016-07-04 13:11:30 -07:00
public string FindSeriesName()
{
return SeriesName;
}
2016-12-06 01:24:29 -07:00
public string FindSeriesPresentationUniqueKey()
{
return SeriesPresentationUniqueKey;
}
2016-07-04 13:11:30 -07:00
2016-07-24 09:46:17 -07:00
[IgnoreDataMember]
public override bool EnableRefreshOnDateModifiedChange
2016-07-24 09:46:17 -07:00
{
get { return true; }
}
2016-07-04 23:01:31 -07:00
public Guid? FindSeriesId()
{
return SeriesId;
}
2015-02-05 22:39:07 -07:00
public override bool CanDownload()
{
var locationType = LocationType;
return locationType != LocationType.Remote &&
locationType != LocationType.Virtual;
}
2015-11-06 08:02:22 -07:00
public override UnratedItem GetBlockUnratedType()
2013-12-26 09:53:23 -07:00
{
2015-11-06 08:02:22 -07:00
return UnratedItem.Book;
2013-12-26 09:53:23 -07:00
}
2014-02-06 20:10:13 -07:00
public BookInfo GetLookupInfo()
{
2014-02-08 21:52:52 -07:00
var info = GetItemLookupInfo<BookInfo>();
if (string.IsNullOrEmpty(SeriesName))
{
2015-11-11 07:56:31 -07:00
info.SeriesName = GetParents().Select(i => i.Name).FirstOrDefault();
2014-02-08 21:52:52 -07:00
}
else
{
info.SeriesName = SeriesName;
}
return info;
2014-02-06 20:10:13 -07:00
}
2013-08-30 16:54:49 -07:00
}
}