mirror of
https://github.com/cxfksword/jellyfin-plugin-danmu.git
synced 2026-02-02 17:59:58 +08:00
Merge pull request #32 from cxfksword/10.9/preview
feat: compatible with Jellyfin 10.9. close #18
This commit is contained in:
6
.github/workflows/beta.yaml
vendored
6
.github/workflows/beta.yaml
vendored
@@ -4,7 +4,7 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
dotnet-version: 6.0.x
|
||||
dotnet-version: 8.0.x
|
||||
python-version: 3.8
|
||||
project: Jellyfin.Plugin.Danmu/Jellyfin.Plugin.Danmu.csproj
|
||||
artifact: danmu
|
||||
@@ -36,9 +36,9 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
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
|
||||
cp ./Jellyfin.Plugin.Danmu/bin/Release/net6.0/Jellyfin.Plugin.Danmu.dll ./artifacts/
|
||||
cp ./Jellyfin.Plugin.Danmu/bin/Release/net8.0/Jellyfin.Plugin.Danmu.dll ./artifacts/
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
||||
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
- uses: actions/setup-dotnet@v3
|
||||
id: dotnet
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
dotnet-version: 8.0.x
|
||||
- name: Change default dotnet version
|
||||
run: |
|
||||
echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json
|
||||
|
||||
6
.github/workflows/publish.yaml
vendored
6
.github/workflows/publish.yaml
vendored
@@ -5,7 +5,7 @@ on:
|
||||
tags: ["*"]
|
||||
|
||||
env:
|
||||
dotnet-version: 6.0.x
|
||||
dotnet-version: 8.0.x
|
||||
python-version: 3.8
|
||||
project: Jellyfin.Plugin.Danmu/Jellyfin.Plugin.Danmu.csproj
|
||||
artifact: danmu
|
||||
@@ -41,9 +41,9 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
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
|
||||
zip -j ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ./Jellyfin.Plugin.Danmu/bin/Release/net6.0/Jellyfin.Plugin.Danmu.dll
|
||||
zip -j ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ./Jellyfin.Plugin.Danmu/bin/Release/net8.0/Jellyfin.Plugin.Danmu.dll
|
||||
- name: Generate manifest
|
||||
run: python3 ./scripts/generate_manifest.py ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ${GITHUB_REF#refs/*/}
|
||||
env:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>Jellyfin.Plugin.Danmu</RootNamespace>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
@@ -17,9 +17,12 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ComposableAsync.Core" Version="1.3.0" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.22.0" />
|
||||
<PackageReference Include="ILRepack.Lib.MSBuild.Minor" Version="2.1.19-alpha.2" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.8.0" />
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.8.0" />
|
||||
<PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.32">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<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="SharpZipLib" Version="1.4.2" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,28 +1,18 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.Http;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Plugin.Danmu.Core;
|
||||
using Jellyfin.Plugin.Danmu.Model;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Jellyfin.Plugin.Danmu.Scrapers;
|
||||
|
||||
@@ -23,11 +23,12 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
||||
/// </summary>
|
||||
/// <param name="applicationPaths">Instance of the <see cref="IApplicationPaths"/> interface.</param>
|
||||
/// <param name="xmlSerializer">Instance of the <see cref="IXmlSerializer"/> interface.</param>
|
||||
public Plugin(IApplicationPaths applicationPaths, IApplicationHost applicationHost, IXmlSerializer xmlSerializer)
|
||||
public Plugin(IApplicationPaths applicationPaths, IApplicationHost applicationHost, IXmlSerializer xmlSerializer, ScraperManager scraperManager)
|
||||
: base(applicationPaths, xmlSerializer)
|
||||
{
|
||||
Instance = this;
|
||||
Scrapers = applicationHost.GetExports<AbstractScraper>(false).Where(o => o != null).OrderBy(x => x.DefaultOrder).ToList().AsReadOnly();
|
||||
scraperManager.Register(Scrapers);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1,26 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Common.Net;
|
||||
using Jellyfin.Plugin.Danmu.Model;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using Jellyfin.Plugin.Danmu.Core.Extensions;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Threading;
|
||||
|
||||
namespace Jellyfin.Plugin.Danmu
|
||||
{
|
||||
public class PluginStartup : IServerEntryPoint, IDisposable
|
||||
public class PluginStartup : IHostedService, IDisposable
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly LibraryManagerEventsHelper _libraryManagerEventsHelper;
|
||||
@@ -47,7 +41,7 @@ namespace Jellyfin.Plugin.Danmu
|
||||
_libraryManagerEventsHelper = libraryManagerEventsHelper;
|
||||
}
|
||||
|
||||
public Task RunAsync()
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_libraryManager.ItemAdded += LibraryManagerItemAdded;
|
||||
_libraryManager.ItemUpdated += LibraryManagerItemUpdated;
|
||||
@@ -127,5 +121,9 @@ namespace Jellyfin.Plugin.Danmu
|
||||
}
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Jellyfin.Plugin.Danmu.Core.Extensions;
|
||||
using MediaBrowser.Common;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Jellyfin.Plugin.Danmu.Scrapers;
|
||||
@@ -15,17 +13,18 @@ public class ScraperManager
|
||||
public ScraperManager(ILoggerFactory logManager)
|
||||
{
|
||||
log = logManager.CreateLogger<ScraperManager>();
|
||||
if (Plugin.Instance?.Scrapers != null)
|
||||
{
|
||||
this._scrapers.AddRange(Plugin.Instance.Scrapers);
|
||||
}
|
||||
}
|
||||
|
||||
public void register(AbstractScraper scraper)
|
||||
public void Register(AbstractScraper scraper)
|
||||
{
|
||||
this._scrapers.Add(scraper);
|
||||
}
|
||||
|
||||
public void Register(IList<AbstractScraper> scrapers)
|
||||
{
|
||||
this._scrapers.AddRange(scrapers);
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<AbstractScraper> All()
|
||||
{
|
||||
// 存在配置时,根据配置调整源顺序,并删除不启用的源
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.IO;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using Jellyfin.Plugin.Danmu.Scrapers;
|
||||
using Jellyfin.Plugin.Danmu.Scrapers.Bilibili;
|
||||
using Jellyfin.Plugin.Danmu.Scrapers.Dandan;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Subtitles;
|
||||
|
||||
namespace Jellyfin.Plugin.Danmu
|
||||
{
|
||||
@@ -21,21 +12,21 @@ namespace Jellyfin.Plugin.Danmu
|
||||
public class ServiceRegistrator : IPluginServiceRegistrator
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void RegisterServices(IServiceCollection serviceCollection)
|
||||
public void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost)
|
||||
{
|
||||
serviceCollection.AddSingleton<ISubtitleProvider, DanmuSubtitleProvider>();
|
||||
serviceCollection.AddSingleton<Jellyfin.Plugin.Danmu.Core.IFileSystem>((ctx) =>
|
||||
{
|
||||
return new Jellyfin.Plugin.Danmu.Core.FileSystem();
|
||||
});
|
||||
serviceCollection.AddSingleton<ScraperManager>((ctx) =>
|
||||
serviceCollection.AddSingleton((ctx) =>
|
||||
{
|
||||
return new ScraperManager(ctx.GetRequiredService<ILoggerFactory>());
|
||||
});
|
||||
serviceCollection.AddSingleton<LibraryManagerEventsHelper>((ctx) =>
|
||||
serviceCollection.AddSingleton((ctx) =>
|
||||
{
|
||||
return new LibraryManagerEventsHelper(ctx.GetRequiredService<ILibraryManager>(), ctx.GetRequiredService<ILoggerFactory>(), ctx.GetRequiredService<Jellyfin.Plugin.Danmu.Core.IFileSystem>(), ctx.GetRequiredService<ScraperManager>());
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# jellyfin-plugin-danmu
|
||||
|
||||
[](https://github.com/cxfksword/jellyfin-plugin-danmu/releases)
|
||||
[](https://github.com/cxfksword/jellyfin-plugin-danmu/releases)
|
||||
[](https://github.com/cxfksword/jellyfin-plugin-danmu/releases)
|
||||
[](https://github.com/cxfksword/jellyfin-plugin-danmu/main/LICENSE)
|
||||
|
||||
jellyfin弹幕自动下载插件,已支持的弹幕来源:b站,弹弹play,优酷,爱奇艺,腾讯视频,芒果TV。
|
||||
@@ -17,8 +17,6 @@ jellyfin弹幕自动下载插件,已支持的弹幕来源:b站,弹弹play
|
||||
|
||||
## 安装插件
|
||||
|
||||
只支持最新的`jellyfin 10.8.x`版本
|
||||
|
||||
添加插件存储库:
|
||||
|
||||
国内加速:https://mirror.ghproxy.com/https://github.com/cxfksword/jellyfin-plugin-danmu/releases/download/manifest/manifest_cn.json
|
||||
@@ -70,7 +68,7 @@ ass格式:
|
||||
|
||||
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.
|
||||
|
||||
@@ -84,7 +82,7 @@ dotnet publish --configuration=Release Jellyfin.Plugin.Danmu/Jellyfin.Plugin.Dan
|
||||
|
||||
1. Build the plugin
|
||||
|
||||
2. Create a folder, like `danmu` and copy `./Jellyfin.Plugin.Danmu/bin/Release/net6.0/Jellyfin.Plugin.Danmu.dll` into it
|
||||
2. Create a folder, like `danmu` and copy `./Jellyfin.Plugin.Danmu/bin/Release/net8.0/Jellyfin.Plugin.Danmu.dll` into it
|
||||
|
||||
3. Move folder `danmu` to jellyfin `data/plugins` folder
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ def generate_version(filepath, version, changelog):
|
||||
return {
|
||||
'version': f"{version}.0",
|
||||
'changelog': changelog,
|
||||
'targetAbi': '10.8.0.0',
|
||||
'targetAbi': '10.9.0.0',
|
||||
'sourceUrl': f'https://github.com/cxfksword/jellyfin-plugin-danmu/releases/download/v{version}/danmu_{version}.0.zip',
|
||||
'checksum': md5sum(filepath),
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
|
||||
|
||||
Reference in New Issue
Block a user