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
BIN
Binary file not shown.
Vendored
+8
@@ -8,6 +8,14 @@
|
||||
"description": "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0440\u0435\u0439\u0442\u0438\u043d\u0433, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u0430\u043a\u0442\u0451\u0440\u043e\u0432, \u0442\u0440\u0435\u0439\u043b\u0435\u0440\u044b \u0438 \u0442.\u0434. \u0441 \u0441\u0430\u0439\u0442\u0430 \u041a\u0438\u043d\u043e\u041f\u043e\u0438\u0441\u043a. \u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 ApiToken, \u0441\u043c. \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u0430. \u0414\u043b\u044f \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c id \u0444\u0438\u043b\u044c\u043c\u0430 \u0441 \u0441\u0430\u0439\u0442\u0430 \u041a\u0438\u043d\u043e\u041f\u043e\u0438\u0441\u043a \u0432 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 kp-12345 \u0438\u043b\u0438 kp12345. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c. https://github.com/LinFor/jellyfin-plugin-kinopoisk/blob/master/README.md\n",
|
||||
"imageUrl": "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png",
|
||||
"versions": [
|
||||
{
|
||||
"version": "10.7.5.4",
|
||||
"changelog": "Search fixed in case of null premiere date\n",
|
||||
"targetAbi": "10.7.0",
|
||||
"sourceUrl": "https://raw.githubusercontent.com/LinFor/jellyfin-plugin-kinopoisk/master/dist/kinopoisk/kinopoisk_10.7.5.4.zip",
|
||||
"checksum": "2f48bd383e298da975e93a7f84fe3bc1",
|
||||
"timestamp": "2021-10-17T15:57:00Z"
|
||||
},
|
||||
{
|
||||
"version": "10.7.5.3",
|
||||
"changelog": "Results parsing fixes due to upstream service changes (api 2.2)\n",
|
||||
|
||||
@@ -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