mirror of
https://github.com/jellyfin/TMDbLib.git
synced 2025-02-21 05:52:48 +00:00
Merge pull request #507 from DineshSolanki/#505-Add-collection-support-to-searchMulti
Co-authored-by: Tim Eisele <Shadowghost@users.noreply.github.com>
This commit is contained in:
commit
aa9f0b3068
@ -28,6 +28,9 @@ namespace TMDbLib.Objects.General
|
||||
Season = 6,
|
||||
|
||||
[EnumValue("tv_season")]
|
||||
TvSeason = 7
|
||||
TvSeason = 7,
|
||||
|
||||
[EnumValue("collection")]
|
||||
Collection = 8
|
||||
}
|
||||
}
|
@ -1,26 +1,58 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace TMDbLib.Objects.Search
|
||||
{
|
||||
public class SearchCollection
|
||||
public class SearchCollection : SearchBase
|
||||
{
|
||||
// Property to hold additional data from the JSON
|
||||
[JsonExtensionData]
|
||||
private IDictionary<string, JToken> _additionalData;
|
||||
|
||||
[JsonProperty("adult")]
|
||||
public bool Adult { get; set; }
|
||||
|
||||
[JsonProperty("backdrop_path")]
|
||||
public string BackdropPath { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
private string _name;
|
||||
private string _originalName;
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
// If _name is not set, attempt to retrieve the "title" property from additional data
|
||||
if (_name == null && _additionalData != null && _additionalData.TryGetValue("title", out var nameToken))
|
||||
{
|
||||
return nameToken.ToString();
|
||||
}
|
||||
|
||||
return _name;
|
||||
}
|
||||
set => _name = value;
|
||||
}
|
||||
|
||||
[JsonProperty("original_language")]
|
||||
public string OriginalLanguage { get; set; }
|
||||
|
||||
|
||||
[JsonProperty("original_name")]
|
||||
public string OriginalName { get; set; }
|
||||
public string OriginalName
|
||||
{
|
||||
get
|
||||
{
|
||||
// If _originalName is not set, attempt to retrieve the "original_title" property from additional data
|
||||
if (_originalName == null && _additionalData != null &&
|
||||
_additionalData.TryGetValue("original_title", out var originalNameToken))
|
||||
{
|
||||
return originalNameToken.ToString();
|
||||
}
|
||||
|
||||
return _originalName;
|
||||
}
|
||||
set => _originalName = value;
|
||||
}
|
||||
|
||||
[JsonProperty("overview")]
|
||||
public string Overview { get; set; }
|
||||
|
@ -37,6 +37,7 @@ namespace TMDbLib.Utilities.Converters
|
||||
MediaType.TvEpisode => new SearchTvEpisode(),
|
||||
MediaType.Season => new SearchTvSeason(),
|
||||
MediaType.TvSeason => new SearchTvSeason(),
|
||||
MediaType.Collection => new SearchCollection(),
|
||||
_ => throw new ArgumentOutOfRangeException(),
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user