Compare commits
15
Commits
v10.9.7.0
...
6ab8025c05
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ab8025c05 | ||
|
|
78b0f03e94 | ||
|
|
aa0c6fea60 | ||
|
|
f1b342ab3f | ||
|
|
194b0315fe | ||
|
|
6461003435 | ||
|
|
ed1836703a | ||
|
|
0743f7d2e7 | ||
|
|
048adc1170 | ||
|
|
096e22156c | ||
|
|
217d2efef8 | ||
|
|
c00f8dd712 | ||
|
|
56ee78af00 | ||
|
|
9687d2112e | ||
|
|
a0dead2318 |
No files matched your search
@@ -9,3 +9,11 @@ updates:
|
|||||||
directory: "/src" # Location of package manifests
|
directory: "/src" # Location of package manifests
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: "weekly"
|
||||||
|
ignore:
|
||||||
|
- dependency-name: "Jellyfin.*"
|
||||||
|
update-types:
|
||||||
|
- version-update:semver-major
|
||||||
|
- version-update:semver-minor
|
||||||
|
- dependency-name: "Microsoft.*"
|
||||||
|
update-types:
|
||||||
|
- version-update:semver-major
|
||||||
@@ -11,15 +11,23 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup .NET 8.0
|
- name: Setup .NET 9.0
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v5
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: 9.0.x
|
||||||
|
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: dotnet build --configuration Release ./src
|
run: dotnet build --configuration Release --property:Version=1.0.0.0 ./src
|
||||||
|
|
||||||
- name: Test project
|
- name: Test project
|
||||||
run: dotnet test --configuration Release ./src
|
run: dotnet test --configuration Release ./src
|
||||||
|
|
||||||
|
- name: Publish artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: my-artifact
|
||||||
|
path: |
|
||||||
|
./src/Jellyfin.Plugin.Kinopoisk/bin/Release/net9.0/Jellyfin.Plugin.Kinopoisk.dll
|
||||||
|
./src/KinopoiskUnofficialInfo.ApiClient/bin/Release/net9.0/KinopoiskUnofficialInfo.ApiClient.dll
|
||||||
@@ -6,7 +6,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
DIST_ARCHIVES_PATH: dist/kinopoisk
|
DIST_ARCHIVES_PATH: dist/kinopoisk
|
||||||
MANIFEST_FILE: dist/manifest.json
|
MANIFEST_FILE: dist/manifest.json
|
||||||
TARGET_ABI: 10.9.0
|
TARGET_ABI: 10.10.0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
+17
-1
@@ -1,5 +1,21 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [10.10.3.0]
|
||||||
|
|
||||||
|
Исправлена совместимость с 10.10.*
|
||||||
|
|
||||||
|
## [10.10.2.0]
|
||||||
|
|
||||||
|
Исправлена совместимость с 10.11.(0-4)
|
||||||
|
|
||||||
|
## [10.10.1.0]
|
||||||
|
|
||||||
|
Реализован IExternalUrlProvider (ссылки на кинопоиск)
|
||||||
|
|
||||||
|
## [10.9.8.0]
|
||||||
|
|
||||||
|
Перенесён значимый код из форка уважаемого @VD42
|
||||||
|
|
||||||
## [10.9.7.0]
|
## [10.9.7.0]
|
||||||
|
|
||||||
Fixed pluginId
|
Fixed pluginId
|
||||||
@@ -86,4 +102,4 @@ new release
|
|||||||
|
|
||||||
## [10.6.0.0]
|
## [10.6.0.0]
|
||||||
|
|
||||||
new release
|
new release
|
||||||
Vendored
+46
-6
@@ -8,6 +8,46 @@
|
|||||||
"description": "Загружает рейтинг, описания, актёров, трейлеры и т.д. с сайта КиноПоиск. Может потребоваться зарегистрировать свой ApiToken, см. информацию в параметрах плагина. Для точного распознавания рекомендуется указывать id фильма с сайта КиноПоиск в имени файла в формате kp-12345 или kp12345. Подробнее см. https://github.com/LinFor/jellyfin-plugin-kinopoisk/blob/master/README.md\n",
|
"description": "Загружает рейтинг, описания, актёров, трейлеры и т.д. с сайта КиноПоиск. Может потребоваться зарегистрировать свой ApiToken, см. информацию в параметрах плагина. Для точного распознавания рекомендуется указывать id фильма с сайта КиноПоиск в имени файла в формате kp-12345 или kp12345. Подробнее см. https://github.com/LinFor/jellyfin-plugin-kinopoisk/blob/master/README.md\n",
|
||||||
"imageUrl": "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png",
|
"imageUrl": "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png",
|
||||||
"versions": [
|
"versions": [
|
||||||
|
{
|
||||||
|
"version": "10.10.3.0",
|
||||||
|
"checksum": "de4cf02e03339d61933a6869bf6be6f4",
|
||||||
|
"changelog": "Исправлена совместимость с 10.10.*",
|
||||||
|
"targetAbi": "10.10.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.10.3.0/jellyfin-plugin-kinopoisk_10.10.3.0.zip",
|
||||||
|
"timestamp": "2026-02-18T07:38:15Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.10.2.0",
|
||||||
|
"checksum": "4cd0b8b5fe5db078b74eb472146773ac",
|
||||||
|
"changelog": "Исправлена совместимость с 10.11.(0-4)",
|
||||||
|
"targetAbi": "10.10.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.10.2.0/jellyfin-plugin-kinopoisk_10.10.2.0.zip",
|
||||||
|
"timestamp": "2026-02-04T09:24:27Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.10.1.0",
|
||||||
|
"checksum": "6607f466b207e2e980f142e317ffb989",
|
||||||
|
"changelog": "Реализован IExternalUrlProvider (ссылки на кинопоиск)",
|
||||||
|
"targetAbi": "10.10.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.10.1.0/jellyfin-plugin-kinopoisk_10.10.1.0.zip",
|
||||||
|
"timestamp": "2026-01-15T21:37:12Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.9.8.0",
|
||||||
|
"checksum": "8ce2e57a7411c393a5ac23d31f50265a",
|
||||||
|
"changelog": "Перенесён значимый код из форка уважаемого @VD42",
|
||||||
|
"targetAbi": "10.9.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.9.8.0/jellyfin-plugin-kinopoisk_10.9.8.0.zip",
|
||||||
|
"timestamp": "2026-01-15T17:48:23Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.9.7.0",
|
||||||
|
"checksum": "5d3719a7c8a2d6e4af4fca53f736392e",
|
||||||
|
"changelog": "Fixed pluginId",
|
||||||
|
"targetAbi": "10.9.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.9.7.0/jellyfin-plugin-kinopoisk_10.9.7.0.zip",
|
||||||
|
"timestamp": "2026-01-15T16:59:09Z"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "10.9.6.0",
|
"version": "10.9.6.0",
|
||||||
"checksum": "d7a156386b76865714eb149a41143b35",
|
"checksum": "d7a156386b76865714eb149a41143b35",
|
||||||
@@ -136,7 +176,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.2.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.2.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.7.0.2.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.7.0.2.zip",
|
||||||
"timestamp": "2021-04-06 18:12:00",
|
"timestamp": "2021-04-06T18:12:00",
|
||||||
"version": "10.7.0.2"
|
"version": "10.7.0.2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -147,7 +187,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.1.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.1.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.7.0.1.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.7.0.1.zip",
|
||||||
"timestamp": "2021-03-18 13:31:00",
|
"timestamp": "2021-03-18T13:31:00",
|
||||||
"version": "10.7.0.1"
|
"version": "10.7.0.1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -158,7 +198,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.0.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.0.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.7.0.0.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.7.0.0.zip",
|
||||||
"timestamp": "2021-03-16 11:35:00",
|
"timestamp": "2021-03-16T11:35:00",
|
||||||
"version": "10.7.0.0"
|
"version": "10.7.0.0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -169,7 +209,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.2.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.2.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.6.0.2.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.6.0.2.zip",
|
||||||
"timestamp": "2020-07-09 13:00:00",
|
"timestamp": "2020-07-09T13:00:00",
|
||||||
"version": "10.6.0.2"
|
"version": "10.6.0.2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -180,7 +220,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.1.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.1.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.6.0.1.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.6.0.1.zip",
|
||||||
"timestamp": "2020-07-07 19:00:00",
|
"timestamp": "2020-07-07T19:00:00",
|
||||||
"version": "10.6.0.1"
|
"version": "10.6.0.1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -191,7 +231,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.0.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.0.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.6.0.0.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.6.0.0.zip",
|
||||||
"timestamp": "2020-07-07 10:00:00",
|
"timestamp": "2020-07-07T10:00:00",
|
||||||
"version": "10.6.0.0"
|
"version": "10.6.0.0"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Whitespace-only changes.
@@ -0,0 +1,46 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using KinopoiskUnofficialInfo.ApiClient;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Jellyfin.Plugin.Kinopoisk.Tests
|
||||||
|
{
|
||||||
|
public class ApiModelExtensionsTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void ToPersonInfosShouldSkipPersonsWithoutNames()
|
||||||
|
{
|
||||||
|
var staff = new List<StaffResponse>
|
||||||
|
{
|
||||||
|
CreateStaff(1, "Иван Иванов", string.Empty),
|
||||||
|
CreateStaff(2, string.Empty, string.Empty),
|
||||||
|
CreateStaff(3, " ", " "),
|
||||||
|
CreateStaff(4, string.Empty, "John Smith")
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = staff.ToPersonInfos().ToArray();
|
||||||
|
|
||||||
|
Assert.Equal(2, result.Length);
|
||||||
|
Assert.Equal("Иван Иванов", result[0].Name);
|
||||||
|
Assert.Equal(1, result[0].SortOrder);
|
||||||
|
Assert.Equal("John Smith", result[1].Name);
|
||||||
|
Assert.Equal(2, result[1].SortOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static StaffResponse CreateStaff(
|
||||||
|
int id,
|
||||||
|
string nameRu,
|
||||||
|
string nameEn)
|
||||||
|
{
|
||||||
|
return new StaffResponse
|
||||||
|
{
|
||||||
|
StaffId = id,
|
||||||
|
NameRu = nameRu,
|
||||||
|
NameEn = nameEn,
|
||||||
|
PosterUrl = string.Empty,
|
||||||
|
ProfessionText = "Актёр",
|
||||||
|
ProfessionKey = StaffResponseProfessionKey.ACTOR
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
|
||||||
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Jellyfin.Plugin.Kinopoisk.Tests
|
||||||
|
{
|
||||||
|
public class RemoteImageUrlSanitizerTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task SanitizeRemoteImageUrlDisposesRequestAndResponse()
|
||||||
|
{
|
||||||
|
using var handler = new TrackingHandler();
|
||||||
|
using var httpClient = new HttpClient(handler);
|
||||||
|
|
||||||
|
var sanitizer = new RemoteImageUrlSanitizer(httpClient);
|
||||||
|
|
||||||
|
var result = await sanitizer.SanitizeRemoteImageUrl(
|
||||||
|
"https://example.com/image.jpg");
|
||||||
|
|
||||||
|
Assert.Equal("https://example.com/image.jpg", result);
|
||||||
|
Assert.True(handler.RequestContent.IsDisposed);
|
||||||
|
Assert.True(handler.ResponseContent.IsDisposed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class TrackingHandler : HttpMessageHandler
|
||||||
|
{
|
||||||
|
public TrackingContent RequestContent { get; } = new TrackingContent();
|
||||||
|
|
||||||
|
public TrackingContent ResponseContent { get; } = new TrackingContent();
|
||||||
|
|
||||||
|
protected override Task<HttpResponseMessage> SendAsync(
|
||||||
|
HttpRequestMessage request,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
request.Content = RequestContent;
|
||||||
|
|
||||||
|
return Task.FromResult(
|
||||||
|
new HttpResponseMessage(HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
Content = ResponseContent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class TrackingContent : HttpContent
|
||||||
|
{
|
||||||
|
public bool IsDisposed { get; private set; }
|
||||||
|
|
||||||
|
protected override Task SerializeToStreamAsync(
|
||||||
|
Stream stream,
|
||||||
|
TransportContext context)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool TryComputeLength(out long length)
|
||||||
|
{
|
||||||
|
length = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
IsDisposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -101,6 +101,8 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
dst.Name = src.GetLocalName();
|
dst.Name = src.GetLocalName();
|
||||||
dst.OriginalTitle = src.GetOriginalNameIfNotSame();
|
dst.OriginalTitle = src.GetOriginalNameIfNotSame();
|
||||||
dst.PremiereDate = src.GetPremiereDate();
|
dst.PremiereDate = src.GetPremiereDate();
|
||||||
|
if (1900 < src.Year)
|
||||||
|
dst.ProductionYear = src.Year;
|
||||||
if (!string.IsNullOrWhiteSpace(src.Slogan))
|
if (!string.IsNullOrWhiteSpace(src.Slogan))
|
||||||
dst.Tagline = src.Slogan;
|
dst.Tagline = src.Slogan;
|
||||||
dst.Overview = src.Description;
|
dst.Overview = src.Description;
|
||||||
@@ -255,7 +257,7 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
public static IEnumerable<PersonInfo> ToPersonInfos(this ICollection<StaffResponse> src)
|
public static IEnumerable<PersonInfo> ToPersonInfos(this ICollection<StaffResponse> src)
|
||||||
{
|
{
|
||||||
var res = src.Select(s => s.ToPersonInfo())
|
var res = src.Select(s => s.ToPersonInfo())
|
||||||
.Where(s => s != null)
|
.Where(s => s != null && !string.IsNullOrWhiteSpace(s.Name))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
@@ -270,10 +272,13 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
return src switch
|
return src switch
|
||||||
{
|
{
|
||||||
StaffResponseProfessionKey.ACTOR => PersonKind.Actor,
|
StaffResponseProfessionKey.ACTOR => PersonKind.Actor,
|
||||||
StaffResponseProfessionKey.DIRECTOR => PersonKind.Director,
|
StaffResponseProfessionKey.DIRECTOR
|
||||||
|
or StaffResponseProfessionKey.VOICE_DIRECTOR
|
||||||
|
or StaffResponseProfessionKey.OPERATOR => PersonKind.Director,
|
||||||
StaffResponseProfessionKey.WRITER => PersonKind.Writer,
|
StaffResponseProfessionKey.WRITER => PersonKind.Writer,
|
||||||
StaffResponseProfessionKey.COMPOSER => PersonKind.Composer,
|
StaffResponseProfessionKey.COMPOSER => PersonKind.Composer,
|
||||||
StaffResponseProfessionKey.PRODUCER or StaffResponseProfessionKey.PRODUCER_USSR => PersonKind.Producer,
|
StaffResponseProfessionKey.PRODUCER
|
||||||
|
or StaffResponseProfessionKey.PRODUCER_USSR => PersonKind.Producer,
|
||||||
StaffResponseProfessionKey.EDITOR => PersonKind.Editor,
|
StaffResponseProfessionKey.EDITOR => PersonKind.Editor,
|
||||||
StaffResponseProfessionKey.TRANSLATOR => PersonKind.Translator,
|
StaffResponseProfessionKey.TRANSLATOR => PersonKind.Translator,
|
||||||
_ => PersonKind.Unknown,
|
_ => PersonKind.Unknown,
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Jellyfin.Data" Version="10.*-*" />
|
<PackageReference Include="Jellyfin.Data" Version="10.10.0.*" />
|
||||||
<PackageReference Include="Jellyfin.Controller" Version="10.*-*" />
|
<PackageReference Include="Jellyfin.Controller" Version="10.10.0.*" />
|
||||||
<PackageReference Include="Jellyfin.Common" Version="10.*-*" />
|
<PackageReference Include="Jellyfin.Common" Version="10.10.0.*" />
|
||||||
<PackageReference Include="Jellyfin.Model" Version="10.*-*" />
|
<PackageReference Include="Jellyfin.Model" Version="10.10.0.*" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ namespace Jellyfin.Plugin.Kinopoisk.Model
|
|||||||
|
|
||||||
public string Key => Constants.ProviderId;
|
public string Key => Constants.ProviderId;
|
||||||
|
|
||||||
public string UrlFormatString => "https://www.kinopoisk.ru/film/{0}";
|
public string UrlFormatString => null;
|
||||||
|
|
||||||
public ExternalIdMediaType? Type => null;
|
public ExternalIdMediaType? Type => null;
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
{
|
{
|
||||||
return item is Movie || item is Series;
|
return item is Movie || item is Series || item is Person;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// External URLs for Kinopoisk.
|
||||||
|
/// </summary>
|
||||||
|
public class KinopoiskExternalUrlProvider : IExternalUrlProvider
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public string Name => Constants.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public IEnumerable<string> GetExternalUrls(BaseItem item)
|
||||||
|
{
|
||||||
|
var baseUrl = "https://www.kinopoisk.ru/";
|
||||||
|
if (item.TryGetProviderId(Constants.ProviderId, out var externalId))
|
||||||
|
{
|
||||||
|
if (item is Person)
|
||||||
|
{
|
||||||
|
yield return baseUrl + $"name/{externalId}/";
|
||||||
|
}
|
||||||
|
else if (item is Movie)
|
||||||
|
{
|
||||||
|
yield return baseUrl + $"film/{externalId}/";
|
||||||
|
}
|
||||||
|
else if (item is Series)
|
||||||
|
{
|
||||||
|
yield return baseUrl + $"series/{externalId}/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Providers;
|
|
||||||
|
|
||||||
namespace Jellyfin.Plugin.Kinopoisk.Model
|
|
||||||
{
|
|
||||||
public class KinopoiskPersonExternalId : IExternalId
|
|
||||||
{
|
|
||||||
public string ProviderName => Constants.ProviderName;
|
|
||||||
|
|
||||||
public string Key => Constants.ProviderId;
|
|
||||||
|
|
||||||
public string UrlFormatString => "https://www.kinopoisk.ru/name/{0}";
|
|
||||||
|
|
||||||
public ExternalIdMediaType? Type => null;
|
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
|
||||||
{
|
|
||||||
return item is Person;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -44,13 +44,15 @@ namespace Jellyfin.Plugin.Kinopoisk.ProviderIdResolvers
|
|||||||
var candidates = searchResult.Films.ToArray();
|
var candidates = searchResult.Films.ToArray();
|
||||||
_logger.LogDebug($"Received {candidates.Length} results, trying to filter and match...");
|
_logger.LogDebug($"Received {candidates.Length} results, trying to filter and match...");
|
||||||
|
|
||||||
|
var candidates_by_year = FilterByYear(info, candidates);
|
||||||
|
|
||||||
// Check if there are single candidate filtered by year
|
// Check if there are single candidate filtered by year
|
||||||
possibleResult = await TryResolveBySingleCandidateLeft(info, FilterByYear(info, candidates), ct);
|
possibleResult = await TryResolveBySingleCandidateLeft(info, candidates_by_year, ct);
|
||||||
if (possibleResult.IsSuccess)
|
if (possibleResult.IsSuccess)
|
||||||
return possibleResult;
|
return possibleResult;
|
||||||
|
|
||||||
// Try to resolve by ImdbId match filtered by year
|
// Try to resolve by ImdbId match filtered by year
|
||||||
possibleResult = await TryResolveByImdbMatch(info, FilterByYear(info, candidates), ct);
|
possibleResult = await TryResolveByImdbMatch(info, candidates_by_year, ct);
|
||||||
if (possibleResult.IsSuccess)
|
if (possibleResult.IsSuccess)
|
||||||
return possibleResult;
|
return possibleResult;
|
||||||
|
|
||||||
@@ -59,6 +61,22 @@ namespace Jellyfin.Plugin.Kinopoisk.ProviderIdResolvers
|
|||||||
if (possibleResult.IsSuccess)
|
if (possibleResult.IsSuccess)
|
||||||
return possibleResult;
|
return possibleResult;
|
||||||
|
|
||||||
|
// TODO: Maybe check type?
|
||||||
|
|
||||||
|
if (0 < candidates_by_year.Count)
|
||||||
|
{
|
||||||
|
var kinopoiskId = candidates_by_year.First().FilmId;
|
||||||
|
_logger.LogDebug($"All other checks failed, use first result by year, setting KinopoiskProviderId to {kinopoiskId} ({info.Name})");
|
||||||
|
return (true, kinopoiskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 < candidates.Length)
|
||||||
|
{
|
||||||
|
var kinopoiskId = candidates.First().FilmId;
|
||||||
|
_logger.LogDebug($"All other checks failed, use first result, setting KinopoiskProviderId to {kinopoiskId} ({info.Name})");
|
||||||
|
return (true, kinopoiskId);
|
||||||
|
}
|
||||||
|
|
||||||
_logger.LogDebug($"Suitable result not found");
|
_logger.LogDebug($"Suitable result not found");
|
||||||
return (false, 0);
|
return (false, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
var currentUrl = url;
|
var currentUrl = url;
|
||||||
while (!currentUrl.Contains("no-poster"))
|
while (!currentUrl.Contains("no-poster"))
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
using var request = new HttpRequestMessage(HttpMethod.Get, currentUrl);
|
||||||
new HttpRequestMessage(HttpMethod.Get, currentUrl), HttpCompletionOption.ResponseHeadersRead);
|
using var response = await _httpClient.SendAsync(
|
||||||
|
request,
|
||||||
|
HttpCompletionOption.ResponseHeadersRead);
|
||||||
|
|
||||||
if ((int)response.StatusCode <= 299)
|
if ((int)response.StatusCode <= 299)
|
||||||
return currentUrl;
|
return currentUrl;
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace KinopoiskUnofficialInfo.ApiClient.Tests
|
||||||
|
{
|
||||||
|
public class BadSpouseSexConverterTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void ShouldDeserializeUnknownSpouseSex()
|
||||||
|
{
|
||||||
|
const string json =
|
||||||
|
"{\"personId\":1,\"name\":\"Test\",\"divorced\":false," +
|
||||||
|
"\"divorcedReason\":\"\",\"sex\":\"UNKNOWN\",\"children\":0," +
|
||||||
|
"\"webUrl\":\"\",\"relation\":\"\"}";
|
||||||
|
|
||||||
|
var settings = new JsonSerializerSettings
|
||||||
|
{
|
||||||
|
ContractResolver = new DeclarationPatcherContractResolver()
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = JsonConvert.DeserializeObject<PersonResponse_spouses>(
|
||||||
|
json,
|
||||||
|
settings);
|
||||||
|
|
||||||
|
Assert.NotNull(result);
|
||||||
|
Assert.Equal(
|
||||||
|
(PersonResponse_spousesSex)(-1),
|
||||||
|
result.Sex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
|
namespace KinopoiskUnofficialInfo.ApiClient
|
||||||
|
{
|
||||||
|
public class BadSpouseSexConverter : StringEnumConverter
|
||||||
|
{
|
||||||
|
public override bool CanConvert(System.Type objectType)
|
||||||
|
=> objectType == typeof(PersonResponse_spousesSex);
|
||||||
|
|
||||||
|
public override object ReadJson(
|
||||||
|
JsonReader reader,
|
||||||
|
System.Type objectType,
|
||||||
|
object existingValue,
|
||||||
|
JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return base.ReadJson(reader, objectType, existingValue, serializer);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return (PersonResponse_spousesSex)(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ namespace KinopoiskUnofficialInfo.ApiClient
|
|||||||
new BadIntegerConverter(),
|
new BadIntegerConverter(),
|
||||||
new BadDoubleConverter(),
|
new BadDoubleConverter(),
|
||||||
new BadProfessionKeyConverter(),
|
new BadProfessionKeyConverter(),
|
||||||
|
new BadSpouseSexConverter(),
|
||||||
new BadProductionStatusConverter(),
|
new BadProductionStatusConverter(),
|
||||||
new BadFilmSearchResponse_filmsTypeConverter(),
|
new BadFilmSearchResponse_filmsTypeConverter(),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user