2014-02-23 06:52:30 +01:00
|
|
|
|
using MediaBrowser.Controller.Providers;
|
2014-02-07 04:10:13 +01:00
|
|
|
|
using MediaBrowser.Model.Configuration;
|
2013-12-26 17:53:23 +01:00
|
|
|
|
using System.Collections.Generic;
|
2014-02-23 06:52:30 +01:00
|
|
|
|
using System.Linq;
|
2015-02-06 06:39:07 +01:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
2014-12-20 07:06:27 +01:00
|
|
|
|
using MediaBrowser.Model.Users;
|
2013-12-06 04:39:44 +01:00
|
|
|
|
|
2013-08-31 01:54:49 +02:00
|
|
|
|
namespace MediaBrowser.Controller.Entities
|
|
|
|
|
{
|
2015-09-29 19:35:23 +02:00
|
|
|
|
public class Book : BaseItem, IHasTags, IHasLookupInfo<BookInfo>, IHasSeries
|
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
|
|
|
|
|
2013-08-31 01:54:49 +02:00
|
|
|
|
public string SeriesName { get; set; }
|
|
|
|
|
|
2015-02-06 06:39:07 +01:00
|
|
|
|
public override bool CanDownload()
|
|
|
|
|
{
|
|
|
|
|
var locationType = LocationType;
|
|
|
|
|
return locationType != LocationType.Remote &&
|
|
|
|
|
locationType != LocationType.Virtual;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-20 07:06:27 +01:00
|
|
|
|
protected override bool GetBlockUnratedValue(UserPolicy config)
|
2013-12-26 17:53:23 +01:00
|
|
|
|
{
|
2014-02-21 16:24:29 +01:00
|
|
|
|
return config.BlockUnratedItems.Contains(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))
|
|
|
|
|
{
|
|
|
|
|
info.SeriesName = Parents.Select(i => i.Name).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
info.SeriesName = SeriesName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return info;
|
2014-02-07 04:10:13 +01:00
|
|
|
|
}
|
2013-08-31 01:54:49 +02:00
|
|
|
|
}
|
|
|
|
|
}
|