2014-02-22 22:52:30 -07:00
|
|
|
|
using MediaBrowser.Controller.Providers;
|
2014-02-06 20:10:13 -07:00
|
|
|
|
using MediaBrowser.Model.Configuration;
|
2013-12-26 09:53:23 -07:00
|
|
|
|
using System.Collections.Generic;
|
2014-02-22 22:52:30 -07:00
|
|
|
|
using System.Linq;
|
2015-02-05 22:39:07 -07:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
2014-12-19 23:06:27 -07:00
|
|
|
|
using MediaBrowser.Model.Users;
|
2013-12-05 20:39:44 -07:00
|
|
|
|
|
2013-08-30 16:54:49 -07:00
|
|
|
|
namespace MediaBrowser.Controller.Entities
|
|
|
|
|
{
|
2014-02-08 13:02:35 -07:00
|
|
|
|
public class Book : BaseItem, IHasTags, IHasPreferredMetadataLanguage, IHasLookupInfo<BookInfo>, IHasSeries
|
2013-08-30 16:54:49 -07:00
|
|
|
|
{
|
|
|
|
|
public override string MediaType
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Model.Entities.MediaType.Book;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-26 17:23:58 -07:00
|
|
|
|
|
2013-12-05 20:39:44 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the tags.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The tags.</value>
|
|
|
|
|
public List<string> Tags { get; set; }
|
2013-08-30 16:54:49 -07:00
|
|
|
|
|
|
|
|
|
public string SeriesName { get; set; }
|
|
|
|
|
|
2013-12-26 17:23:58 -07:00
|
|
|
|
public string PreferredMetadataLanguage { get; set; }
|
|
|
|
|
|
2013-12-28 09:58:13 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the preferred metadata country code.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The preferred metadata country code.</value>
|
|
|
|
|
public string PreferredMetadataCountryCode { get; set; }
|
|
|
|
|
|
2013-12-05 20:39:44 -07:00
|
|
|
|
public Book()
|
|
|
|
|
{
|
|
|
|
|
Tags = new List<string>();
|
|
|
|
|
}
|
2013-12-26 09:53:23 -07:00
|
|
|
|
|
2015-02-05 22:39:07 -07:00
|
|
|
|
public override bool CanDownload()
|
|
|
|
|
{
|
|
|
|
|
var locationType = LocationType;
|
|
|
|
|
return locationType != LocationType.Remote &&
|
|
|
|
|
locationType != LocationType.Virtual;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-19 23:06:27 -07:00
|
|
|
|
protected override bool GetBlockUnratedValue(UserPolicy config)
|
2013-12-26 09:53:23 -07:00
|
|
|
|
{
|
2014-02-21 08:24:29 -07:00
|
|
|
|
return config.BlockUnratedItems.Contains(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))
|
|
|
|
|
{
|
|
|
|
|
info.SeriesName = Parents.Select(i => i.Name).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
info.SeriesName = SeriesName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return info;
|
2014-02-06 20:10:13 -07:00
|
|
|
|
}
|
2013-08-30 16:54:49 -07:00
|
|
|
|
}
|
|
|
|
|
}
|