mirror of
https://github.com/jellyfin/TMDbLib.git
synced 2025-02-17 03:57:47 +00:00
Merge remote-tracking branch 'original/master'
This commit is contained in:
commit
ee9aefe708
@ -3,4 +3,12 @@
|
||||
dotnet_diagnostic.CS4014.severity = error
|
||||
|
||||
# CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member'
|
||||
dotnet_diagnostic.CS1591.severity = none
|
||||
dotnet_diagnostic.CS1591.severity = silent
|
||||
|
||||
# C# styling
|
||||
csharp_style_namespace_declarations=file_scoped:error
|
||||
|
||||
[*.{targets,csproj}]
|
||||
tab_width=2
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
|
6
.github/workflows/dotnet.yml
vendored
6
.github/workflows/dotnet.yml
vendored
@ -15,15 +15,15 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||
with:
|
||||
fetch-depth: 50
|
||||
- run: git fetch --tags
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
dotnet-version: 7.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
11
.github/workflows/nuget.yml
vendored
11
.github/workflows/nuget.yml
vendored
@ -4,7 +4,6 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
- '!v*-*'
|
||||
|
||||
env:
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||
@ -15,13 +14,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||
# We do not need to fetch tags, as we're already at a tagged build - it should be available automatically
|
||||
|
||||
- name: Setup .NET Core 5.0
|
||||
uses: actions/setup-dotnet@v1
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
dotnet-version: 7.0.x
|
||||
|
||||
- name: Pack
|
||||
run: dotnet pack -c Release -o Build
|
||||
@ -33,4 +32,4 @@ jobs:
|
||||
run: dotnet nuget push --no-symbols --skip-duplicate -k ${{ secrets.GITHUB_TOKEN }} -s "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" Build/*.nupkg
|
||||
|
||||
- name: Nuget push
|
||||
run: dotnet nuget push --skip-duplicate -k ${{secrets.NUGET_KEY}} -s https://api.nuget.org/v3/index.json Build/*.nupkg
|
||||
run: dotnet nuget push --skip-duplicate -k ${{secrets.NUGET_APIKEY}} -s https://api.nuget.org/v3/index.json Build/*.nupkg
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
.vs/
|
||||
.idea/
|
||||
bin/
|
||||
obj/
|
||||
Build/
|
||||
|
@ -27,7 +27,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MinVer" Version="2.5.0" PrivateAssets="all" />
|
||||
<PackageReference Include="MinVer" Version="4.3.0" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Deterministic build paths, https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/#deterministic-builds -->
|
||||
@ -41,9 +41,15 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Set copying files etc. to timeout faster -->
|
||||
<PropertyGroup>
|
||||
<CopyRetryCount>2</CopyRetryCount>
|
||||
<CopyRetryDelayMilliseconds>500</CopyRetryDelayMilliseconds>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Ensure AssemblyInfo.cs can be included in <EmbedUntrackedSources> https://github.com/dotnet/sourcelink/issues/572 -->
|
||||
<Target Name="_workaroundMsBuild1479" BeforeTargets="BeforeCompile" AfterTargets="GenerateAssemblyInfo"></Target>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31105.61
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.6.33815.320
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TMDbLib", "TMDbLib\TMDbLib.csproj", "{A7D4744C-9EF2-4CC3-B786-E8E568874933}"
|
||||
EndProject
|
||||
@ -10,8 +10,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TMDbLibTests", "TMDbLibTest
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{26BF5A0A-354A-46F5-A20C-0BEB5D45783A}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Directory.Build.props = Directory.Build.props
|
||||
.editorconfig = .editorconfig
|
||||
Directory.Build.props = Directory.Build.props
|
||||
Readme.md = Readme.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
@ -73,5 +73,10 @@ namespace TMDbLib.Client
|
||||
{
|
||||
return await GetCollectionMethodInternal<ImagesWithId>(collectionId, CollectionMethods.Images, language, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<TranslationsContainer> GetCollectionTranslationsAsync(int collectionId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await GetCollectionMethodInternal<TranslationsContainer>(collectionId, CollectionMethods.Translations, null, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,11 +7,14 @@ namespace TMDbLib.Client
|
||||
{
|
||||
public partial class TMDbClient
|
||||
{
|
||||
public async Task<Review> GetReviewAsync(string reviewId, CancellationToken cancellationToken = default)
|
||||
public async Task<Review> GetReviewAsync(string reviewId, string language = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
RestRequest request = _client.Create("review/{reviewId}");
|
||||
request.AddUrlSegment("reviewId", reviewId);
|
||||
|
||||
if (language != null)
|
||||
request.AddQueryString("language", language);
|
||||
|
||||
// TODO: Dateformat?
|
||||
//request.DateFormat = "yyyy-MM-dd";
|
||||
|
||||
|
@ -11,13 +11,15 @@ namespace TMDbLib.Client
|
||||
{
|
||||
public partial class TMDbClient
|
||||
{
|
||||
public async Task<SearchContainer<SearchMovie>> GetTrendingMoviesAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
|
||||
public async Task<SearchContainer<SearchMovie>> GetTrendingMoviesAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
RestRequest req = _client.Create("trending/movie/{time_window}");
|
||||
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
||||
|
||||
if (page >= 1)
|
||||
req.AddQueryString("page", page.ToString());
|
||||
if (language != null)
|
||||
req.AddQueryString("language", language);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(DefaultLanguage))
|
||||
req.AddParameter("language", DefaultLanguage);
|
||||
@ -27,13 +29,15 @@ namespace TMDbLib.Client
|
||||
return resp;
|
||||
}
|
||||
|
||||
public async Task<SearchContainer<SearchTv>> GetTrendingTvAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
|
||||
public async Task<SearchContainer<SearchTv>> GetTrendingTvAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
RestRequest req = _client.Create("trending/tv/{time_window}");
|
||||
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
||||
|
||||
if (page >= 1)
|
||||
req.AddQueryString("page", page.ToString());
|
||||
if (language != null)
|
||||
req.AddQueryString("language", language);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(DefaultLanguage))
|
||||
req.AddParameter("language", DefaultLanguage);
|
||||
@ -43,13 +47,15 @@ namespace TMDbLib.Client
|
||||
return resp;
|
||||
}
|
||||
|
||||
public async Task<SearchContainer<SearchPerson>> GetTrendingPeopleAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
|
||||
public async Task<SearchContainer<SearchPerson>> GetTrendingPeopleAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
RestRequest req = _client.Create("trending/person/{time_window}");
|
||||
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
||||
|
||||
if (page >= 1)
|
||||
req.AddQueryString("page", page.ToString());
|
||||
if (language != null)
|
||||
req.AddQueryString("language", language);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(DefaultLanguage))
|
||||
req.AddParameter("language", DefaultLanguage);
|
||||
@ -58,5 +64,20 @@ namespace TMDbLib.Client
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
public async Task<SearchContainer<SearchBase>> GetTrendingAllAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
RestRequest req = _client.Create("trending/all/{time_window}");
|
||||
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
||||
|
||||
if (page >= 1)
|
||||
req.AddQueryString("page", page.ToString());
|
||||
if (language != null)
|
||||
req.AddQueryString("language", language);
|
||||
|
||||
SearchContainer<SearchBase> resp = await req.GetOfT<SearchContainer<SearchBase>>(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -173,6 +173,11 @@ namespace TMDbLib.Client
|
||||
return await GetTvEpisodeMethodInternal<ResultContainer<Video>>(tvShowId, seasonNumber, episodeNumber, TvEpisodeMethods.Videos, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<TranslationsContainer> GetTvEpisodeTranslationsAsync(int tvShowId, int seasonNumber, int episodeNumber, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await GetTvEpisodeMethodInternal<TranslationsContainer>(tvShowId, seasonNumber, episodeNumber, TvEpisodeMethods.Translations, null, null, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<bool> TvEpisodeRemoveRatingAsync(int tvShowId, int seasonNumber, int episodeNumber, CancellationToken cancellationToken = default)
|
||||
{
|
||||
RequireSessionId(SessionType.GuestSession);
|
||||
|
@ -160,5 +160,10 @@ namespace TMDbLib.Client
|
||||
{
|
||||
return await GetTvSeasonMethodInternal<ResultContainer<Video>>(tvShowId, seasonNumber, TvSeasonMethods.Videos, language: language, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<TranslationsContainer> GetTvSeasonTranslationsAsync(int tvShowId, int seasonNumber, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await GetTvSeasonMethodInternal<TranslationsContainer>(tvShowId, seasonNumber, TvSeasonMethods.Translations, null, null, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,9 @@ namespace TMDbLib.Objects.Collections
|
||||
[JsonProperty("images")]
|
||||
public Images Images { get; set; }
|
||||
|
||||
[JsonProperty("translations")]
|
||||
public TranslationsContainer Translations { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
@ -9,6 +9,8 @@ namespace TMDbLib.Objects.Collections
|
||||
[EnumValue("Undefined")]
|
||||
Undefined = 0,
|
||||
[EnumValue("images")]
|
||||
Images = 1
|
||||
Images = 1,
|
||||
[EnumValue("translations")]
|
||||
Translations = 2,
|
||||
}
|
||||
}
|
@ -374,6 +374,24 @@ namespace TMDbLib.Objects.Discover
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only include movies that are equal to, or have a runtime higher than this value. Expected value is an integer (minutes).
|
||||
/// </summary>
|
||||
public DiscoverMovie WhereRuntimeIsAtLeast(int minutes)
|
||||
{
|
||||
Parameters["with_runtime.gte"] = minutes.ToString();
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only include movies that are equal to, or have a runtime lower than this value. Expected value is an integer (minutes).
|
||||
/// </summary>
|
||||
public DiscoverMovie WhereRuntimeIsAtMost(int minutes)
|
||||
{
|
||||
Parameters["with_runtime.lte"] = minutes.ToString();
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filter movies by their vote average and only include those that have an average rating that is equal to or higher than the specified value. Expected value is a float.
|
||||
/// </summary>
|
||||
|
@ -125,6 +125,15 @@ namespace TMDbLib.Objects.Discover
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only include TV shows that are equal to, or have a lower average rating than this value. Expected value is a float.
|
||||
/// </summary>
|
||||
public DiscoverTv WhereVoteAverageIsAtMost(double score)
|
||||
{
|
||||
Parameters["vote_average.lte"] = score.ToString();
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only include TV shows that are equal to, or have a vote count higher than this value. Expected value is an integer.
|
||||
/// </summary>
|
||||
@ -134,6 +143,15 @@ namespace TMDbLib.Objects.Discover
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only include TV shows that are equal to, or have a vote count lower than this value. Expected value is an integer.
|
||||
/// </summary>
|
||||
public DiscoverTv WhereVoteCountIsAtMost(int count)
|
||||
{
|
||||
Parameters["vote_count.lte"] = count.ToString();
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies which language to use for translatable fields
|
||||
/// </summary>
|
||||
|
@ -16,6 +16,18 @@ namespace TMDbLib.Objects.Discover
|
||||
[EnumValue("popularity.asc")]
|
||||
Popularity,
|
||||
[EnumValue("popularity.desc")]
|
||||
PopularityDesc
|
||||
PopularityDesc,
|
||||
[EnumValue("revenue.asc")]
|
||||
Revenue,
|
||||
[EnumValue("revenue.desc")]
|
||||
RevenueDesc,
|
||||
[EnumValue("primary_release_date.asc")]
|
||||
PrimaryReleaseDate,
|
||||
[EnumValue("primary_release_date.desc")]
|
||||
PrimaryReleaseDateDesc,
|
||||
[EnumValue("vote_count.asc")]
|
||||
VoteCount,
|
||||
[EnumValue("vote_count.desc")]
|
||||
VoteCountDesc
|
||||
}
|
||||
}
|
||||
|
@ -15,5 +15,8 @@ namespace TMDbLib.Objects.General
|
||||
|
||||
[JsonProperty("tvrage_id")]
|
||||
public string TvrageId { get; set; }
|
||||
|
||||
[JsonProperty("wikidata_id")]
|
||||
public string WikidataId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,15 @@ namespace TMDbLib.Objects.General
|
||||
Person = 3,
|
||||
|
||||
[EnumValue("episode")]
|
||||
Episode = 4
|
||||
Episode = 4,
|
||||
|
||||
[EnumValue("tv_episode")]
|
||||
TvEpisode = 5,
|
||||
|
||||
[EnumValue("season")]
|
||||
Season = 6,
|
||||
|
||||
[EnumValue("tv_season")]
|
||||
TvSeason = 7
|
||||
}
|
||||
}
|
@ -18,6 +18,14 @@ namespace TMDbLib.Objects.General
|
||||
[JsonProperty("overview")]
|
||||
public string Overview { get; set; }
|
||||
|
||||
// Private hack to ensure two properties (overview, biography) are deserialized into Overview.
|
||||
// Most of the entities have an overview, but people have a biography.
|
||||
[JsonProperty("biography")]
|
||||
private string Biography
|
||||
{
|
||||
set => Overview = value;
|
||||
}
|
||||
|
||||
[JsonProperty("homepage")]
|
||||
public string HomePage { get; set; }
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TMDbLib.Objects.General
|
||||
{
|
||||
@ -25,6 +26,12 @@ namespace TMDbLib.Objects.General
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("official")]
|
||||
public bool Official { get; set; }
|
||||
|
||||
[JsonProperty("published_at")]
|
||||
public DateTime PublishedAt { get; set; }
|
||||
|
||||
[JsonProperty("site")]
|
||||
public string Site { get; set; }
|
||||
|
||||
|
@ -14,6 +14,6 @@ namespace TMDbLib.Objects.Reviews
|
||||
public string AvatarPath { get; set; }
|
||||
|
||||
[JsonProperty("rating")]
|
||||
public string Rating { get; set; }
|
||||
public double? Rating { get; set; }
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using TMDbLib.Objects.Reviews;
|
||||
using System;
|
||||
|
||||
namespace TMDbLib.Objects.Reviews
|
||||
{
|
||||
@ -19,5 +19,11 @@ namespace TMDbLib.Objects.Reviews
|
||||
|
||||
[JsonProperty("url")]
|
||||
public string Url { get; set; }
|
||||
|
||||
[JsonProperty("created_at")]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[JsonProperty("updated_at")]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
}
|
@ -1,19 +1,22 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using TMDbLib.Objects.General;
|
||||
|
||||
namespace TMDbLib.Objects.Search
|
||||
{
|
||||
public class SearchTvSeason
|
||||
public class SearchTvSeason : SearchBase
|
||||
{
|
||||
public SearchTvSeason()
|
||||
{
|
||||
MediaType = MediaType.Season;
|
||||
}
|
||||
|
||||
[JsonProperty("air_date")]
|
||||
public DateTime? AirDate { get; set; }
|
||||
|
||||
[JsonProperty("episode_count")]
|
||||
public int EpisodeCount { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
@ -17,6 +17,9 @@ namespace TMDbLib.Objects.Search
|
||||
[JsonProperty("episode_number")]
|
||||
public int EpisodeNumber { get; set; }
|
||||
|
||||
[JsonProperty("episode_type")]
|
||||
public string EpisodeType { get; set; }
|
||||
|
||||
[JsonProperty("guest_stars")]
|
||||
public List<Cast> GuestStars { get; set; }
|
||||
|
||||
@ -32,9 +35,12 @@ namespace TMDbLib.Objects.Search
|
||||
[JsonProperty("production_code")]
|
||||
public string ProductionCode { get; set; }
|
||||
|
||||
[JsonProperty("runtime")]
|
||||
public int? Runtime { get; set; }
|
||||
|
||||
[JsonProperty("season_number")]
|
||||
public int SeasonNumber { get; set; }
|
||||
|
||||
|
||||
[JsonProperty("still_path")]
|
||||
public string StillPath { get; set; }
|
||||
|
||||
@ -44,4 +50,4 @@ namespace TMDbLib.Objects.Search
|
||||
[JsonProperty("vote_count")]
|
||||
public int VoteCount { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,5 +26,8 @@ namespace TMDbLib.Objects.TvShows
|
||||
|
||||
[JsonProperty("videos")]
|
||||
public ResultContainer<Video> Videos { get; set; }
|
||||
|
||||
[JsonProperty("translations")]
|
||||
public TranslationsContainer Translations { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -28,5 +28,8 @@ namespace TMDbLib.Objects.TvShows
|
||||
|
||||
[JsonProperty("vote_count")]
|
||||
public int VoteCount { get; set; }
|
||||
|
||||
[JsonProperty("runtime")]
|
||||
public int? Runtime { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,7 @@ namespace TMDbLib.Objects.TvShows
|
||||
Videos = 8,
|
||||
[EnumValue("account_states")]
|
||||
AccountStates = 16,
|
||||
[EnumValue("translations")]
|
||||
Translations = 32,
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,13 @@ namespace TMDbLib.Objects.TvShows
|
||||
[JsonProperty("season_number")]
|
||||
public int SeasonNumber { get; set; }
|
||||
|
||||
[JsonProperty("vote_average")]
|
||||
public double VoteAverage { get; set; }
|
||||
|
||||
[JsonProperty("videos")]
|
||||
public ResultContainer<Video> Videos { get; set; }
|
||||
|
||||
[JsonProperty("translations")]
|
||||
public TranslationsContainer Translations { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,7 @@ namespace TMDbLib.Objects.TvShows
|
||||
Videos = 8,
|
||||
[EnumValue("account_states")]
|
||||
AccountStates = 16,
|
||||
[EnumValue("translations")]
|
||||
Translations = 32,
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,9 @@ namespace TMDbLib.Objects.TvShows
|
||||
{
|
||||
public class TvShow
|
||||
{
|
||||
[JsonProperty("adult")]
|
||||
public bool Adult { get; set; }
|
||||
|
||||
[JsonProperty("account_states")]
|
||||
public AccountState AccountStates { get; set; }
|
||||
|
||||
|
@ -10,15 +10,19 @@
|
||||
|
||||
<!-- Analyzers -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0" PrivateAssets="All" />
|
||||
<PackageReference Include="IDisposableAnalyzers" Version="4.0.1">
|
||||
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0.1" PrivateAssets="All" />
|
||||
<PackageReference Include="IDisposableAnalyzers" Version="4.0.7">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" PrivateAssets="compile" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" PrivateAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
|
||||
|
@ -28,23 +28,17 @@ namespace TMDbLib.Utilities.Converters
|
||||
// Determine the type based on the media_type
|
||||
MediaType mediaType = jObject["media_type"].ToObject<MediaType>();
|
||||
|
||||
switch (mediaType)
|
||||
result = mediaType switch
|
||||
{
|
||||
case MediaType.Movie:
|
||||
result = new SearchMovie();
|
||||
break;
|
||||
case MediaType.Tv:
|
||||
result = new SearchTv();
|
||||
break;
|
||||
case MediaType.Person:
|
||||
result = new SearchPerson();
|
||||
break;
|
||||
case MediaType.Episode:
|
||||
result = new SearchTvEpisode();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
MediaType.Movie => new SearchMovie(),
|
||||
MediaType.Tv => new SearchTv(),
|
||||
MediaType.Person => new SearchPerson(),
|
||||
MediaType.Episode => new SearchTvEpisode(),
|
||||
MediaType.TvEpisode => new SearchTvEpisode(),
|
||||
MediaType.Season => new SearchTvSeason(),
|
||||
MediaType.TvSeason => new SearchTvSeason(),
|
||||
_ => throw new ArgumentOutOfRangeException(),
|
||||
};
|
||||
}
|
||||
|
||||
// Populate the result
|
||||
|
@ -24,21 +24,14 @@ namespace TMDbLib.Utilities.Converters
|
||||
serializer.Populate(jsonReader, result);
|
||||
|
||||
JToken mediaJson = jObject["media"];
|
||||
switch (result.MediaType)
|
||||
result.Media = result.MediaType switch
|
||||
{
|
||||
case MediaType.Movie:
|
||||
result.Media = mediaJson.ToObject<SearchMovie>();
|
||||
break;
|
||||
case MediaType.Tv:
|
||||
result.Media = mediaJson.ToObject<SearchTv>();
|
||||
break;
|
||||
case MediaType.Episode:
|
||||
result.Media = mediaJson.ToObject<SearchTvEpisode>();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
MediaType.Movie => mediaJson.ToObject<SearchMovie>(),
|
||||
MediaType.Tv => mediaJson.ToObject<SearchTv>(),
|
||||
MediaType.Episode => mediaJson.ToObject<SearchTvEpisode>(),
|
||||
MediaType.Season => mediaJson.ToObject<SearchTvSeason>(),
|
||||
_ => throw new ArgumentOutOfRangeException(),
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -29,5 +29,12 @@ namespace TMDbLibTests
|
||||
SearchContainer<SearchPerson> people = await TMDbClient.GetTrendingPeopleAsync(TimeWindow.Week);
|
||||
Assert.NotEmpty(people.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTrendingAllAsync()
|
||||
{
|
||||
SearchContainer<SearchBase> all = await TMDbClient.GetTrendingAllAsync(TimeWindow.Week);
|
||||
Assert.NotEmpty(all.Results);
|
||||
}
|
||||
}
|
||||
}
|
@ -51,6 +51,7 @@
|
||||
public const int TomHanks = 31;
|
||||
public const string ImdbBruceWillis = "nm0000246";
|
||||
public const int JoshACagan = 129305;
|
||||
public const int AnnaTorv = 30084;
|
||||
|
||||
// Collections
|
||||
public const int JamesBondCollection = 645;
|
||||
|
@ -3,7 +3,7 @@
|
||||
<Import Project="..\_Imports\Test.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -15,10 +15,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" PrivateAssets="All" />
|
||||
<PackageReference Include="Verify.Xunit" Version="14.14.1" />
|
||||
<PackageReference Include="xunit" Version="2.6.5" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" PrivateAssets="All" />
|
||||
<PackageReference Include="Verify.Xunit" Version="17.10.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -57,8 +57,9 @@ namespace TMDbLibTests.UtilityTests
|
||||
/// Tests the TaggedImageConverter
|
||||
/// </summary>
|
||||
[Theory]
|
||||
[InlineData(IdHelper.HughLaurie)] // Has Movie media
|
||||
[InlineData(IdHelper.HughLaurie)] // Has Movie media
|
||||
[InlineData(IdHelper.TomHanks)] // Has Episode media
|
||||
[InlineData(IdHelper.AnnaTorv)] // Has Tv, Season media
|
||||
public async Task TestJsonTaggedImageConverter(int personId)
|
||||
{
|
||||
// Get images
|
||||
@ -77,9 +78,11 @@ namespace TMDbLibTests.UtilityTests
|
||||
Assert.IsType<SearchTv>(item.Media);
|
||||
else if (item.MediaType == MediaType.Episode)
|
||||
Assert.IsType<SearchTvEpisode>(item.Media);
|
||||
else if (item.MediaType == MediaType.Season)
|
||||
Assert.IsType<SearchTvSeason>(item.Media);
|
||||
else
|
||||
Assert.False(true, $"Unexpected type {item.GetType().Name}");
|
||||
Assert.Fail($"Unexpected type {item.GetType().Name}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,5 +3,6 @@
|
||||
imdb_id: tt1856101,
|
||||
facebook_id: BladeRunner2049,
|
||||
twitter_id: bladerunner,
|
||||
instagram_id: bladerunnermovie
|
||||
instagram_id: bladerunnermovie,
|
||||
wikidata_id: Q21500755
|
||||
}
|
@ -4,5 +4,6 @@
|
||||
freebase_id: /en/bruce_willis,
|
||||
freebase_mid: /m/0h7pj,
|
||||
id: Id_1,
|
||||
tvrage_id: 10183
|
||||
tvrage_id: 10183,
|
||||
wikidata_id: Q2680
|
||||
}
|
@ -3,5 +3,6 @@
|
||||
tvdb_id: 349232,
|
||||
freebase_mid: /m/03mb620,
|
||||
id: Id_1,
|
||||
tvrage_id: 637041
|
||||
tvrage_id: 637041,
|
||||
wikidata_id: Q14625947
|
||||
}
|
@ -2,5 +2,6 @@
|
||||
tvdb_id: 30272,
|
||||
freebase_id: /en/breaking_bad_season_1,
|
||||
freebase_mid: /m/05yy27m,
|
||||
id: Id_1
|
||||
id: Id_1,
|
||||
wikidata_id: Q1582890
|
||||
}
|
@ -7,5 +7,6 @@
|
||||
freebase_id: /en/game_of_thrones,
|
||||
freebase_mid: /m/0524b41,
|
||||
id: Id_1,
|
||||
tvrage_id: 24493
|
||||
tvrage_id: 24493,
|
||||
wikidata_id: Q23572
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
<Import Project="..\_Imports\Test.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
6
renovate.json
Normal file
6
renovate.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"github>jellyfin/.github//renovate-presets/dotnet"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user