mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 20:24:27 -04:00
Remove custom serializer ignore
This commit is contained in:
parent
64031668c1
commit
9493531eaa
@ -10,11 +10,9 @@
|
|||||||
<PackageReference Include="Autofac" Version="7.1.0" />
|
<PackageReference Include="Autofac" Version="7.1.0" />
|
||||||
<PackageReference Include="Dapper" Version="2.1.24" />
|
<PackageReference Include="Dapper" Version="2.1.24" />
|
||||||
<PackageReference Include="EntityFrameworkCore.Projectables" Version="4.1.4-prebeta" />
|
<PackageReference Include="EntityFrameworkCore.Projectables" Version="4.1.4-prebeta" />
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
<PackageReference Include="Sprache" Version="2.3.1" />
|
<PackageReference Include="Sprache" Version="2.3.1" />
|
||||||
<PackageReference Include="System.ComponentModel.Composition" Version="7.0.0" />
|
<PackageReference Include="System.ComponentModel.Composition" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
// Kyoo - A portable and vast media library solution.
|
|
||||||
// Copyright (c) Kyoo.
|
|
||||||
//
|
|
||||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
|
||||||
//
|
|
||||||
// Kyoo is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// any later version.
|
|
||||||
//
|
|
||||||
// Kyoo is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models.Attributes
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Remove a property from the deserialization pipeline. The user can't input value for this property.
|
|
||||||
/// </summary>
|
|
||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
|
||||||
public class DeserializeIgnoreAttribute : Attribute { }
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
// Kyoo - A portable and vast media library solution.
|
|
||||||
// Copyright (c) Kyoo.
|
|
||||||
//
|
|
||||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
|
||||||
//
|
|
||||||
// Kyoo is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// any later version.
|
|
||||||
//
|
|
||||||
// Kyoo is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models.Attributes
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Remove an property from the serialization pipeline. It will simply be skipped.
|
|
||||||
/// </summary>
|
|
||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
|
||||||
public class SerializeIgnoreAttribute : Attribute { }
|
|
||||||
}
|
|
@ -19,10 +19,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
|
||||||
using Kyoo.Utils;
|
using Kyoo.Utils;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models
|
namespace Kyoo.Abstractions.Models
|
||||||
{
|
{
|
||||||
@ -65,13 +64,13 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of movies contained in this collection.
|
/// The list of movies contained in this collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<Movie>? Movies { get; set; }
|
public ICollection<Movie>? Movies { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of shows contained in this collection.
|
/// The list of shows contained in this collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<Show>? Shows { get; set; }
|
public ICollection<Show>? Shows { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -20,9 +20,9 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using EntityFrameworkCore.Projectables;
|
using EntityFrameworkCore.Projectables;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
using Kyoo.Abstractions.Models.Attributes;
|
||||||
|
|
||||||
@ -60,7 +60,6 @@ namespace Kyoo.Abstractions.Models
|
|||||||
);
|
);
|
||||||
return GetSlug(ShowId.ToString(), SeasonNumber, EpisodeNumber, AbsoluteNumber);
|
return GetSlug(ShowId.ToString(), SeasonNumber, EpisodeNumber, AbsoluteNumber);
|
||||||
}
|
}
|
||||||
[UsedImplicitly]
|
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
Match match = Regex.Match(value, @"(?<show>.+)-s(?<season>\d+)e(?<episode>\d+)");
|
Match match = Regex.Match(value, @"(?<show>.+)-s(?<season>\d+)e(?<episode>\d+)");
|
||||||
@ -90,7 +89,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The slug of the Show that contain this episode. If this is not set, this episode is ill-formed.
|
/// The slug of the Show that contain this episode. If this is not set, this episode is ill-formed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public string? ShowSlug { private get; set; }
|
public string? ShowSlug { private get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -249,7 +248,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
|| (x.SeasonNumber == SeasonNumber && x.EpisodeNumber > EpisodeNumber)
|
|| (x.SeasonNumber == SeasonNumber && x.EpisodeNumber > EpisodeNumber)
|
||||||
);
|
);
|
||||||
|
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<EpisodeWatchStatus>? Watched { get; set; }
|
public ICollection<EpisodeWatchStatus>? Watched { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -21,11 +21,11 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using EntityFrameworkCore.Projectables;
|
using EntityFrameworkCore.Projectables;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
using Kyoo.Abstractions.Models.Attributes;
|
||||||
using Kyoo.Utils;
|
using Kyoo.Utils;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models
|
namespace Kyoo.Abstractions.Models
|
||||||
{
|
{
|
||||||
@ -119,11 +119,11 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Image? Logo { get; set; }
|
public Image? Logo { get; set; }
|
||||||
|
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
[Column("air_date")]
|
[Column("air_date")]
|
||||||
public DateTime? StartAir => AirDate;
|
public DateTime? StartAir => AirDate;
|
||||||
|
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
[Column("air_date")]
|
[Column("air_date")]
|
||||||
public DateTime? EndAir => AirDate;
|
public DateTime? EndAir => AirDate;
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The ID of the Studio that made this show.
|
/// The ID of the Studio that made this show.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public Guid? StudioId { get; set; }
|
public Guid? StudioId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -155,7 +155,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of collections that contains this show.
|
/// The list of collections that contains this show.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<Collection>? Collections { get; set; }
|
public ICollection<Collection>? Collections { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -164,7 +164,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
public VideoLinks Links =>
|
public VideoLinks Links =>
|
||||||
new() { Direct = $"/movie/{Slug}/direct", Hls = $"/movie/{Slug}/master.m3u8", };
|
new() { Direct = $"/movie/{Slug}/direct", Hls = $"/movie/{Slug}/master.m3u8", };
|
||||||
|
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<MovieWatchStatus>? Watched { get; set; }
|
public ICollection<MovieWatchStatus>? Watched { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -20,10 +20,9 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
|
||||||
using Kyoo.Utils;
|
using Kyoo.Utils;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models
|
namespace Kyoo.Abstractions.Models
|
||||||
{
|
{
|
||||||
@ -62,7 +61,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of roles this person has played in. See <see cref="PeopleRole"/> for more information.
|
/// The list of roles this person has played in. See <see cref="PeopleRole"/> for more information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<PeopleRole>? Roles { get; set; }
|
public ICollection<PeopleRole>? Roles { get; set; }
|
||||||
|
|
||||||
public People() { }
|
public People() { }
|
||||||
|
@ -20,9 +20,9 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using EntityFrameworkCore.Projectables;
|
using EntityFrameworkCore.Projectables;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
using Kyoo.Abstractions.Models.Attributes;
|
||||||
|
|
||||||
@ -49,8 +49,6 @@ namespace Kyoo.Abstractions.Models
|
|||||||
return $"{ShowId}-s{SeasonNumber}";
|
return $"{ShowId}-s{SeasonNumber}";
|
||||||
return $"{ShowSlug ?? Show?.Slug}-s{SeasonNumber}";
|
return $"{ShowSlug ?? Show?.Slug}-s{SeasonNumber}";
|
||||||
}
|
}
|
||||||
[UsedImplicitly]
|
|
||||||
[NotNull]
|
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
Match match = Regex.Match(value, @"(?<show>.+)-s(?<season>\d+)");
|
Match match = Regex.Match(value, @"(?<show>.+)-s(?<season>\d+)");
|
||||||
@ -67,7 +65,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The slug of the Show that contain this episode. If this is not set, this season is ill-formed.
|
/// The slug of the Show that contain this episode. If this is not set, this season is ill-formed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public string? ShowSlug { private get; set; }
|
public string? ShowSlug { private get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -124,7 +122,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of episodes that this season contains.
|
/// The list of episodes that this season contains.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<Episode>? Episodes { get; set; }
|
public ICollection<Episode>? Episodes { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -21,11 +21,11 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using EntityFrameworkCore.Projectables;
|
using EntityFrameworkCore.Projectables;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
using Kyoo.Abstractions.Models.Attributes;
|
||||||
using Kyoo.Utils;
|
using Kyoo.Utils;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models
|
namespace Kyoo.Abstractions.Models
|
||||||
{
|
{
|
||||||
@ -119,7 +119,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Trailer { get; set; }
|
public string? Trailer { get; set; }
|
||||||
|
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
[Column("start_air")]
|
[Column("start_air")]
|
||||||
public DateTime? AirDate => StartAir;
|
public DateTime? AirDate => StartAir;
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The ID of the Studio that made this show.
|
/// The ID of the Studio that made this show.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public Guid? StudioId { get; set; }
|
public Guid? StudioId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -146,7 +146,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The different seasons in this show. If this is a movie, this list is always null or empty.
|
/// The different seasons in this show. If this is a movie, this list is always null or empty.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<Season>? Seasons { get; set; }
|
public ICollection<Season>? Seasons { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -154,13 +154,13 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// If this is a movie, there will be a unique episode (with the seasonNumber and episodeNumber set to null).
|
/// If this is a movie, there will be a unique episode (with the seasonNumber and episodeNumber set to null).
|
||||||
/// Having an episode is necessary to store metadata and tracks.
|
/// Having an episode is necessary to store metadata and tracks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<Episode>? Episodes { get; set; }
|
public ICollection<Episode>? Episodes { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of collections that contains this show.
|
/// The list of collections that contains this show.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<Collection>? Collections { get; set; }
|
public ICollection<Collection>? Collections { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -213,7 +213,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
|
|
||||||
private int _EpisodesCount => Episodes!.Count;
|
private int _EpisodesCount => Episodes!.Count;
|
||||||
|
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<ShowWatchStatus>? Watched { get; set; }
|
public ICollection<ShowWatchStatus>? Watched { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,10 +19,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
|
||||||
using Kyoo.Utils;
|
using Kyoo.Utils;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models
|
namespace Kyoo.Abstractions.Models
|
||||||
{
|
{
|
||||||
@ -48,13 +47,13 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of shows that are made by this studio.
|
/// The list of shows that are made by this studio.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<Show>? Shows { get; set; }
|
public ICollection<Show>? Shows { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of movies that are made by this studio.
|
/// The list of movies that are made by this studio.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public ICollection<Movie>? Movies { get; set; }
|
public ICollection<Movie>? Movies { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -19,10 +19,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
|
||||||
using Kyoo.Utils;
|
using Kyoo.Utils;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models
|
namespace Kyoo.Abstractions.Models
|
||||||
{
|
{
|
||||||
@ -53,7 +52,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user password (hashed, it can't be read like that). The hashing format is implementation defined.
|
/// The user password (hashed, it can't be read like that). The hashing format is implementation defined.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public string? Password { get; set; }
|
public string? Password { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
using Kyoo.Abstractions.Models.Attributes;
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models
|
namespace Kyoo.Abstractions.Models
|
||||||
@ -62,7 +63,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user that started watching this episode.
|
/// The user that started watching this episode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -74,7 +75,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="Movie"/> started.
|
/// The <see cref="Movie"/> started.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public Movie Movie { get; set; }
|
public Movie Movie { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@ -119,7 +120,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user that started watching this episode.
|
/// The user that started watching this episode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -131,7 +132,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="Episode"/> started.
|
/// The <see cref="Episode"/> started.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public Episode Episode { get; set; }
|
public Episode Episode { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@ -176,7 +177,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user that started watching this episode.
|
/// The user that started watching this episode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -188,7 +189,7 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="Show"/> started.
|
/// The <see cref="Show"/> started.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeIgnore]
|
[JsonIgnore]
|
||||||
public Show Show { get; set; }
|
public Show Show { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
@ -50,7 +50,6 @@ namespace Kyoo.Core.Api
|
|||||||
options.SerializerSettings.ContractResolver = new JsonSerializerContract(
|
options.SerializerSettings.ContractResolver = new JsonSerializerContract(
|
||||||
_httpContextAccessor
|
_httpContextAccessor
|
||||||
);
|
);
|
||||||
options.SerializerSettings.Converters.Add(new PeopleRoleConverter());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,11 +73,6 @@ namespace Kyoo.Core.Api
|
|||||||
return fields.Contains(member.Name);
|
return fields.Contains(member.Name);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (member.GetCustomAttribute<SerializeIgnoreAttribute>() != null)
|
|
||||||
property.ShouldSerialize = _ => false;
|
|
||||||
if (member.GetCustomAttribute<DeserializeIgnoreAttribute>() != null)
|
|
||||||
property.ShouldDeserialize = _ => false;
|
|
||||||
return property;
|
return property;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,16 +106,9 @@ namespace Kyoo.Core.Api
|
|||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FixedValueProvider : IValueProvider
|
public class FixedValueProvider(object value) : IValueProvider
|
||||||
{
|
{
|
||||||
private readonly object _value;
|
public object GetValue(object target) => value;
|
||||||
|
|
||||||
public FixedValueProvider(object value)
|
|
||||||
{
|
|
||||||
_value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object GetValue(object target) => _value;
|
|
||||||
|
|
||||||
public void SetValue(object target, object? value) =>
|
public void SetValue(object target, object? value) =>
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
@ -1,76 +0,0 @@
|
|||||||
// Kyoo - A portable and vast media library solution.
|
|
||||||
// Copyright (c) Kyoo.
|
|
||||||
//
|
|
||||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
|
||||||
//
|
|
||||||
// Kyoo is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// any later version.
|
|
||||||
//
|
|
||||||
// Kyoo is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Kyoo.Abstractions.Models;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace Kyoo.Core.Api
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A custom role's convertor to inline the person or the show depending on the value of
|
|
||||||
/// <see cref="PeopleRole.ForPeople"/>.
|
|
||||||
/// </summary>
|
|
||||||
public class PeopleRoleConverter : JsonConverter<PeopleRole>
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void WriteJson(
|
|
||||||
JsonWriter writer,
|
|
||||||
PeopleRole? value,
|
|
||||||
JsonSerializer serializer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// if (value == null)
|
|
||||||
// {
|
|
||||||
// writer.WriteNull();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// ICollection<PeopleRole>? oldPeople = value.Show?.People;
|
|
||||||
// ICollection<PeopleRole>? oldRoles = value.People?.Roles;
|
|
||||||
// if (value.Show != null)
|
|
||||||
// value.Show.People = null;
|
|
||||||
// if (value.People != null)
|
|
||||||
// value.People.Roles = null;
|
|
||||||
//
|
|
||||||
// JObject obj = JObject.FromObject((value.ForPeople ? value.People : value.Show)!, serializer);
|
|
||||||
// obj.Add("role", value.Role);
|
|
||||||
// obj.Add("type", value.Type);
|
|
||||||
// obj.WriteTo(writer);
|
|
||||||
//
|
|
||||||
// if (value.Show != null)
|
|
||||||
// value.Show.People = oldPeople;
|
|
||||||
// if (value.People != null)
|
|
||||||
// value.People.Roles = oldRoles;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override PeopleRole ReadJson(
|
|
||||||
JsonReader reader,
|
|
||||||
Type objectType,
|
|
||||||
PeopleRole? existingValue,
|
|
||||||
bool hasExistingValue,
|
|
||||||
JsonSerializer serializer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user