From 5edb8159a7f8966d09cb222f366d7403a9bf723b Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Tue, 15 Oct 2019 17:49:49 +0200 Subject: [PATCH] Fix Json serialization error --- .../Playlists/ManualPlaylistsFolder.cs | 8 +- .../Services/ServicePath.cs | 19 +- .../MediaBrowser.Common.csproj | 1 - MediaBrowser.Controller/Channels/Channel.cs | 6 +- .../Entities/AggregateFolder.cs | 8 +- .../Entities/Audio/Audio.cs | 22 +-- .../Entities/Audio/MusicAlbum.cs | 18 +- .../Entities/Audio/MusicArtist.cs | 22 +-- .../Entities/Audio/MusicGenre.cs | 12 +- MediaBrowser.Controller/Entities/AudioBook.cs | 12 +- MediaBrowser.Controller/Entities/BaseItem.cs | 182 +++++++++--------- .../Entities/BasePluginFolder.cs | 8 +- MediaBrowser.Controller/Entities/Book.cs | 10 +- .../Entities/CollectionFolder.cs | 15 +- MediaBrowser.Controller/Entities/Folder.cs | 34 ++-- MediaBrowser.Controller/Entities/Genre.cs | 10 +- .../Entities/ItemImageInfo.cs | 4 +- .../Entities/LinkedChild.cs | 4 +- .../Entities/Movies/BoxSet.cs | 12 +- .../Entities/Movies/Movie.cs | 6 +- .../Entities/MusicVideo.cs | 4 +- MediaBrowser.Controller/Entities/Person.cs | 10 +- MediaBrowser.Controller/Entities/Photo.cs | 10 +- .../Entities/PhotoAlbum.cs | 8 +- MediaBrowser.Controller/Entities/Studio.cs | 10 +- .../Entities/TV/Episode.cs | 36 ++-- MediaBrowser.Controller/Entities/TV/Season.cs | 24 +-- MediaBrowser.Controller/Entities/TV/Series.cs | 14 +- MediaBrowser.Controller/Entities/Trailer.cs | 4 +- MediaBrowser.Controller/Entities/User.cs | 18 +- .../Entities/UserItemData.cs | 4 +- .../Entities/UserRootFolder.cs | 10 +- MediaBrowser.Controller/Entities/UserView.cs | 10 +- MediaBrowser.Controller/Entities/Video.cs | 36 ++-- MediaBrowser.Controller/Entities/Year.cs | 8 +- .../LiveTv/LiveTvChannel.cs | 26 +-- .../LiveTv/LiveTvProgram.cs | 38 ++-- MediaBrowser.Controller/LiveTv/TimerInfo.cs | 6 +- MediaBrowser.Controller/Playlists/Playlist.cs | 22 +-- .../Session/SessionInfo.cs | 4 +- MediaBrowser.Model/Dto/BaseItemPerson.cs | 4 +- MediaBrowser.Model/Dto/MediaSourceInfo.cs | 6 +- MediaBrowser.Model/MediaBrowser.Model.csproj | 1 + .../IgnoreDataMemberAttribute.cs | 12 -- .../Updates/PackageVersionInfo.cs | 4 +- 45 files changed, 364 insertions(+), 378 deletions(-) delete mode 100644 MediaBrowser.Model/Serialization/IgnoreDataMemberAttribute.cs diff --git a/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs b/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs index f4decc856..de51a37ab 100644 --- a/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs +++ b/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Playlists; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; namespace Emby.Server.Implementations.Playlists { @@ -24,13 +24,13 @@ namespace Emby.Server.Implementations.Playlists return base.GetEligibleChildrenForRecursiveChildren(user).OfType(); } - [IgnoreDataMember] + [JsonIgnore] public override bool IsHidden => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; - [IgnoreDataMember] + [JsonIgnore] public override string CollectionType => MediaBrowser.Model.Entities.CollectionType.Playlists; protected override QueryResult GetItemsInternal(InternalItemsQuery query) diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs index ccb28e8df..0b67669b9 100644 --- a/Emby.Server.Implementations/Services/ServicePath.cs +++ b/Emby.Server.Implementations/Services/ServicePath.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Reflection; using System.Text; +using System.Text.Json.Serialization; namespace Emby.Server.Implementations.Services { @@ -28,6 +29,13 @@ namespace Emby.Server.Implementations.Services private readonly bool[] isWildcard; private readonly int wildcardCount = 0; + internal static string[] IgnoreAttributesNamed = new[] + { + nameof(JsonIgnoreAttribute) + }; + + private static Type _excludeType = typeof(Stream); + public int VariableArgsCount { get; set; } /// @@ -190,21 +198,12 @@ namespace Emby.Server.Implementations.Services StringComparer.OrdinalIgnoreCase); } - internal static string[] IgnoreAttributesNamed = new[] - { - "IgnoreDataMemberAttribute", - "JsonIgnoreAttribute" - }; - - - private static Type excludeType = typeof(Stream); - internal static IEnumerable GetSerializableProperties(Type type) { foreach (var prop in GetPublicProperties(type)) { if (prop.GetMethod == null - || excludeType == prop.PropertyType) + || _excludeType == prop.PropertyType) { continue; } diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index dc1c967cd..1a40f5ea2 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -14,7 +14,6 @@ - diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs index 89159973b..cdf2ca69e 100644 --- a/MediaBrowser.Controller/Channels/Channel.cs +++ b/MediaBrowser.Controller/Channels/Channel.cs @@ -1,11 +1,11 @@ using System; using System.Globalization; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using MediaBrowser.Common.Progress; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Channels { @@ -31,10 +31,10 @@ namespace MediaBrowser.Controller.Channels return base.IsVisible(user); } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; - [IgnoreDataMember] + [JsonIgnore] public override SourceType SourceType => SourceType.Channel; protected override QueryResult GetItemsInternal(InternalItemsQuery query) diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index 054df21e5..cacda8140 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -2,13 +2,13 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { @@ -23,7 +23,7 @@ namespace MediaBrowser.Controller.Entities PhysicalLocationsList = Array.Empty(); } - [IgnoreDataMember] + [JsonIgnore] public override bool IsPhysicalRoot => true; public override bool CanDelete() @@ -31,7 +31,7 @@ namespace MediaBrowser.Controller.Entities return false; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => false; /// @@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.Entities /// The virtual children. public ConcurrentBag VirtualChildren => _virtualChildren; - [IgnoreDataMember] + [JsonIgnore] public override string[] PhysicalLocations => PhysicalLocationsList; public string[] PhysicalLocationsList { get; set; } diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 67b21068a..a700d0be4 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities.Audio { @@ -21,11 +21,11 @@ namespace MediaBrowser.Controller.Entities.Audio IHasMediaSources { /// - [IgnoreDataMember] + [JsonIgnore] public IReadOnlyList Artists { get; set; } /// - [IgnoreDataMember] + [JsonIgnore] public IReadOnlyList AlbumArtists { get; set; } public Audio() @@ -39,22 +39,22 @@ namespace MediaBrowser.Controller.Entities.Audio return 1; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAddingToPlaylist => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => true; - [IgnoreDataMember] + [JsonIgnore] protected override bool SupportsOwnedItems => false; - [IgnoreDataMember] + [JsonIgnore] public override Folder LatestItemsIndexContainer => AlbumEntity; public override bool CanDownload() @@ -62,14 +62,14 @@ namespace MediaBrowser.Controller.Entities.Audio return IsFileProtocol; } - [IgnoreDataMember] + [JsonIgnore] public MusicAlbum AlbumEntity => FindParent(); /// /// Gets the type of the media. /// /// The type of the media. - [IgnoreDataMember] + [JsonIgnore] public override string MediaType => Model.Entities.MediaType.Audio; /// diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index edf6ffa21..c216176e7 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Dto; @@ -8,7 +9,6 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities.Audio @@ -30,13 +30,13 @@ namespace MediaBrowser.Controller.Entities.Audio AlbumArtists = Array.Empty(); } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAddingToPlaylist => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => true; - [IgnoreDataMember] + [JsonIgnore] public MusicArtist MusicArtist => GetMusicArtist(new DtoOptions(true)); public MusicArtist GetMusicArtist(DtoOptions options) @@ -58,23 +58,23 @@ namespace MediaBrowser.Controller.Entities.Audio return null; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsCumulativeRunTimeTicks => true; - [IgnoreDataMember] + [JsonIgnore] public string AlbumArtist => AlbumArtists.FirstOrDefault(); - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; /// /// Gets the tracks. /// /// The tracks. - [IgnoreDataMember] + [JsonIgnore] public IEnumerable public class MusicArtist : Folder, IItemByName, IHasMusicGenres, IHasDualAccess, IHasLookupInfo { - [IgnoreDataMember] + [JsonIgnore] public bool IsAccessedByName => ParentId.Equals(Guid.Empty); - [IgnoreDataMember] + [JsonIgnore] public override bool IsFolder => !IsAccessedByName; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsCumulativeRunTimeTicks => true; - [IgnoreDataMember] + [JsonIgnore] public override bool IsDisplayedAsFolder => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAddingToPlaylist => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => false; public override double GetDefaultPrimaryImageAspectRatio() @@ -60,7 +60,7 @@ namespace MediaBrowser.Controller.Entities.Audio return LibraryManager.GetItemList(query); } - [IgnoreDataMember] + [JsonIgnore] public override IEnumerable Children { get @@ -117,7 +117,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// If the item is a folder, it returns the folder itself /// /// The containing folder path. - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath => Path; /// @@ -164,7 +164,7 @@ namespace MediaBrowser.Controller.Entities.Audio return info; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; public static string GetPath(string name) diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs index d26aaf2bb..537e9630b 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Extensions; -using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities.Audio @@ -23,13 +23,13 @@ namespace MediaBrowser.Controller.Entities.Audio return GetUserDataKeys()[0]; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAddingToPlaylist => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAncestors => false; - [IgnoreDataMember] + [JsonIgnore] public override bool IsDisplayedAsFolder => true; /// @@ -37,7 +37,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// If the item is a folder, it returns the folder itself /// /// The containing folder path. - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath => Path; public override double GetDefaultPrimaryImageAspectRatio() @@ -55,7 +55,7 @@ namespace MediaBrowser.Controller.Entities.Audio return true; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; public IList GetTaggedItems(InternalItemsQuery query) diff --git a/MediaBrowser.Controller/Entities/AudioBook.cs b/MediaBrowser.Controller/Entities/AudioBook.cs index 65c8a5fdd..a13873bf9 100644 --- a/MediaBrowser.Controller/Entities/AudioBook.cs +++ b/MediaBrowser.Controller/Entities/AudioBook.cs @@ -1,23 +1,23 @@ using System; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { public class AudioBook : Audio.Audio, IHasSeries, IHasLookupInfo { - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPositionTicksResume => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => true; - [IgnoreDataMember] + [JsonIgnore] public string SeriesPresentationUniqueKey { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string SeriesName { get; set; } - [IgnoreDataMember] + [JsonIgnore] public Guid SeriesId { get; set; } public string FindSeriesSortName() diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index c3dc6f7f2..599d41bb2 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Text; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Extensions; @@ -25,7 +26,6 @@ using MediaBrowser.Model.Library; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Providers; -using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; using Microsoft.Extensions.Logging; @@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.Entities /// The supported image extensions /// public static readonly string[] SupportedImageExtensions - = new [] { ".png", ".jpg", ".jpeg", ".tbn", ".gif" }; + = new[] { ".png", ".jpg", ".jpeg", ".tbn", ".gif" }; private static readonly List _supportedExtensions = new List(SupportedImageExtensions) { @@ -98,62 +98,62 @@ namespace MediaBrowser.Controller.Entities SampleFolderName }; - [IgnoreDataMember] + [JsonIgnore] public Guid[] ThemeSongIds { get; set; } - [IgnoreDataMember] + [JsonIgnore] public Guid[] ThemeVideoIds { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string PreferredMetadataCountryCode { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string PreferredMetadataLanguage { get; set; } public long? Size { get; set; } public string Container { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string Tagline { get; set; } - [IgnoreDataMember] + [JsonIgnore] public virtual ItemImageInfo[] ImageInfos { get; set; } - [IgnoreDataMember] + [JsonIgnore] public bool IsVirtualItem { get; set; } /// /// Gets or sets the album. /// /// The album. - [IgnoreDataMember] + [JsonIgnore] public string Album { get; set; } /// /// Gets or sets the channel identifier. /// /// The channel identifier. - [IgnoreDataMember] + [JsonIgnore] public Guid ChannelId { get; set; } - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsAddingToPlaylist => false; - [IgnoreDataMember] + [JsonIgnore] public virtual bool AlwaysScanInternalMetadataPath => false; /// /// Gets a value indicating whether this instance is in mixed folder. /// /// true if this instance is in mixed folder; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsInMixedFolder { get; set; } - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsPlayedStatus => false; - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsPositionTicksResume => false; - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsRemoteImageDownloading => true; private string _name; @@ -161,7 +161,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the name. /// /// The name. - [IgnoreDataMember] + [JsonIgnore] public virtual string Name { get => _name; @@ -174,35 +174,35 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public bool IsUnaired => PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; - [IgnoreDataMember] + [JsonIgnore] public int? TotalBitrate { get; set; } - [IgnoreDataMember] + [JsonIgnore] public ExtraType? ExtraType { get; set; } - [IgnoreDataMember] + [JsonIgnore] public bool IsThemeMedia => ExtraType.HasValue && (ExtraType.Value == Model.Entities.ExtraType.ThemeSong || ExtraType.Value == Model.Entities.ExtraType.ThemeVideo); - [IgnoreDataMember] + [JsonIgnore] public string OriginalTitle { get; set; } /// /// Gets or sets the id. /// /// The id. - [IgnoreDataMember] + [JsonIgnore] public Guid Id { get; set; } - [IgnoreDataMember] + [JsonIgnore] public Guid OwnerId { get; set; } /// /// Gets or sets the audio. /// /// The audio. - [IgnoreDataMember] + [JsonIgnore] public ProgramAudio? Audio { get; set; } /// @@ -210,7 +210,7 @@ namespace MediaBrowser.Controller.Entities /// Default is based on the type for everything except actual generic folders. /// /// The display prefs id. - [IgnoreDataMember] + [JsonIgnore] public virtual Guid DisplayPreferencesId { get @@ -224,10 +224,10 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the path. /// /// The path. - [IgnoreDataMember] + [JsonIgnore] public virtual string Path { get; set; } - [IgnoreDataMember] + [JsonIgnore] public virtual SourceType SourceType { get @@ -245,7 +245,7 @@ namespace MediaBrowser.Controller.Entities /// Returns the folder containing the item. /// If the item is a folder, it returns the folder itself /// - [IgnoreDataMember] + [JsonIgnore] public virtual string ContainingFolderPath { get @@ -263,26 +263,26 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the name of the service. /// /// The name of the service. - [IgnoreDataMember] + [JsonIgnore] public string ServiceName { get; set; } /// /// If this content came from an external service, the id of the content on that service /// - [IgnoreDataMember] + [JsonIgnore] public string ExternalId { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string ExternalSeriesId { get; set; } /// /// Gets or sets the etag. /// /// The etag. - [IgnoreDataMember] + [JsonIgnore] public string ExternalEtag { get; set; } - [IgnoreDataMember] + [JsonIgnore] public virtual bool IsHidden => false; public BaseItem GetOwner() @@ -295,7 +295,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the type of the location. /// /// The type of the location. - [IgnoreDataMember] + [JsonIgnore] public virtual LocationType LocationType { get @@ -320,7 +320,7 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public MediaProtocol? PathProtocol { get @@ -343,13 +343,13 @@ namespace MediaBrowser.Controller.Entities return current.HasValue && current.Value == protocol; } - [IgnoreDataMember] + [JsonIgnore] public bool IsFileProtocol => IsPathProtocol(MediaProtocol.File); - [IgnoreDataMember] + [JsonIgnore] public bool HasPathProtocol => PathProtocol.HasValue; - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsLocalMetadata { get @@ -363,7 +363,7 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public virtual string FileNameWithoutExtension { get @@ -377,7 +377,7 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public virtual bool EnableAlphaNumericSorting => true; private List> GetSortChunks(string s1) @@ -418,7 +418,7 @@ namespace MediaBrowser.Controller.Entities /// This is just a helper for convenience /// /// The primary image path. - [IgnoreDataMember] + [JsonIgnore] public string PrimaryImagePath => this.GetImagePath(ImageType.Primary); public bool IsMetadataFetcherEnabled(LibraryOptions libraryOptions, string name) @@ -544,20 +544,20 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the date created. /// /// The date created. - [IgnoreDataMember] + [JsonIgnore] public DateTime DateCreated { get; set; } /// /// Gets or sets the date modified. /// /// The date modified. - [IgnoreDataMember] + [JsonIgnore] public DateTime DateModified { get; set; } - [IgnoreDataMember] + [JsonIgnore] public DateTime DateLastSaved { get; set; } - [IgnoreDataMember] + [JsonIgnore] public DateTime DateLastRefreshed { get; set; } /// @@ -583,24 +583,24 @@ namespace MediaBrowser.Controller.Entities return Name; } - [IgnoreDataMember] + [JsonIgnore] public bool IsLocked { get; set; } /// /// Gets or sets the locked fields. /// /// The locked fields. - [IgnoreDataMember] + [JsonIgnore] public MetadataFields[] LockedFields { get; set; } /// /// Gets the type of the media. /// /// The type of the media. - [IgnoreDataMember] + [JsonIgnore] public virtual string MediaType => null; - [IgnoreDataMember] + [JsonIgnore] public virtual string[] PhysicalLocations { get @@ -619,7 +619,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the name of the forced sort. /// /// The name of the forced sort. - [IgnoreDataMember] + [JsonIgnore] public string ForcedSortName { get => _forcedSortName; @@ -631,7 +631,7 @@ namespace MediaBrowser.Controller.Entities /// Gets the name of the sort. /// /// The name of the sort. - [IgnoreDataMember] + [JsonIgnore] public string SortName { get @@ -744,7 +744,7 @@ namespace MediaBrowser.Controller.Entities return builder.ToString().RemoveDiacritics(); } - [IgnoreDataMember] + [JsonIgnore] public bool EnableMediaSourceDisplay { get @@ -758,14 +758,14 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public Guid ParentId { get; set; } /// /// Gets or sets the parent. /// /// The parent. - [IgnoreDataMember] + [JsonIgnore] public Folder Parent { get => GetParent() as Folder; @@ -822,7 +822,7 @@ namespace MediaBrowser.Controller.Entities return null; } - [IgnoreDataMember] + [JsonIgnore] public virtual Guid DisplayParentId { get @@ -832,7 +832,7 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public BaseItem DisplayParent { get @@ -850,97 +850,97 @@ namespace MediaBrowser.Controller.Entities /// When the item first debuted. For movies this could be premiere date, episodes would be first aired /// /// The premiere date. - [IgnoreDataMember] + [JsonIgnore] public DateTime? PremiereDate { get; set; } /// /// Gets or sets the end date. /// /// The end date. - [IgnoreDataMember] + [JsonIgnore] public DateTime? EndDate { get; set; } /// /// Gets or sets the official rating. /// /// The official rating. - [IgnoreDataMember] + [JsonIgnore] public string OfficialRating { get; set; } - [IgnoreDataMember] + [JsonIgnore] public int InheritedParentalRatingValue { get; set; } /// /// Gets or sets the critic rating. /// /// The critic rating. - [IgnoreDataMember] + [JsonIgnore] public float? CriticRating { get; set; } /// /// Gets or sets the custom rating. /// /// The custom rating. - [IgnoreDataMember] + [JsonIgnore] public string CustomRating { get; set; } /// /// Gets or sets the overview. /// /// The overview. - [IgnoreDataMember] + [JsonIgnore] public string Overview { get; set; } /// /// Gets or sets the studios. /// /// The studios. - [IgnoreDataMember] + [JsonIgnore] public string[] Studios { get; set; } /// /// Gets or sets the genres. /// /// The genres. - [IgnoreDataMember] + [JsonIgnore] public string[] Genres { get; set; } /// /// Gets or sets the tags. /// /// The tags. - [IgnoreDataMember] + [JsonIgnore] public string[] Tags { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string[] ProductionLocations { get; set; } /// /// Gets or sets the home page URL. /// /// The home page URL. - [IgnoreDataMember] + [JsonIgnore] public string HomePageUrl { get; set; } /// /// Gets or sets the community rating. /// /// The community rating. - [IgnoreDataMember] + [JsonIgnore] public float? CommunityRating { get; set; } /// /// Gets or sets the run time ticks. /// /// The run time ticks. - [IgnoreDataMember] + [JsonIgnore] public long? RunTimeTicks { get; set; } /// /// Gets or sets the production year. /// /// The production year. - [IgnoreDataMember] + [JsonIgnore] public int? ProductionYear { get; set; } /// @@ -948,20 +948,20 @@ namespace MediaBrowser.Controller.Entities /// This could be episode number, album track number, etc. /// /// The index number. - [IgnoreDataMember] + [JsonIgnore] public int? IndexNumber { get; set; } /// /// For an episode this could be the season number, or for a song this could be the disc number. /// /// The parent index number. - [IgnoreDataMember] + [JsonIgnore] public int? ParentIndexNumber { get; set; } - [IgnoreDataMember] + [JsonIgnore] public virtual bool HasLocalAlternateVersions => false; - [IgnoreDataMember] + [JsonIgnore] public string OfficialRatingForComparison { get @@ -982,7 +982,7 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public string CustomRatingForComparison { get @@ -1407,13 +1407,13 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] protected virtual bool SupportsOwnedItems => !ParentId.Equals(Guid.Empty) && IsFileProtocol; - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsPeople => false; - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsThemeMedia => false; /// @@ -1613,10 +1613,10 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the provider ids. /// /// The provider ids. - [IgnoreDataMember] + [JsonIgnore] public Dictionary ProviderIds { get; set; } - [IgnoreDataMember] + [JsonIgnore] public virtual Folder LatestItemsIndexContainer => null; public virtual double GetDefaultPrimaryImageAspectRatio() @@ -1629,7 +1629,7 @@ namespace MediaBrowser.Controller.Entities return Id.ToString("N", CultureInfo.InvariantCulture); } - [IgnoreDataMember] + [JsonIgnore] public string PresentationUniqueKey { get; set; } public string GetPresentationUniqueKey() @@ -1934,7 +1934,7 @@ namespace MediaBrowser.Controller.Entities return IsVisibleStandaloneInternal(user, true); } - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsInheritedParentImages => false; protected bool IsVisibleStandaloneInternal(User user, bool checkFolders) @@ -1977,10 +1977,10 @@ namespace MediaBrowser.Controller.Entities /// Gets a value indicating whether this instance is folder. /// /// true if this instance is folder; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public virtual bool IsFolder => false; - [IgnoreDataMember] + [JsonIgnore] public virtual bool IsDisplayedAsFolder => false; public virtual string GetClientTypeName() @@ -2066,7 +2066,7 @@ namespace MediaBrowser.Controller.Entities return null; } - [IgnoreDataMember] + [JsonIgnore] public virtual bool EnableRememberingTrackSelections => true; /// @@ -2776,7 +2776,7 @@ namespace MediaBrowser.Controller.Entities return null; } - [IgnoreDataMember] + [JsonIgnore] public virtual bool IsTopParent { get @@ -2804,10 +2804,10 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsAncestors => true; - [IgnoreDataMember] + [JsonIgnore] public virtual bool StopRefreshIfLocalMetadataFound => true; public virtual IEnumerable GetIdsForAncestorQuery() diff --git a/MediaBrowser.Controller/Entities/BasePluginFolder.cs b/MediaBrowser.Controller/Entities/BasePluginFolder.cs index 8cdb9695c..62d172fcc 100644 --- a/MediaBrowser.Controller/Entities/BasePluginFolder.cs +++ b/MediaBrowser.Controller/Entities/BasePluginFolder.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Serialization; +using System.Text.Json.Serialization; namespace MediaBrowser.Controller.Entities { @@ -8,7 +8,7 @@ namespace MediaBrowser.Controller.Entities /// public abstract class BasePluginFolder : Folder, ICollectionFolder { - [IgnoreDataMember] + [JsonIgnore] public virtual string CollectionType => null; public override bool CanDelete() @@ -21,10 +21,10 @@ namespace MediaBrowser.Controller.Entities return true; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; //public override double? GetDefaultPrimaryImageAspectRatio() diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs index 7a23d9a66..44c35374d 100644 --- a/MediaBrowser.Controller/Entities/Book.cs +++ b/MediaBrowser.Controller/Entities/Book.cs @@ -1,21 +1,21 @@ using System; using System.Linq; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { public class Book : BaseItem, IHasLookupInfo, IHasSeries { - [IgnoreDataMember] + [JsonIgnore] public override string MediaType => Model.Entities.MediaType.Book; - [IgnoreDataMember] + [JsonIgnore] public string SeriesPresentationUniqueKey { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string SeriesName { get; set; } - [IgnoreDataMember] + [JsonIgnore] public Guid SeriesId { get; set; } public string FindSeriesSortName() diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 275052d48..bc5e7467e 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -2,14 +2,13 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; - using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; @@ -33,10 +32,10 @@ namespace MediaBrowser.Controller.Entities PhysicalFolderIds = Array.Empty(); } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; public override bool CanDelete() @@ -144,10 +143,10 @@ namespace MediaBrowser.Controller.Entities /// Allow different display preferences for each collection folder /// /// The display prefs id. - [IgnoreDataMember] + [JsonIgnore] public override Guid DisplayPreferencesId => Id; - [IgnoreDataMember] + [JsonIgnore] public override string[] PhysicalLocations => PhysicalLocationsList; public override bool IsSaveLocalMetadataEnabled() @@ -311,7 +310,7 @@ namespace MediaBrowser.Controller.Entities /// Our children are actually just references to the ones in the physical root... /// /// The actual children. - [IgnoreDataMember] + [JsonIgnore] public override IEnumerable Children => GetActualChildren(); public IEnumerable GetActualChildren() @@ -361,7 +360,7 @@ namespace MediaBrowser.Controller.Entities return result; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index d61a07066..61cc208d7 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Progress; @@ -18,7 +19,6 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Dto; using MediaBrowser.Model.IO; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Entities public LinkedChild[] LinkedChildren { get; set; } - [IgnoreDataMember] + [JsonIgnore] public DateTime? DateLastMediaAdded { get; set; } public Folder() @@ -47,35 +47,35 @@ namespace MediaBrowser.Controller.Entities LinkedChildren = Array.Empty(); } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsThemeMedia => true; - [IgnoreDataMember] + [JsonIgnore] public virtual bool IsPreSorted => false; - [IgnoreDataMember] + [JsonIgnore] public virtual bool IsPhysicalRoot => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => true; /// /// Gets a value indicating whether this instance is folder. /// /// true if this instance is folder; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public override bool IsFolder => true; - [IgnoreDataMember] + [JsonIgnore] public override bool IsDisplayedAsFolder => true; - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsCumulativeRunTimeTicks => false; - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsDateLastMediaAdded => false; public override bool CanDelete() @@ -100,7 +100,7 @@ namespace MediaBrowser.Controller.Entities return baseResult; } - [IgnoreDataMember] + [JsonIgnore] public override string FileNameWithoutExtension { get @@ -127,7 +127,7 @@ namespace MediaBrowser.Controller.Entities return true; } - [IgnoreDataMember] + [JsonIgnore] protected virtual bool SupportsShortcutChildren => false; /// @@ -162,14 +162,14 @@ namespace MediaBrowser.Controller.Entities /// Gets the actual children. /// /// The actual children. - [IgnoreDataMember] + [JsonIgnore] public virtual IEnumerable Children => LoadChildren(); /// /// thread-safe access to all recursive children of this folder - without regard to user /// /// The recursive children. - [IgnoreDataMember] + [JsonIgnore] public IEnumerable RecursiveChildren => GetRecursiveChildren(); public override bool IsVisible(User user) @@ -1428,7 +1428,7 @@ namespace MediaBrowser.Controller.Entities .Where(i => i.Item2 != null); } - [IgnoreDataMember] + [JsonIgnore] protected override bool SupportsOwnedItems => base.SupportsOwnedItems || SupportsShortcutChildren; protected override async Task RefreshedOwnedItems(MetadataRefreshOptions options, List fileSystemChildren, CancellationToken cancellationToken) @@ -1595,7 +1595,7 @@ namespace MediaBrowser.Controller.Entities return !IsPlayed(user); } - [IgnoreDataMember] + [JsonIgnore] public virtual bool SupportsUserDataFromChildren { get diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs index 44cb62d22..773c7df34 100644 --- a/MediaBrowser.Controller/Entities/Genre.cs +++ b/MediaBrowser.Controller/Entities/Genre.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Extensions; -using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -34,13 +34,13 @@ namespace MediaBrowser.Controller.Entities /// If the item is a folder, it returns the folder itself /// /// The containing folder path. - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath => Path; - [IgnoreDataMember] + [JsonIgnore] public override bool IsDisplayedAsFolder => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAncestors => false; public override bool IsSaveLocalMetadataEnabled() @@ -61,7 +61,7 @@ namespace MediaBrowser.Controller.Entities return LibraryManager.GetItemList(query); } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; public static string GetPath(string name) diff --git a/MediaBrowser.Controller/Entities/ItemImageInfo.cs b/MediaBrowser.Controller/Entities/ItemImageInfo.cs index 848493864..fc46dec2e 100644 --- a/MediaBrowser.Controller/Entities/ItemImageInfo.cs +++ b/MediaBrowser.Controller/Entities/ItemImageInfo.cs @@ -1,6 +1,6 @@ using System; +using System.Text.Json.Serialization; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { @@ -28,7 +28,7 @@ namespace MediaBrowser.Controller.Entities public int Height { get; set; } - [IgnoreDataMember] + [JsonIgnore] public bool IsLocalFile => Path == null || !Path.StartsWith("http", StringComparison.OrdinalIgnoreCase); } } diff --git a/MediaBrowser.Controller/Entities/LinkedChild.cs b/MediaBrowser.Controller/Entities/LinkedChild.cs index 823060488..d88c31007 100644 --- a/MediaBrowser.Controller/Entities/LinkedChild.cs +++ b/MediaBrowser.Controller/Entities/LinkedChild.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Text.Json.Serialization; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { @@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Entities public LinkedChildType Type { get; set; } public string LibraryItemId { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string Id { get; set; } /// diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index e7ac2a05c..feaf8c45a 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities.Movies @@ -24,13 +24,13 @@ namespace MediaBrowser.Controller.Entities.Movies DisplayOrder = ItemSortBy.PremiereDate; } - [IgnoreDataMember] + [JsonIgnore] protected override bool FilterLinkedChildrenPerUser => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => true; /// @@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Entities.Movies return new List(); } - [IgnoreDataMember] + [JsonIgnore] private bool IsLegacyBoxSet { get @@ -98,7 +98,7 @@ namespace MediaBrowser.Controller.Entities.Movies } } - [IgnoreDataMember] + [JsonIgnore] public override bool IsPreSorted => true; public override bool IsAuthorizedToDelete(User user, List allCollectionFolders) diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 184528fdc..11dc472b6 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Providers; @@ -8,7 +9,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Providers; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities.Movies { @@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Entities.Movies /// The name of the TMDB collection. public string TmdbCollectionName { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string CollectionName { get => TmdbCollectionName; @@ -186,7 +186,7 @@ namespace MediaBrowser.Controller.Entities.Movies return list; } - [IgnoreDataMember] + [JsonIgnore] public override bool StopRefreshIfLocalMetadataFound => false; } } diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs index 94fe11e9d..603242063 100644 --- a/MediaBrowser.Controller/Entities/MusicVideo.cs +++ b/MediaBrowser.Controller/Entities/MusicVideo.cs @@ -1,16 +1,16 @@ using System; using System.Collections.Generic; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasLookupInfo { /// - [IgnoreDataMember] + [JsonIgnore] public IReadOnlyList Artists { get; set; } public MusicVideo() diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs index dd0183489..d9b4b2206 100644 --- a/MediaBrowser.Controller/Entities/Person.cs +++ b/MediaBrowser.Controller/Entities/Person.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Extensions; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.Entities /// If the item is a folder, it returns the folder itself /// /// The containing folder path. - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath => Path; public override bool CanDelete() @@ -63,13 +63,13 @@ namespace MediaBrowser.Controller.Entities return true; } - [IgnoreDataMember] + [JsonIgnore] public override bool EnableAlphaNumericSorting => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAncestors => false; public static string GetPath(string name) diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs index 60c832189..86d62add9 100644 --- a/MediaBrowser.Controller/Entities/Photo.cs +++ b/MediaBrowser.Controller/Entities/Photo.cs @@ -1,21 +1,21 @@ +using System.Text.Json.Serialization; using MediaBrowser.Model.Drawing; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { public class Photo : BaseItem { - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsLocalMetadata => false; - [IgnoreDataMember] + [JsonIgnore] public override string MediaType => Model.Entities.MediaType.Photo; - [IgnoreDataMember] + [JsonIgnore] public override Folder LatestItemsIndexContainer => AlbumEntity; - [IgnoreDataMember] + [JsonIgnore] public PhotoAlbum AlbumEntity { get diff --git a/MediaBrowser.Controller/Entities/PhotoAlbum.cs b/MediaBrowser.Controller/Entities/PhotoAlbum.cs index 4cd0c8b66..b86f1ac2a 100644 --- a/MediaBrowser.Controller/Entities/PhotoAlbum.cs +++ b/MediaBrowser.Controller/Entities/PhotoAlbum.cs @@ -1,16 +1,16 @@ -using MediaBrowser.Model.Serialization; +using System.Text.Json.Serialization; namespace MediaBrowser.Controller.Entities { public class PhotoAlbum : Folder { - [IgnoreDataMember] + [JsonIgnore] public override bool AlwaysScanInternalMetadataPath => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; } } diff --git a/MediaBrowser.Controller/Entities/Studio.cs b/MediaBrowser.Controller/Entities/Studio.cs index d6da0d48c..068032317 100644 --- a/MediaBrowser.Controller/Entities/Studio.cs +++ b/MediaBrowser.Controller/Entities/Studio.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Extensions; -using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -28,13 +28,13 @@ namespace MediaBrowser.Controller.Entities /// If the item is a folder, it returns the folder itself /// /// The containing folder path. - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath => Path; - [IgnoreDataMember] + [JsonIgnore] public override bool IsDisplayedAsFolder => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAncestors => false; public override double GetDefaultPrimaryImageAspectRatio() @@ -62,7 +62,7 @@ namespace MediaBrowser.Controller.Entities return LibraryManager.GetItemList(query); } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; public static string GetPath(string name) diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index e67c00fed..49229fa4b 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -2,11 +2,11 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities.TV @@ -49,25 +49,25 @@ namespace MediaBrowser.Controller.Entities.TV return series == null ? SeriesName : series.SortName; } - [IgnoreDataMember] + [JsonIgnore] protected override bool SupportsOwnedItems => IsStacked || MediaSourceCount > 1; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => true; - [IgnoreDataMember] + [JsonIgnore] public int? AiredSeasonNumber => AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber; - [IgnoreDataMember] + [JsonIgnore] public override Folder LatestItemsIndexContainer => Series; - [IgnoreDataMember] + [JsonIgnore] public override Guid DisplayParentId => SeasonId; - [IgnoreDataMember] + [JsonIgnore] protected override bool EnableDefaultVideoUserDataKeys => false; public override double GetDefaultPrimaryImageAspectRatio() @@ -104,7 +104,7 @@ namespace MediaBrowser.Controller.Entities.TV /// This Episode's Series Instance /// /// The series. - [IgnoreDataMember] + [JsonIgnore] public Series Series { get @@ -118,7 +118,7 @@ namespace MediaBrowser.Controller.Entities.TV } } - [IgnoreDataMember] + [JsonIgnore] public Season Season { get @@ -132,16 +132,16 @@ namespace MediaBrowser.Controller.Entities.TV } } - [IgnoreDataMember] + [JsonIgnore] public bool IsInSeasonFolder => FindParent() != null; - [IgnoreDataMember] + [JsonIgnore] public string SeriesPresentationUniqueKey { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string SeriesName { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string SeasonName { get; set; } public string FindSeriesPresentationUniqueKey() @@ -224,7 +224,7 @@ namespace MediaBrowser.Controller.Entities.TV return false; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsRemoteImageDownloading { get @@ -238,12 +238,12 @@ namespace MediaBrowser.Controller.Entities.TV } } - [IgnoreDataMember] + [JsonIgnore] public bool IsMissingEpisode => LocationType == LocationType.Virtual; - [IgnoreDataMember] + [JsonIgnore] public Guid SeasonId { get; set; } - [IgnoreDataMember] + [JsonIgnore] public Guid SeriesId { get; set; } public Guid FindSeriesId() diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 5d7c260d1..9c8a469e2 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities.TV @@ -15,22 +15,22 @@ namespace MediaBrowser.Controller.Entities.TV /// public class Season : Folder, IHasSeries, IHasLookupInfo { - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAddingToPlaylist => true; - [IgnoreDataMember] + [JsonIgnore] public override bool IsPreSorted => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsDateLastMediaAdded => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => true; - [IgnoreDataMember] + [JsonIgnore] public override Guid DisplayParentId => SeriesId; public override double GetDefaultPrimaryImageAspectRatio() @@ -71,7 +71,7 @@ namespace MediaBrowser.Controller.Entities.TV /// This Episode's Series Instance /// /// The series. - [IgnoreDataMember] + [JsonIgnore] public Series Series { get @@ -85,7 +85,7 @@ namespace MediaBrowser.Controller.Entities.TV } } - [IgnoreDataMember] + [JsonIgnore] public string SeriesPath { get @@ -179,13 +179,13 @@ namespace MediaBrowser.Controller.Entities.TV return UnratedItem.Series; } - [IgnoreDataMember] + [JsonIgnore] public string SeriesPresentationUniqueKey { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string SeriesName { get; set; } - [IgnoreDataMember] + [JsonIgnore] public Guid SeriesId { get; set; } public string FindSeriesPresentationUniqueKey() diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index a50da9b0a..76cb9a651 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Dto; @@ -10,7 +11,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities.TV @@ -31,19 +31,19 @@ namespace MediaBrowser.Controller.Entities.TV public DayOfWeek[] AirDays { get; set; } public string AirTime { get; set; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAddingToPlaylist => true; - [IgnoreDataMember] + [JsonIgnore] public override bool IsPreSorted => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsDateLastMediaAdded => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => true; /// @@ -504,7 +504,7 @@ namespace MediaBrowser.Controller.Entities.TV return list; } - [IgnoreDataMember] + [JsonIgnore] public override bool StopRefreshIfLocalMetadataFound => false; } } diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 5bf22d7bc..0b8be90cd 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { @@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.Entities return list; } - [IgnoreDataMember] + [JsonIgnore] public override bool StopRefreshIfLocalMetadataFound => false; } } diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index 7d245d4aa..c70ecccf1 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -1,12 +1,12 @@ using System; using System.Globalization; using System.IO; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities @@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.Entities public string Password { get; set; } public string EasyPassword { get; set; } - // Strictly to remove IgnoreDataMember + // Strictly to remove JsonIgnore public override ItemImageInfo[] ImageInfos { get => base.ImageInfos; @@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the path. /// /// The path. - [IgnoreDataMember] + [JsonIgnore] public override string Path { get => ConfigurationDirectoryPath; @@ -65,14 +65,14 @@ namespace MediaBrowser.Controller.Entities /// If the item is a folder, it returns the folder itself /// /// The containing folder path. - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath => Path; /// /// Gets the root folder. /// /// The root folder. - [IgnoreDataMember] + [JsonIgnore] public Folder RootFolder => LibraryManager.GetUserRootFolder(); /// @@ -88,7 +88,7 @@ namespace MediaBrowser.Controller.Entities private volatile UserConfiguration _config; private readonly object _configSyncLock = new object(); - [IgnoreDataMember] + [JsonIgnore] public UserConfiguration Configuration { get @@ -111,7 +111,7 @@ namespace MediaBrowser.Controller.Entities private volatile UserPolicy _policy; private readonly object _policySyncLock = new object(); - [IgnoreDataMember] + [JsonIgnore] public UserPolicy Policy { get @@ -168,7 +168,7 @@ namespace MediaBrowser.Controller.Entities /// Gets the path to the user's configuration directory /// /// The configuration directory path. - [IgnoreDataMember] + [JsonIgnore] public string ConfigurationDirectoryPath => GetConfigurationDirectoryPath(Name); public override double GetDefaultPrimaryImageAspectRatio() @@ -252,7 +252,7 @@ namespace MediaBrowser.Controller.Entities return false; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; public long InternalId { get; set; } diff --git a/MediaBrowser.Controller/Entities/UserItemData.cs b/MediaBrowser.Controller/Entities/UserItemData.cs index f7136bdf2..ab425ee0f 100644 --- a/MediaBrowser.Controller/Entities/UserItemData.cs +++ b/MediaBrowser.Controller/Entities/UserItemData.cs @@ -1,5 +1,5 @@ using System; -using MediaBrowser.Model.Serialization; +using System.Text.Json.Serialization; namespace MediaBrowser.Controller.Entities { @@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.Entities /// This should never be serialized. /// /// null if [likes] contains no value, true if [likes]; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool? Likes { get diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs index 7fe8df8af..7fcf48a48 100644 --- a/MediaBrowser.Controller/Entities/UserRootFolder.cs +++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Library; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { @@ -33,10 +33,10 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => false; private void ClearCache() @@ -75,10 +75,10 @@ namespace MediaBrowser.Controller.Entities return GetChildren(user, true).Count; } - [IgnoreDataMember] + [JsonIgnore] protected override bool SupportsShortcutChildren => true; - [IgnoreDataMember] + [JsonIgnore] public override bool IsPreSorted => true; protected override IEnumerable GetEligibleChildrenForRecursiveChildren(User user) diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs index 4a6d32dce..fd045f0dd 100644 --- a/MediaBrowser.Controller/Entities/UserView.cs +++ b/MediaBrowser.Controller/Entities/UserView.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using System.Threading.Tasks; using MediaBrowser.Controller.TV; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { @@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities public static ITVSeriesManager TVSeriesManager; - [IgnoreDataMember] + [JsonIgnore] public string CollectionType => ViewType; public override IEnumerable GetIdsForAncestorQuery() @@ -40,10 +40,10 @@ namespace MediaBrowser.Controller.Entities return list; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => false; public override int GetChildCount(User user) @@ -167,7 +167,7 @@ namespace MediaBrowser.Controller.Entities return Task.CompletedTask; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; } } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 8379dcc09..60906bdb0 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Library; @@ -13,7 +14,6 @@ using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { @@ -25,23 +25,23 @@ namespace MediaBrowser.Controller.Entities ISupportsPlaceHolders, IHasMediaSources { - [IgnoreDataMember] + [JsonIgnore] public string PrimaryVersionId { get; set; } public string[] AdditionalParts { get; set; } public string[] LocalAlternateVersions { get; set; } public LinkedChild[] LinkedAlternateVersions { get; set; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPositionTicksResume { get @@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Entities return base.CreatePresentationUniqueKey(); } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsThemeMedia => true; /// @@ -180,10 +180,10 @@ namespace MediaBrowser.Controller.Entities return IsFileProtocol; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAddingToPlaylist => true; - [IgnoreDataMember] + [JsonIgnore] public int MediaSourceCount { get @@ -200,10 +200,10 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public bool IsStacked => AdditionalParts.Length > 0; - [IgnoreDataMember] + [JsonIgnore] public override bool HasLocalAlternateVersions => LocalAlternateVersions.Length > 0; public IEnumerable GetAdditionalPartIds() @@ -218,7 +218,7 @@ namespace MediaBrowser.Controller.Entities public static ILiveTvManager LiveTvManager { get; set; } - [IgnoreDataMember] + [JsonIgnore] public override SourceType SourceType { get @@ -247,7 +247,7 @@ namespace MediaBrowser.Controller.Entities return base.CanDelete(); } - [IgnoreDataMember] + [JsonIgnore] public bool IsCompleteMedia { get @@ -261,7 +261,7 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] protected virtual bool EnableDefaultVideoUserDataKeys => true; public override List GetUserDataKeys() @@ -338,7 +338,7 @@ namespace MediaBrowser.Controller.Entities .OrderBy(i => i.SortName); } - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath { get @@ -360,7 +360,7 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] + [JsonIgnore] public override string FileNameWithoutExtension { get @@ -432,14 +432,14 @@ namespace MediaBrowser.Controller.Entities /// Gets a value indicating whether [is3 D]. /// /// true if [is3 D]; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool Is3D => Video3DFormat.HasValue; /// /// Gets the type of the media. /// /// The type of the media. - [IgnoreDataMember] + [JsonIgnore] public override string MediaType => Model.Entities.MediaType.Video; protected override async Task RefreshedOwnedItems(MetadataRefreshOptions options, List fileSystemChildren, CancellationToken cancellationToken) diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs index 13e82fada..a01ef5c31 100644 --- a/MediaBrowser.Controller/Entities/Year.cs +++ b/MediaBrowser.Controller/Entities/Year.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; -using MediaBrowser.Model.Serialization; +using System.Text.Json.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Entities /// If the item is a folder, it returns the folder itself /// /// The containing folder path. - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath => Path; public override double GetDefaultPrimaryImageAspectRatio() @@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.Entities return value; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAncestors => false; public override bool CanDelete() @@ -72,7 +72,7 @@ namespace MediaBrowser.Controller.Entities return null; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople => false; public static string GetPath(string name) diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index 351662b29..60391bb83 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -2,13 +2,13 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Text.Json.Serialization; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.LiveTv { @@ -31,13 +31,13 @@ namespace MediaBrowser.Controller.LiveTv return UnratedItem.LiveTvChannel; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPositionTicksResume => false; - [IgnoreDataMember] + [JsonIgnore] public override SourceType SourceType => SourceType.LiveTV; - [IgnoreDataMember] + [JsonIgnore] public override bool EnableRememberingTrackSelections => false; /// @@ -52,7 +52,7 @@ namespace MediaBrowser.Controller.LiveTv /// The type of the channel. public ChannelType ChannelType { get; set; } - [IgnoreDataMember] + [JsonIgnore] public override LocationType LocationType => LocationType.Remote; protected override string CreateSortName() @@ -70,7 +70,7 @@ namespace MediaBrowser.Controller.LiveTv return (Number ?? string.Empty) + "-" + (Name ?? string.Empty); } - [IgnoreDataMember] + [JsonIgnore] public override string MediaType => ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video; public override string GetClientTypeName() @@ -119,45 +119,45 @@ namespace MediaBrowser.Controller.LiveTv return false; } - [IgnoreDataMember] + [JsonIgnore] public bool IsMovie { get; set; } /// /// Gets or sets a value indicating whether this instance is sports. /// /// true if this instance is sports; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsSports { get; set; } /// /// Gets or sets a value indicating whether this instance is series. /// /// true if this instance is series; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsSeries { get; set; } /// /// Gets or sets a value indicating whether this instance is news. /// /// true if this instance is news; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsNews { get; set; } /// /// Gets or sets a value indicating whether this instance is kids. /// /// true if this instance is kids; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsKids => Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); - [IgnoreDataMember] + [JsonIgnore] public bool IsRepeat { get; set; } /// /// Gets or sets the episode title. /// /// The episode title. - [IgnoreDataMember] + [JsonIgnore] public string EpisodeTitle { get; set; } } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index bdaf10d00..13df85aed 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Text.Json.Serialization; using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; @@ -9,7 +10,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Providers; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.LiveTv { @@ -63,79 +63,79 @@ namespace MediaBrowser.Controller.LiveTv } } - [IgnoreDataMember] + [JsonIgnore] public override SourceType SourceType => SourceType.LiveTV; /// /// The start date of the program, in UTC. /// - [IgnoreDataMember] + [JsonIgnore] public DateTime StartDate { get; set; } /// /// Gets or sets a value indicating whether this instance is repeat. /// /// true if this instance is repeat; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsRepeat { get; set; } /// /// Gets or sets the episode title. /// /// The episode title. - [IgnoreDataMember] + [JsonIgnore] public string EpisodeTitle { get; set; } - [IgnoreDataMember] + [JsonIgnore] public string ShowId { get; set; } /// /// Gets or sets a value indicating whether this instance is movie. /// /// true if this instance is movie; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsMovie { get; set; } /// /// Gets or sets a value indicating whether this instance is sports. /// /// true if this instance is sports; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsSports => Tags.Contains("Sports", StringComparer.OrdinalIgnoreCase); /// /// Gets or sets a value indicating whether this instance is series. /// /// true if this instance is series; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsSeries { get; set; } /// /// Gets or sets a value indicating whether this instance is live. /// /// true if this instance is live; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsLive => Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); /// /// Gets or sets a value indicating whether this instance is news. /// /// true if this instance is news; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsNews => Tags.Contains("News", StringComparer.OrdinalIgnoreCase); /// /// Gets or sets a value indicating whether this instance is kids. /// /// true if this instance is kids; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsKids => Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); /// /// Gets or sets a value indicating whether this instance is premiere. /// /// true if this instance is premiere; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsPremiere => Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); /// @@ -143,10 +143,10 @@ namespace MediaBrowser.Controller.LiveTv /// If the item is a folder, it returns the folder itself /// /// The containing folder path. - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath => Path; - //[IgnoreDataMember] + //[JsonIgnore] //public override string MediaType //{ // get @@ -155,7 +155,7 @@ namespace MediaBrowser.Controller.LiveTv // } //} - [IgnoreDataMember] + [JsonIgnore] public bool IsAiring { get @@ -166,7 +166,7 @@ namespace MediaBrowser.Controller.LiveTv } } - [IgnoreDataMember] + [JsonIgnore] public bool HasAired { get @@ -197,7 +197,7 @@ namespace MediaBrowser.Controller.LiveTv return false; } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPeople { get @@ -212,7 +212,7 @@ namespace MediaBrowser.Controller.LiveTv } } - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsAncestors => false; private LiveTvOptions GetConfiguration() diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index 2fea6a8cb..46774b2b7 100644 --- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using MediaBrowser.Model.LiveTv; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.LiveTv { @@ -129,10 +129,10 @@ namespace MediaBrowser.Controller.LiveTv /// Gets or sets a value indicating whether this instance is live. /// /// true if this instance is live; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool IsLive => Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); - [IgnoreDataMember] + [JsonIgnore] public bool IsPremiere => Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); public int? ProductionYear { get; set; } diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs index aff687f88..b45043f92 100644 --- a/MediaBrowser.Controller/Playlists/Playlist.cs +++ b/MediaBrowser.Controller/Playlists/Playlist.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Dto; @@ -10,7 +11,6 @@ using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Playlists { @@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.Playlists Shares = Array.Empty(); } - [IgnoreDataMember] + [JsonIgnore] public bool IsFile => IsPlaylistFile(Path); public static bool IsPlaylistFile(string path) @@ -42,7 +42,7 @@ namespace MediaBrowser.Controller.Playlists return System.IO.Path.HasExtension(path); } - [IgnoreDataMember] + [JsonIgnore] public override string ContainingFolderPath { get @@ -58,19 +58,19 @@ namespace MediaBrowser.Controller.Playlists } } - [IgnoreDataMember] + [JsonIgnore] protected override bool FilterLinkedChildrenPerUser => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsInheritedParentImages => false; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsPlayedStatus => string.Equals(MediaType, "Video", StringComparison.OrdinalIgnoreCase); - [IgnoreDataMember] + [JsonIgnore] public override bool AlwaysScanInternalMetadataPath => true; - [IgnoreDataMember] + [JsonIgnore] public override bool SupportsCumulativeRunTimeTicks => true; public override double GetDefaultPrimaryImageAspectRatio() @@ -193,12 +193,12 @@ namespace MediaBrowser.Controller.Playlists return new[] { item }; } - [IgnoreDataMember] + [JsonIgnore] public override bool IsPreSorted => true; public string PlaylistMediaType { get; set; } - [IgnoreDataMember] + [JsonIgnore] public override string MediaType => PlaylistMediaType; public void SetMediaType(string value) @@ -206,7 +206,7 @@ namespace MediaBrowser.Controller.Playlists PlaylistMediaType = value; } - [IgnoreDataMember] + [JsonIgnore] private bool IsSharedItem { get diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index f0e81e8e7..acda6a416 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -1,9 +1,9 @@ using System; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; using Microsoft.Extensions.Logging; @@ -123,7 +123,7 @@ namespace MediaBrowser.Controller.Session /// Gets or sets the session controller. /// /// The session controller. - [IgnoreDataMember] + [JsonIgnore] public ISessionController[] SessionControllers { get; set; } /// diff --git a/MediaBrowser.Model/Dto/BaseItemPerson.cs b/MediaBrowser.Model/Dto/BaseItemPerson.cs index 7011ff8ea..270a4683a 100644 --- a/MediaBrowser.Model/Dto/BaseItemPerson.cs +++ b/MediaBrowser.Model/Dto/BaseItemPerson.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Serialization; +using System.Text.Json.Serialization; namespace MediaBrowser.Model.Dto { @@ -41,7 +41,7 @@ namespace MediaBrowser.Model.Dto /// Gets a value indicating whether this instance has primary image. /// /// true if this instance has primary image; otherwise, false. - [IgnoreDataMember] + [JsonIgnore] public bool HasPrimaryImage => PrimaryImageTag != null; } } diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs index 92e40fb01..5bdc4809a 100644 --- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; +using System.Text.Json.Serialization; using MediaBrowser.Model.Entities; using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; namespace MediaBrowser.Model.Dto @@ -108,7 +108,7 @@ namespace MediaBrowser.Model.Dto } } - [IgnoreDataMember] + [JsonIgnore] public TranscodeReason[] TranscodeReasons { get; set; } public int? DefaultAudioStreamIndex { get; set; } @@ -148,7 +148,7 @@ namespace MediaBrowser.Model.Dto return null; } - [IgnoreDataMember] + [JsonIgnore] public MediaStream VideoStream { get diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index e9f43ea56..3ed319a0d 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -16,6 +16,7 @@ + diff --git a/MediaBrowser.Model/Serialization/IgnoreDataMemberAttribute.cs b/MediaBrowser.Model/Serialization/IgnoreDataMemberAttribute.cs deleted file mode 100644 index b43949fe3..000000000 --- a/MediaBrowser.Model/Serialization/IgnoreDataMemberAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace MediaBrowser.Model.Serialization -{ - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = false, AllowMultiple = false)] - public sealed class IgnoreDataMemberAttribute : Attribute - { - public IgnoreDataMemberAttribute() - { - } - } -} diff --git a/MediaBrowser.Model/Updates/PackageVersionInfo.cs b/MediaBrowser.Model/Updates/PackageVersionInfo.cs index 7ef07c0df..c0790317d 100644 --- a/MediaBrowser.Model/Updates/PackageVersionInfo.cs +++ b/MediaBrowser.Model/Updates/PackageVersionInfo.cs @@ -1,5 +1,5 @@ using System; -using MediaBrowser.Model.Serialization; +using System.Text.Json.Serialization; namespace MediaBrowser.Model.Updates { @@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Updates /// Had to make this an interpreted property since Protobuf can't handle Version /// /// The version. - [IgnoreDataMember] + [JsonIgnore] public Version Version { get