diff --git a/dist/kinopoisk/kinopoisk_10.7.5.4.zip b/dist/kinopoisk/kinopoisk_10.7.5.4.zip new file mode 100644 index 0000000..b4a9045 Binary files /dev/null and b/dist/kinopoisk/kinopoisk_10.7.5.4.zip differ diff --git a/dist/manifest.json b/dist/manifest.json index a89c3d5..8c8450e 100644 --- a/dist/manifest.json +++ b/dist/manifest.json @@ -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", diff --git a/src/Jellyfin.Plugin.Kinopoisk/ApiModelExtensions.cs b/src/Jellyfin.Plugin.Kinopoisk/ApiModelExtensions.cs index f54d1cc..550b9bc 100644 --- a/src/Jellyfin.Plugin.Kinopoisk/ApiModelExtensions.cs +++ b/src/Jellyfin.Plugin.Kinopoisk/ApiModelExtensions.cs @@ -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 ToRemoteSearchResults(this FilmSearchResponse src) + public static IEnumerable ToRemoteSearchResults(this FilmSearchResponse src, ILogger logger) { if (src?.Films is null) return Enumerable.Empty(); - 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(); diff --git a/src/Jellyfin.Plugin.Kinopoisk/Jellyfin.Plugin.Kinopoisk.csproj b/src/Jellyfin.Plugin.Kinopoisk/Jellyfin.Plugin.Kinopoisk.csproj index 38ff1de..04d7ab4 100644 --- a/src/Jellyfin.Plugin.Kinopoisk/Jellyfin.Plugin.Kinopoisk.csproj +++ b/src/Jellyfin.Plugin.Kinopoisk/Jellyfin.Plugin.Kinopoisk.csproj @@ -20,9 +20,6 @@ compile - - all - compile diff --git a/src/Jellyfin.Plugin.Kinopoisk/MetadataProviders/BaseVideoMetadataProvider.cs b/src/Jellyfin.Plugin.Kinopoisk/MetadataProviders/BaseVideoMetadataProvider.cs index b3ac7b2..7a0c80a 100644 --- a/src/Jellyfin.Plugin.Kinopoisk/MetadataProviders/BaseVideoMetadataProvider.cs +++ b/src/Jellyfin.Plugin.Kinopoisk/MetadataProviders/BaseVideoMetadataProvider.cs @@ -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); } } diff --git a/src/Jellyfin.Plugin.Kinopoisk/build.yaml b/src/Jellyfin.Plugin.Kinopoisk/build.yaml index 59e16d6..be92260 100644 --- a/src/Jellyfin.Plugin.Kinopoisk/build.yaml +++ b/src/Jellyfin.Plugin.Kinopoisk/build.yaml @@ -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