Skip to content
Prompt

jellyfin-plugin-danmu — Copilot Instructions

by cxfksword

AI Summary

一个为 Jellyfin 开发的弹幕自动下载插件,支持从多个视频平台(B站、优酷、爱奇艺、腾讯视频、芒果TV)自动下载和管理中文弹幕。支持 XML 和 ASS 字幕格式。 核心架构是一个可插拔的弹幕源系统,每个视频平台都实现 : 插件使用 Jellyfin 的媒体库事件和防抖队列处理机制:

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to add the "jellyfin-plugin-danmu — Copilot Instructions" prompt rules to my project.
Repository: https://github.com/cxfksword/jellyfin-plugin-danmu

Please read the repo to find the rules/prompt file, then:
1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type)
2. If there's an existing rules file, merge the new rules in rather than overwriting
3. Confirm what was added

Description

jellyfin弹幕自动下载插件

项目概述

一个为 Jellyfin 开发的弹幕自动下载插件,支持从多个视频平台(B站、优酷、爱奇艺、腾讯视频、芒果TV)自动下载和管理中文弹幕。支持 XML 和 ASS 字幕格式。 核心技术栈: C# .NET 9.0, Jellyfin Plugin API, ILRepack(用于依赖合并)

弹幕源系统 (`Jellyfin.Plugin.Danmu/Scrapers/`)

核心架构是一个可插拔的弹幕源系统,每个视频平台都实现 AbstractScraper: `csharp // 每个平台(Bilibili/、Youku/、Iqiyi/ 等)需要实现: public abstract class AbstractScraper { Task<List<ScraperSearchInfo>> Search(BaseItem item); Task<string?> SearchMediaId(BaseItem item); Task<ScraperMedia?> GetMedia(BaseItem item, string id); Task<ScraperEpisode?> GetMediaEpisode(BaseItem item, string id); Task<ScraperDanmaku?> GetDanmuContent(BaseItem item, string commentId); } ` 重要说明: • 弹幕源通过 Plugin.cs 中的 IApplicationHost.GetExports<AbstractScraper>() 自动发现 • 顺序由 DefaultOrder 属性和用户配置控制 • 每个弹幕源有唯一的 ProviderId(如 BilibiliID),用于 Jellyfin 元数据存储 • 参考 Scrapers/Bilibili/Bilibili.cs 的实现示例

事件驱动的弹幕处理

插件使用 Jellyfin 的媒体库事件和防抖队列处理机制: • PluginStartup.cs 订阅 ILibraryManager.ItemAdded/ItemUpdated 事件 • 事件在 LibraryManagerEventsHelper 中排队,使用 10 秒防抖定时器 • 批量处理:匹配媒体 → 搜索弹幕源 → 下载弹幕 • 结果保存为 .xml 文件,与视频文件同目录(如 movie.mp4 → movie.xml) 关键类: • LibraryManagerEventsHelper.QueueItem() - 添加项目到处理队列 • LibraryManagerEventsHelper.ProcessQueuedMovieEvents() - 批量处理电影 • LibraryManagerEventsHelper.ProcessQueuedSeasonEvents() - 处理电视剧季

构建项目

`bash dotnet restore dotnet publish --configuration=Release Jellyfin.Plugin.Danmu/Jellyfin.Plugin.Danmu.csproj ` 输出位置: Jellyfin.Plugin.Danmu/bin/Release/net9.0/Jellyfin.Plugin.Danmu.dll ILRepack 集成: Release 构建会通过 ILRepack.targets 自动将依赖(RateLimiter、ComposableAsync、Google.Protobuf、SharpZipLib)合并到单个 DLL。这对 Jellyfin 插件部署至关重要。

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted Yesterday
Active
Adoption100+ stars on GitHub
631 ★ · Growing
DocsMissing or thin
Undocumented

GitHub Signals

Stars631
Forks31
Issues1
UpdatedYesterday
View on GitHub
GPL-3.0 License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Any AI assistant that accepts custom rules or system prompts

Claude
ChatGPT
Cursor
Windsurf
Copilot
+ more