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