Devcontainer, fixes
This commit is contained in:
1 parent
b619253510
commit
8ca93bf060
26 files changed
+929
-302
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -10,10 +11,21 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.7.0" />
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.7.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
|
||||
<PackageReference Include="Macross.Json.Extensions" Version="2.0.0" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.*">
|
||||
<IncludeAssets>compile</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.*">
|
||||
<IncludeAssets>compile</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0">
|
||||
<IncludeAssets>compile</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Macross.Json.Extensions" Version="2.0.0">
|
||||
<IncludeAssets>all</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Text.Json" Version="5.*">
|
||||
<IncludeAssets>compile</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
@@ -61,7 +62,40 @@ namespace Jellyfin.Plugin.Kinopoisk
|
||||
|
||||
var film = await _apiProxy.GetSingleFilmImages(kinopoiskId, cancellationToken);
|
||||
|
||||
return film.ToRemoteImageInfos();
|
||||
return await FilterEmptyImages(film.ToRemoteImageInfos());
|
||||
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<RemoteImageInfo>> FilterEmptyImages(IEnumerable<RemoteImageInfo> images)
|
||||
{
|
||||
using (var httpClient = new HttpClient(new HttpClientHandler() { AllowAutoRedirect = false }, true))
|
||||
{
|
||||
var res = await Task.WhenAll(images.Select(i => NullIfEmptyImage(i, httpClient)));
|
||||
|
||||
return res.Where(i => i != null);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<RemoteImageInfo> NullIfEmptyImage(RemoteImageInfo info, HttpClient httpClient)
|
||||
{
|
||||
var currentUrl = info.Url;
|
||||
while (!currentUrl.Contains("no-poster"))
|
||||
{
|
||||
var response = await httpClient.SendAsync(
|
||||
new HttpRequestMessage(HttpMethod.Get, currentUrl), HttpCompletionOption.ResponseHeadersRead);
|
||||
|
||||
if ((int)response.StatusCode <= 299)
|
||||
return info;
|
||||
else if (response.Headers.Location != null)
|
||||
{
|
||||
currentUrl = response.Headers.Location.ToString();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
throw new InvalidOperationException("Not expected answer");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
namespace Jellyfin.Plugin.Kinopoisk
|
||||
namespace Jellyfin.Plugin.Kinopoisk.Model
|
||||
{
|
||||
public class KinopoiskExternalId : IExternalId
|
||||
{
|
||||
@@ -0,0 +1,27 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
namespace Jellyfin.Plugin.Kinopoisk.Model
|
||||
{
|
||||
public class KinopoiskPersonExternalId : IExternalId
|
||||
{
|
||||
public string ProviderName => Utils.ProviderName;
|
||||
|
||||
public string Name => Utils.ProviderName;
|
||||
|
||||
public string Key => Utils.ProviderId;
|
||||
|
||||
public string UrlFormatString => "https://www.kinopoisk.ru/name/{0}";
|
||||
|
||||
public ExternalIdMediaType? Type => null;
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Person;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user