Danmu search add more info

This commit is contained in:
cxfksword
2023-02-15 18:28:11 +08:00
parent 37965b9b4a
commit ec6b8afb78
8 changed files with 19 additions and 42 deletions

View File

@@ -63,47 +63,6 @@ public class DanmuSubtitleProvider : ISubtitleProvider
{
UpdateDanmuMetadata(item, scraper.ProviderId, info.Id);
_libraryManagerEventsHelper.QueueItem(item, EventType.Force);
// if (item is Movie)
// {
// var media = await scraper.GetMedia(item, info.Id);
// if (media != null)
// {
// await ForceSaveProviderId(item, scraper.ProviderId, media.Id);
// }
// }
// if (item is Episode)
// {
// var season = ((Episode)item).Season;
// if (season != null)
// {
// var media = await scraper.GetMedia(season, info.Id);
// if (media != null)
// {
// // 更新季元数据
// await ForceSaveProviderId(season, scraper.ProviderId, media.Id);
// // 更新所有剧集元数据GetEpisodes一定要取所有fields要不然更新会导致重建虚拟season季信息
// var episodes = season.GetEpisodes(null, new DtoOptions(true));
// foreach (var (episode, idx) in episodes.WithIndex())
// {
// // 没对应剧集号的,忽略处理
// var indexNumber = episode.IndexNumber ?? 0;
// if (indexNumber < 1 || indexNumber > media.Episodes.Count)
// {
// continue;
// }
// var epId = media.Episodes[indexNumber - 1].Id;
// await ForceSaveProviderId(episode, scraper.ProviderId, epId);
// }
// }
// }
// }
}
throw new Exception($"弹幕下载已由{Plugin.Instance?.Name}插件接管,请忽略本异常.");
@@ -127,6 +86,11 @@ public class DanmuSubtitleProvider : ISubtitleProvider
return list;
}
if (_libraryManagerEventsHelper.IsIgnoreItem(item))
{
return list;
}
// 剧集使用series名称进行搜索
if (item is Episode)
{
@@ -150,6 +114,10 @@ public class DanmuSubtitleProvider : ISubtitleProvider
{
title += $" ({searchInfo.Year})";
}
if (searchInfo.EpisodeSize > 1)
{
title += $"【共{searchInfo.EpisodeSize}集】";
}
var idInfo = new SubtitleId() { ItemId = item.Id.ToString(), Id = searchInfo.Id.ToString(), ProviderId = scraper.ProviderId };
list.Add(new RemoteSubtitleInfo()
{

View File

@@ -62,6 +62,7 @@ public class Bilibili : AbstractScraper
Name = title,
Category = media.SeasonTypeName,
Year = pubYear,
EpisodeSize = media.EpisodeSize,
});
}
}

View File

@@ -22,6 +22,8 @@ namespace Jellyfin.Plugin.Danmu.Scrapers.Bilibili.Entity
public int SeasonType { get; set; }
[JsonPropertyName("season_type_name")]
public string SeasonTypeName { get; set; }
[JsonPropertyName("ep_size")]
public int EpisodeSize { get; set; }
[JsonPropertyName("season_id")]
public long SeasonId { get; set; }

View File

@@ -63,8 +63,9 @@ public class Dandan : AbstractScraper
{
Id = $"{animeId}",
Name = title,
Category = anime.Type == "movie" ? "电影" : "电视剧",
Category = anime.TypeDescription,
Year = pubYear,
EpisodeSize = anime.EpisodeCount ?? 0,
});
}

View File

@@ -44,6 +44,7 @@ public class DandanApi : AbstractApi
public DandanApi(ILoggerFactory loggerFactory)
: base(loggerFactory.CreateLogger<DandanApi>())
{
httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
}

View File

@@ -8,4 +8,5 @@ public class ScraperSearchInfo
public string Name { get; set; }
public string Category { get; set; } = string.Empty;
public int? Year { get; set; }
public int EpisodeSize { get; set; }
}

View File

@@ -68,6 +68,7 @@ public class Youku : AbstractScraper
Name = title,
Category = video.Type == "movie" ? "电影" : "电视剧",
Year = pubYear,
EpisodeSize = video.Total,
});
}

View File

@@ -31,6 +31,8 @@ jellyfin弹幕自动下载插件已支持的弹幕来源b站弹弹play
2. 进入`控制台 -> 媒体库`,点击任一媒体库进入配置页,在最下面的`字幕下载`选项中勾选**Danmu**,并保存
<img src="doc/tutorial.png" width="400px" />
假如想修正匹配错误的弹幕请在电影或剧集中使用jellyfin的**修改字幕**功能
3. 新加入的影片会自动获取弹幕(只匹配番剧和电影视频),旧影片可以通过计划任务**扫描媒体库匹配弹幕**手动执行获取
4. 可以在元数据中手动指定匹配的视频ID如播放链接`https://www.bilibili.com/bangumi/play/ep682965`对应的视频ID就是`682965`