| | 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 | | public class Book : BaseItem, IHasLookupInfo<BookInfo>, IHasSeries |
| | 14 | | { |
| 5 | 15 | | public Book() |
| | 16 | | { |
| 5 | 17 | | this.RunTimeTicks = TimeSpan.TicksPerSecond; |
| 5 | 18 | | } |
| | 19 | |
|
| | 20 | | [JsonIgnore] |
| 0 | 21 | | public override MediaType MediaType => MediaType.Book; |
| | 22 | |
|
| 0 | 23 | | public override bool SupportsPlayedStatus => true; |
| | 24 | |
|
| 0 | 25 | | public override bool SupportsPositionTicksResume => true; |
| | 26 | |
|
| | 27 | | [JsonIgnore] |
| 0 | 28 | | public override bool SupportsPeople => true; |
| | 29 | |
|
| | 30 | | [JsonIgnore] |
| | 31 | | public string SeriesPresentationUniqueKey { get; set; } |
| | 32 | |
|
| | 33 | | [JsonIgnore] |
| | 34 | | public string SeriesName { get; set; } |
| | 35 | |
|
| | 36 | | [JsonIgnore] |
| | 37 | | public Guid SeriesId { get; set; } |
| | 38 | |
|
| | 39 | | public string FindSeriesSortName() |
| | 40 | | { |
| 0 | 41 | | return SeriesName; |
| | 42 | | } |
| | 43 | |
|
| | 44 | | public string FindSeriesName() |
| | 45 | | { |
| 0 | 46 | | return SeriesName; |
| | 47 | | } |
| | 48 | |
|
| | 49 | | public string FindSeriesPresentationUniqueKey() |
| | 50 | | { |
| 0 | 51 | | return SeriesPresentationUniqueKey; |
| | 52 | | } |
| | 53 | |
|
| | 54 | | public Guid FindSeriesId() |
| | 55 | | { |
| 0 | 56 | | return SeriesId; |
| | 57 | | } |
| | 58 | |
|
| | 59 | | /// <inheritdoc /> |
| | 60 | | public override bool CanDownload() |
| | 61 | | { |
| 0 | 62 | | return IsFileProtocol; |
| | 63 | | } |
| | 64 | |
|
| | 65 | | /// <inheritdoc /> |
| | 66 | | public override UnratedItem GetBlockUnratedType() |
| | 67 | | { |
| 0 | 68 | | return UnratedItem.Book; |
| | 69 | | } |
| | 70 | |
|
| | 71 | | public BookInfo GetLookupInfo() |
| | 72 | | { |
| 0 | 73 | | var info = GetItemLookupInfo<BookInfo>(); |
| | 74 | |
|
| 0 | 75 | | if (string.IsNullOrEmpty(SeriesName)) |
| | 76 | | { |
| 0 | 77 | | info.SeriesName = GetParents().Select(i => i.Name).FirstOrDefault(); |
| | 78 | | } |
| | 79 | | else |
| | 80 | | { |
| 0 | 81 | | info.SeriesName = SeriesName; |
| | 82 | | } |
| | 83 | |
|
| 0 | 84 | | return info; |
| | 85 | | } |
| | 86 | | } |
| | 87 | | } |