| | | 1 | | #nullable disable |
| | | 2 | | |
| | | 3 | | #pragma warning disable CS1591 |
| | | 4 | | |
| | | 5 | | using System; |
| | | 6 | | using System.Linq; |
| | | 7 | | using System.Text.Json.Serialization; |
| | | 8 | | using Jellyfin.Data.Enums; |
| | | 9 | | using MediaBrowser.Controller.Providers; |
| | | 10 | | |
| | | 11 | | namespace MediaBrowser.Controller.Entities |
| | | 12 | | { |
| | | 13 | | [Common.RequiresSourceSerialisation] |
| | | 14 | | public class Book : BaseItem, IHasLookupInfo<BookInfo>, IHasSeries |
| | | 15 | | { |
| | 5 | 16 | | public Book() |
| | | 17 | | { |
| | 5 | 18 | | this.RunTimeTicks = TimeSpan.TicksPerSecond; |
| | 5 | 19 | | } |
| | | 20 | | |
| | | 21 | | [JsonIgnore] |
| | 0 | 22 | | public override MediaType MediaType => MediaType.Book; |
| | | 23 | | |
| | 0 | 24 | | public override bool SupportsPlayedStatus => true; |
| | | 25 | | |
| | 0 | 26 | | public override bool SupportsPositionTicksResume => true; |
| | | 27 | | |
| | | 28 | | [JsonIgnore] |
| | 0 | 29 | | public override bool SupportsPeople => true; |
| | | 30 | | |
| | | 31 | | [JsonIgnore] |
| | | 32 | | public string SeriesPresentationUniqueKey { get; set; } |
| | | 33 | | |
| | | 34 | | [JsonIgnore] |
| | | 35 | | public string SeriesName { get; set; } |
| | | 36 | | |
| | | 37 | | [JsonIgnore] |
| | | 38 | | public Guid SeriesId { get; set; } |
| | | 39 | | |
| | | 40 | | public string FindSeriesSortName() |
| | | 41 | | { |
| | 0 | 42 | | return SeriesName; |
| | | 43 | | } |
| | | 44 | | |
| | | 45 | | public string FindSeriesName() |
| | | 46 | | { |
| | 0 | 47 | | return SeriesName; |
| | | 48 | | } |
| | | 49 | | |
| | | 50 | | public string FindSeriesPresentationUniqueKey() |
| | | 51 | | { |
| | 0 | 52 | | return SeriesPresentationUniqueKey; |
| | | 53 | | } |
| | | 54 | | |
| | | 55 | | public Guid FindSeriesId() |
| | | 56 | | { |
| | 0 | 57 | | return SeriesId; |
| | | 58 | | } |
| | | 59 | | |
| | | 60 | | /// <inheritdoc /> |
| | | 61 | | public override bool CanDownload() |
| | | 62 | | { |
| | 0 | 63 | | return IsFileProtocol; |
| | | 64 | | } |
| | | 65 | | |
| | | 66 | | /// <inheritdoc /> |
| | | 67 | | public override UnratedItem GetBlockUnratedType() |
| | | 68 | | { |
| | 0 | 69 | | return UnratedItem.Book; |
| | | 70 | | } |
| | | 71 | | |
| | | 72 | | public BookInfo GetLookupInfo() |
| | | 73 | | { |
| | 0 | 74 | | var info = GetItemLookupInfo<BookInfo>(); |
| | | 75 | | |
| | 0 | 76 | | if (string.IsNullOrEmpty(SeriesName)) |
| | | 77 | | { |
| | 0 | 78 | | info.SeriesName = GetParents().Select(i => i.Name).FirstOrDefault(); |
| | | 79 | | } |
| | | 80 | | else |
| | | 81 | | { |
| | 0 | 82 | | info.SeriesName = SeriesName; |
| | | 83 | | } |
| | | 84 | | |
| | 0 | 85 | | return info; |
| | | 86 | | } |
| | | 87 | | } |
| | | 88 | | } |