Compatible with Jellyfin 10.9. #76

This commit is contained in:
cxfksword 2024-05-12 17:15:46 +08:00
parent 408929fc03
commit 1b547f7aaf
12 changed files with 41 additions and 46 deletions

View File

@ -4,7 +4,7 @@ on:
workflow_dispatch: workflow_dispatch:
env: env:
dotnet-version: 6.0.x dotnet-version: 8.0.x
python-version: 3.8 python-version: 3.8
project: Jellyfin.Plugin.MetaShark/Jellyfin.Plugin.MetaShark.csproj project: Jellyfin.Plugin.MetaShark/Jellyfin.Plugin.MetaShark.csproj
artifact: metashark artifact: metashark
@ -36,9 +36,9 @@ jobs:
- name: Build - name: Build
run: | run: |
dotnet restore ${{ env.project }} --no-cache dotnet restore ${{ env.project }} --no-cache
dotnet publish --nologo --no-restore --configuration=Release --framework=net6.0 ${{ env.project }} dotnet publish --nologo --no-restore --configuration=Release --framework=net8.0 ${{ env.project }}
mkdir -p artifacts mkdir -p artifacts
cp ./Jellyfin.Plugin.MetaShark/bin/Release/net6.0/Jellyfin.Plugin.MetaShark.dll ./artifacts/ cp ./Jellyfin.Plugin.MetaShark/bin/Release/net8.0/Jellyfin.Plugin.MetaShark.dll ./artifacts/
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:

View File

@ -14,7 +14,7 @@ jobs:
- uses: actions/setup-dotnet@v3 - uses: actions/setup-dotnet@v3
id: dotnet id: dotnet
with: with:
dotnet-version: 6.0.x dotnet-version: 8.0.x
- name: Change default dotnet version - name: Change default dotnet version
run: | run: |
echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json

View File

@ -5,7 +5,7 @@ on:
tags: ["*"] tags: ["*"]
env: env:
dotnet-version: 6.0.x dotnet-version: 8.0.x
python-version: 3.8 python-version: 3.8
project: Jellyfin.Plugin.MetaShark/Jellyfin.Plugin.MetaShark.csproj project: Jellyfin.Plugin.MetaShark/Jellyfin.Plugin.MetaShark.csproj
artifact: metashark artifact: metashark
@ -41,9 +41,9 @@ jobs:
- name: Build - name: Build
run: | run: |
dotnet restore ${{ env.project }} --no-cache dotnet restore ${{ env.project }} --no-cache
dotnet publish --nologo --no-restore --configuration=Release --framework=net6.0 -p:Version=${{steps.vars.outputs.VERSION}} ${{ env.project }} dotnet publish --nologo --no-restore --configuration=Release --framework=net8.0 -p:Version=${{steps.vars.outputs.VERSION}} ${{ env.project }}
mkdir -p artifacts mkdir -p artifacts
zip -j ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ./Jellyfin.Plugin.MetaShark/bin/Release/net6.0/Jellyfin.Plugin.MetaShark.dll zip -j ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ./Jellyfin.Plugin.MetaShark/bin/Release/net8.0/Jellyfin.Plugin.MetaShark.dll
- name: Generate manifest - name: Generate manifest
run: python3 ./scripts/generate_manifest.py ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ${GITHUB_REF#refs/*/} run: python3 ./scripts/generate_manifest.py ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ${GITHUB_REF#refs/*/}
env: env:

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>AnitomySharp.NET6</PackageId> <PackageId>AnitomySharp.NET6</PackageId>
<PackageVersion>0.4.0</PackageVersion> <PackageVersion>0.4.0</PackageVersion>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<RootNamespace>Jellyfin.Plugin.MetaShark</RootNamespace> <RootNamespace>Jellyfin.Plugin.MetaShark</RootNamespace>
<GenerateDocumentationFile>False</GenerateDocumentationFile> <GenerateDocumentationFile>False</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@ -21,9 +21,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AngleSharp" Version="1.0.1" /> <PackageReference Include="AngleSharp" Version="1.0.1" />
<PackageReference Include="ILRepack.Lib.MSBuild.Minor" Version="2.1.19-alpha.2" /> <PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.32">
<PackageReference Include="Jellyfin.Controller" Version="10.8.0" /> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="Jellyfin.Model" Version="10.8.0" /> <PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Jellyfin.Controller" Version="10.9.0" />
<PackageReference Include="Jellyfin.Model" Version="10.9.0" />
<PackageReference Include="RateLimiter" Version="2.2.0" /> <PackageReference Include="RateLimiter" Version="2.2.0" />
<PackageReference Include="TMDbLib" Version="2.2.0" /> <PackageReference Include="TMDbLib" Version="2.2.0" />
</ItemGroup> </ItemGroup>

View File

@ -125,13 +125,13 @@ namespace Jellyfin.Plugin.MetaShark.Providers
item = result.Where(x => x.Year == info.Year && x.Name == searchName).FirstOrDefault(); item = result.Where(x => x.Year == info.Year && x.Name == searchName).FirstOrDefault();
if (item != null) if (item != null)
{ {
this.Log($"GuessByDouban found -> {item.Name}({item.Sid}) (suggest)"); this.Log($"Found douban [id]: {item.Name}({item.Sid}) (suggest)");
return item.Sid; return item.Sid;
} }
item = result.Where(x => x.Year == info.Year).FirstOrDefault(); item = result.Where(x => x.Year == info.Year).FirstOrDefault();
if (item != null) if (item != null)
{ {
this.Log($"GuessByDouban found -> {item.Name}({item.Sid}) (suggest)"); this.Log($"Found douban [id]: {item.Name}({item.Sid}) (suggest)");
return item.Sid; return item.Sid;
} }
} }
@ -169,7 +169,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
item = result.Where(x => x.Category == cat).FirstOrDefault(); item = result.Where(x => x.Category == cat).FirstOrDefault();
if (item != null) if (item != null)
{ {
this.Log($"GuessByDouban found -> {item.Name}({item.Sid})"); this.Log($"Found douban [id] by first match: {item.Name}({item.Sid})");
return item.Sid; return item.Sid;
} }

View File

@ -7,6 +7,7 @@ using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using AngleSharp.Text; using AngleSharp.Text;
using Jellyfin.Data.Enums;
using Jellyfin.Plugin.MetaShark.Api; using Jellyfin.Plugin.MetaShark.Api;
using Jellyfin.Plugin.MetaShark.Core; using Jellyfin.Plugin.MetaShark.Core;
using Jellyfin.Plugin.MetaShark.Model; using Jellyfin.Plugin.MetaShark.Model;
@ -182,7 +183,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
subject.LimitDirectorCelebrities.Take(Configuration.PluginConfiguration.MAX_CAST_MEMBERS).ToList().ForEach(c => result.AddPerson(new PersonInfo subject.LimitDirectorCelebrities.Take(Configuration.PluginConfiguration.MAX_CAST_MEMBERS).ToList().ForEach(c => result.AddPerson(new PersonInfo
{ {
Name = c.Name, Name = c.Name,
Type = c.RoleType, Type = c.RoleType == PersonType.Director ? PersonKind.Director : PersonKind.Actor,
Role = c.Role, Role = c.Role,
ImageUrl = this.GetLocalProxyImageUrl(c.Img), ImageUrl = this.GetLocalProxyImageUrl(c.Img),
ProviderIds = new Dictionary<string, string> { { DoubanProviderId, c.Id } }, ProviderIds = new Dictionary<string, string> { { DoubanProviderId, c.Id } },
@ -301,7 +302,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
{ {
Name = actor.Name.Trim(), Name = actor.Name.Trim(),
Role = actor.Character, Role = actor.Character,
Type = PersonType.Actor, Type = PersonKind.Actor,
SortOrder = actor.Order, SortOrder = actor.Order,
}; };
@ -344,7 +345,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
{ {
Name = person.Name.Trim(), Name = person.Name.Trim(),
Role = person.Job, Role = person.Job,
Type = type Type = type == PersonType.Director ? PersonKind.Director : (type == PersonType.Producer ? PersonKind.Producer : PersonKind.Actor),
}; };
if (!string.IsNullOrWhiteSpace(person.ProfilePath)) if (!string.IsNullOrWhiteSpace(person.ProfilePath))

View File

@ -14,6 +14,7 @@ using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Jellyfin.Data.Enums;
namespace Jellyfin.Plugin.MetaShark.Providers namespace Jellyfin.Plugin.MetaShark.Providers
{ {
@ -89,7 +90,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
subject.LimitDirectorCelebrities.Take(Configuration.PluginConfiguration.MAX_CAST_MEMBERS).ToList().ForEach(c => result.AddPerson(new PersonInfo subject.LimitDirectorCelebrities.Take(Configuration.PluginConfiguration.MAX_CAST_MEMBERS).ToList().ForEach(c => result.AddPerson(new PersonInfo
{ {
Name = c.Name, Name = c.Name,
Type = c.RoleType, Type = c.RoleType == PersonType.Director ? PersonKind.Director : PersonKind.Actor,
Role = c.Role, Role = c.Role,
ImageUrl = this.GetLocalProxyImageUrl(c.Img), ImageUrl = this.GetLocalProxyImageUrl(c.Img),
ProviderIds = new Dictionary<string, string> { { DoubanProviderId, c.Id } }, ProviderIds = new Dictionary<string, string> { { DoubanProviderId, c.Id } },

View File

@ -1,4 +1,5 @@
using Jellyfin.Plugin.MetaShark.Api; using Jellyfin.Data.Enums;
using Jellyfin.Plugin.MetaShark.Api;
using Jellyfin.Plugin.MetaShark.Model; using Jellyfin.Plugin.MetaShark.Model;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
@ -152,7 +153,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
subject.LimitDirectorCelebrities.Take(Configuration.PluginConfiguration.MAX_CAST_MEMBERS).ToList().ForEach(c => result.AddPerson(new PersonInfo subject.LimitDirectorCelebrities.Take(Configuration.PluginConfiguration.MAX_CAST_MEMBERS).ToList().ForEach(c => result.AddPerson(new PersonInfo
{ {
Name = c.Name, Name = c.Name,
Type = c.RoleType, Type = c.RoleType == PersonType.Director ? PersonKind.Director : PersonKind.Actor,
Role = c.Role, Role = c.Role,
ImageUrl = this.GetLocalProxyImageUrl(c.Img), ImageUrl = this.GetLocalProxyImageUrl(c.Img),
ProviderIds = new Dictionary<string, string> { { DoubanProviderId, c.Id } }, ProviderIds = new Dictionary<string, string> { { DoubanProviderId, c.Id } },
@ -356,7 +357,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
{ {
Name = actor.Name.Trim(), Name = actor.Name.Trim(),
Role = actor.Character, Role = actor.Character,
Type = PersonType.Actor, Type = PersonKind.Actor,
SortOrder = actor.Order, SortOrder = actor.Order,
}; };
@ -400,7 +401,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
{ {
Name = person.Name.Trim(), Name = person.Name.Trim(),
Role = person.Job, Role = person.Job,
Type = type Type = type == PersonType.Director ? PersonKind.Director : (type == PersonType.Producer ? PersonKind.Producer : PersonKind.Actor),
}; };
if (!string.IsNullOrWhiteSpace(person.ProfilePath)) if (!string.IsNullOrWhiteSpace(person.ProfilePath))

View File

@ -1,18 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Jellyfin.Plugin.MetaShark.Api; using Jellyfin.Plugin.MetaShark.Api;
using Jellyfin.Plugin.MetaShark.Providers; using MediaBrowser.Controller;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Plugins;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MediaBrowser.Controller.Persistence;
using System.Net.Http;
namespace Jellyfin.Plugin.MetaShark namespace Jellyfin.Plugin.MetaShark
{ {
@ -20,21 +10,22 @@ namespace Jellyfin.Plugin.MetaShark
public class ServiceRegistrator : IPluginServiceRegistrator public class ServiceRegistrator : IPluginServiceRegistrator
{ {
/// <inheritdoc /> /// <inheritdoc />
public void RegisterServices(IServiceCollection serviceCollection) public void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost)
{ {
serviceCollection.AddSingleton<DoubanApi>((ctx) =>
serviceCollection.AddSingleton((ctx) =>
{ {
return new DoubanApi(ctx.GetRequiredService<ILoggerFactory>()); return new DoubanApi(ctx.GetRequiredService<ILoggerFactory>());
}); });
serviceCollection.AddSingleton<TmdbApi>((ctx) => serviceCollection.AddSingleton((ctx) =>
{ {
return new TmdbApi(ctx.GetRequiredService<ILoggerFactory>()); return new TmdbApi(ctx.GetRequiredService<ILoggerFactory>());
}); });
serviceCollection.AddSingleton<OmdbApi>((ctx) => serviceCollection.AddSingleton((ctx) =>
{ {
return new OmdbApi(ctx.GetRequiredService<ILoggerFactory>()); return new OmdbApi(ctx.GetRequiredService<ILoggerFactory>());
}); });
serviceCollection.AddSingleton<ImdbApi>((ctx) => serviceCollection.AddSingleton((ctx) =>
{ {
return new ImdbApi(ctx.GetRequiredService<ILoggerFactory>()); return new ImdbApi(ctx.GetRequiredService<ILoggerFactory>());
}); });

View File

@ -1,7 +1,7 @@
# jellyfin-plugin-metashark # jellyfin-plugin-metashark
[![release](https://img.shields.io/github/v/release/cxfksword/jellyfin-plugin-metashark)](https://github.com/cxfksword/jellyfin-plugin-metashark/releases) [![release](https://img.shields.io/github/v/release/cxfksword/jellyfin-plugin-metashark)](https://github.com/cxfksword/jellyfin-plugin-metashark/releases)
[![platform](https://img.shields.io/badge/jellyfin-10.8.x-lightgrey?logo=jellyfin)](https://github.com/cxfksword/jellyfin-plugin-metashark/releases) [![platform](https://img.shields.io/badge/jellyfin-10.8.x|10.9.x-lightgrey?logo=jellyfin)](https://github.com/cxfksword/jellyfin-plugin-metashark/releases)
[![license](https://img.shields.io/github/license/cxfksword/jellyfin-plugin-metashark)](https://github.com/cxfksword/jellyfin-plugin-metashark/main/LICENSE) [![license](https://img.shields.io/github/license/cxfksword/jellyfin-plugin-metashark)](https://github.com/cxfksword/jellyfin-plugin-metashark/main/LICENSE)
jellyfin电影元数据插件影片信息只要从豆瓣获取并由TheMovieDb补全缺失的剧集数据。 jellyfin电影元数据插件影片信息只要从豆瓣获取并由TheMovieDb补全缺失的剧集数据。
@ -14,8 +14,6 @@ jellyfin电影元数据插件影片信息只要从豆瓣获取并由TheMov
## 安装插件 ## 安装插件
只支持最新的`jellyfin 10.8.x`版本
添加插件存储库: 添加插件存储库:
国内加速https://mirror.ghproxy.com/https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest_cn.json 国内加速https://mirror.ghproxy.com/https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest_cn.json
@ -42,7 +40,7 @@ jellyfin电影元数据插件影片信息只要从豆瓣获取并由TheMov
1. Clone or download this repository 1. Clone or download this repository
2. Ensure you have .NET Core SDK 6.0 setup and installed 2. Ensure you have .NET Core SDK 8.0 setup and installed
3. Build plugin with following command. 3. Build plugin with following command.
@ -56,7 +54,7 @@ dotnet publish --configuration=Release Jellyfin.Plugin.MetaShark/Jellyfin.Plugin
1. Build the plugin 1. Build the plugin
2. Create a folder, like `metashark` and copy `./Jellyfin.Plugin.MetaShark/bin/Release/net6.0/Jellyfin.Plugin.MetaShark.dll` into it 2. Create a folder, like `metashark` and copy `./Jellyfin.Plugin.MetaShark/bin/Release/net8.0/Jellyfin.Plugin.MetaShark.dll` into it
3. Move folder `metashark` to jellyfin `data/plugins` folder 3. Move folder `metashark` to jellyfin `data/plugins` folder