Search fixed in case of null premiere date
This commit is contained in:
1 parent
638a468732
commit
376ca813c0
6 files changed
+36
-22
No files matched your search
@@ -8,6 +8,7 @@ using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Jellyfin.Plugin.Kinopoisk
|
||||
{
|
||||
@@ -30,29 +31,37 @@ namespace Jellyfin.Plugin.Kinopoisk
|
||||
return res;
|
||||
}
|
||||
|
||||
public static IEnumerable<RemoteSearchResult> ToRemoteSearchResults(this FilmSearchResponse src)
|
||||
public static IEnumerable<RemoteSearchResult> ToRemoteSearchResults(this FilmSearchResponse src, ILogger logger)
|
||||
{
|
||||
if (src?.Films is null)
|
||||
return Enumerable.Empty<RemoteSearchResult>();
|
||||
|
||||
return src.Films.Select(s => s.ToRemoteSearchResult());
|
||||
return src.Films
|
||||
.Select(s => s.ToRemoteSearchResult(logger))
|
||||
.Where(s => s != null);
|
||||
}
|
||||
|
||||
public static RemoteSearchResult ToRemoteSearchResult(this FilmSearchResponse_films src)
|
||||
public static RemoteSearchResult ToRemoteSearchResult(this FilmSearchResponse_films src, ILogger logger)
|
||||
{
|
||||
if (src is null)
|
||||
try {
|
||||
if (src is null)
|
||||
return null;
|
||||
|
||||
var res = new RemoteSearchResult() {
|
||||
Name = src.GetLocalName(),
|
||||
ImageUrl = src.PosterUrl,
|
||||
PremiereDate = src.GetPremiereDate(),
|
||||
Overview = src.Description,
|
||||
SearchProviderName = Constants.ProviderName
|
||||
};
|
||||
res.SetProviderId(Constants.ProviderId, Convert.ToString(src.FilmId));
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.LogError(e, "Exception during parse");
|
||||
return null;
|
||||
|
||||
var res = new RemoteSearchResult() {
|
||||
Name = src.GetLocalName(),
|
||||
ImageUrl = src.PosterUrl,
|
||||
PremiereDate = src.GetPremiereDate(),
|
||||
Overview = src.Description,
|
||||
SearchProviderName = Constants.ProviderName
|
||||
};
|
||||
res.SetProviderId(Constants.ProviderId, Convert.ToString(src.FilmId));
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
public static Series ToSeries(this Film src)
|
||||
@@ -365,7 +374,7 @@ namespace Jellyfin.Plugin.Kinopoisk
|
||||
|
||||
public static int? GetFirstYear(string years)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(years))
|
||||
if (string.IsNullOrWhiteSpace(years) || years.ToLower() == "null")
|
||||
return null;
|
||||
|
||||
years = years.Trim();
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
<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>
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Jellyfin.Plugin.Kinopoisk.MetadataProviders
|
||||
}
|
||||
else
|
||||
{
|
||||
return (await _apiClient.SearchByKeyword(searchInfo.Name, cancellationToken: cancellationToken)).ToRemoteSearchResults();
|
||||
return (await _apiClient.SearchByKeyword(searchInfo.Name, cancellationToken: cancellationToken)).ToRemoteSearchResults(_logger);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name: "КиноПоиск"
|
||||
guid: "0c136f8a-ff77-4f2b-ade5-13462cae6216"
|
||||
imageUrl: "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png"
|
||||
version: "10.7.5.3"
|
||||
version: "10.7.5.4"
|
||||
targetAbi: "10.7.0"
|
||||
framework: "net5.0"
|
||||
owner: "linfor"
|
||||
@@ -17,4 +17,4 @@ artifacts:
|
||||
- "Jellyfin.Plugin.Kinopoisk.dll"
|
||||
- "KinopoiskUnofficialInfo.ApiClient.dll"
|
||||
changelog: >
|
||||
Results parsing fixes due to upstream service changes (api 2.2)
|
||||
Search fixed in case of null premiere date
|
||||
Reference in new issue
Block a user