ExternalUrlProvider
This commit is contained in:
1 parent
217d2efef8
commit
a8686384cd
6 files changed
+51
-30
No files matched your search
@@ -11,12 +11,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup .NET 8.0
|
||||
uses: actions/setup-dotnet@v3
|
||||
- name: Setup .NET 9.0
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
- name: Build project
|
||||
run: dotnet build --configuration Release ./src
|
||||
|
||||
@@ -6,7 +6,7 @@ on:
|
||||
env:
|
||||
DIST_ARCHIVES_PATH: dist/kinopoisk
|
||||
MANIFEST_FILE: dist/manifest.json
|
||||
TARGET_ABI: 10.9.0
|
||||
TARGET_ABI: 10.10.0
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## [10.10.1.0]
|
||||
|
||||
Реализован IExternalUrlProvider (ссылки на кинопоиск)
|
||||
|
||||
## [10.9.8.0]
|
||||
|
||||
Перенесён значимый код из форка уважаемого @VD42
|
||||
|
||||
@@ -13,13 +13,13 @@ namespace Jellyfin.Plugin.Kinopoisk.Model
|
||||
|
||||
public string Key => Constants.ProviderId;
|
||||
|
||||
public string UrlFormatString => "https://www.kinopoisk.ru/film/{0}";
|
||||
public string UrlFormatString => null;
|
||||
|
||||
public ExternalIdMediaType? Type => null;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user