Add missing episodes feature: implement FindMissingEpisodes endpoint, update metadata providers to retrieve season episode counts, and enhance frontend components for displaying missing episodes report. Update translations for new UI elements.
This commit is contained in:
@@ -87,6 +87,25 @@ public sealed class OmdbMetadataProvider(
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<int?> GetSeasonEpisodeCountAsync(
|
||||
string externalId,
|
||||
int season,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var url =
|
||||
$"{_omdb.BaseUrl}/?apikey={_omdb.ApiKey}&i={Uri.EscapeDataString(externalId)}&Season={season}";
|
||||
using var doc = await TryGetJsonAsync(url, cancellationToken);
|
||||
if (
|
||||
doc is null
|
||||
|| !IsResponseTrue(doc.RootElement)
|
||||
|| !doc.RootElement.TryGetProperty("Episodes", out var episodes)
|
||||
|| episodes.ValueKind != JsonValueKind.Array
|
||||
)
|
||||
return null;
|
||||
return episodes.GetArrayLength();
|
||||
}
|
||||
|
||||
/// <summary>GET+parse; бросает при не-2xx/сетевой ошибке (для поиска — чтобы показать сбой).</summary>
|
||||
private async Task<JsonDocument> GetJsonAsync(string url, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user