Optimize identity
This commit is contained in:
parent
5f80adeebc
commit
7656bb6094
|
@ -62,7 +62,7 @@ namespace Jellyfin.Plugin.MetaShark.Api
|
|||
Regex regCountry = new Regex(@"制片国家/地区: (.+?)\n", RegexOptions.Compiled);
|
||||
Regex regLanguage = new Regex(@"语言: (.+?)\n", RegexOptions.Compiled);
|
||||
Regex regDuration = new Regex(@"片长: (.+?)\n", RegexOptions.Compiled);
|
||||
Regex regScreen = new Regex(@"上映日期: (.+?)\n", RegexOptions.Compiled);
|
||||
Regex regScreen = new Regex(@"(上映日期|首播): (.+?)\n", RegexOptions.Compiled);
|
||||
Regex regSubname = new Regex(@"又名: (.+?)\n", RegexOptions.Compiled);
|
||||
Regex regImdb = new Regex(@"IMDb: (tt\d+)", RegexOptions.Compiled);
|
||||
Regex regSite = new Regex(@"官方网站: (.+?)\n", RegexOptions.Compiled);
|
||||
|
@ -344,10 +344,11 @@ namespace Jellyfin.Plugin.MetaShark.Api
|
|||
var country = info.GetMatchGroup(this.regCountry);
|
||||
var language = info.GetMatchGroup(this.regLanguage);
|
||||
var duration = info.GetMatchGroup(this.regDuration);
|
||||
var screen = info.GetMatchGroup(this.regScreen);
|
||||
var subname = info.GetMatchGroup(this.regSubname);
|
||||
var imdb = info.GetMatchGroup(this.regImdb);
|
||||
var site = info.GetMatchGroup(this.regSite);
|
||||
var matchs = this.regScreen.Match(info);
|
||||
var screen = matchs.Groups.Count > 2 ? matchs.Groups[2].Value : string.Empty;
|
||||
|
||||
movie.Sid = sid;
|
||||
movie.Name = name;
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
protected readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
protected Regex regMetaSourcePrefix = new Regex(@"^\[.+\]", RegexOptions.Compiled);
|
||||
protected Regex regSeasonNameSuffix = new Regex(@"\s第.季$", RegexOptions.Compiled);
|
||||
protected Regex regSeasonNameSuffix = new Regex(@"\s第[0-9一二三四五六七八九十]+?季$", RegexOptions.Compiled);
|
||||
|
||||
protected PluginConfiguration config
|
||||
{
|
||||
|
@ -127,13 +127,13 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
item = result.Where(x => x.Year == info.Year && x.Name == searchName).FirstOrDefault();
|
||||
if (item != null)
|
||||
{
|
||||
this.Log($"GuessByDouban found [name]: {item.Name} [Sid]: {item.Sid} (suggest)");
|
||||
this.Log($"GuessByDouban found -> {item.Name}({item.Sid}) (suggest)");
|
||||
return item.Sid;
|
||||
}
|
||||
item = result.Where(x => x.Year == info.Year).FirstOrDefault();
|
||||
if (item != null)
|
||||
{
|
||||
this.Log($"GuessByDouban found [name]: {item.Name} [Sid]: {item.Sid} (suggest)");
|
||||
this.Log($"GuessByDouban found -> {item.Name}({item.Sid}) (suggest)");
|
||||
return item.Sid;
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
item = result.Where(x => x.Category == cat && x.Year == info.Year).FirstOrDefault();
|
||||
if (item != null)
|
||||
{
|
||||
this.Log($"GuessByDouban found [name]: {item.Name} [Sid]: {item.Sid}");
|
||||
this.Log($"GuessByDouban found -> {item.Name}({item.Sid})");
|
||||
return item.Sid;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
item = result.Where(x => x.Category == cat).FirstOrDefault();
|
||||
if (item != null)
|
||||
{
|
||||
this.Log($"GuessByDouban found [name]: {item.Name} [Sid]: {item.Sid}");
|
||||
this.Log($"GuessByDouban found -> {item.Name}({item.Sid})");
|
||||
return item.Sid;
|
||||
}
|
||||
|
||||
|
@ -181,13 +181,13 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
var suggestItem = suggestResult.Where(x => x.Year == year && x.Name == name).FirstOrDefault();
|
||||
if (suggestItem != null)
|
||||
{
|
||||
this.Log($"GuestDoubanSeasonByYear found [name]: {suggestItem.Name} [Sid]: {suggestItem.Sid} (suggest)");
|
||||
this.Log($"GuestDoubanSeasonByYear found -> {suggestItem.Name}({suggestItem.Sid}) (suggest)");
|
||||
return suggestItem.Sid;
|
||||
}
|
||||
suggestItem = suggestResult.Where(x => x.Year == year).FirstOrDefault();
|
||||
if (suggestItem != null)
|
||||
{
|
||||
this.Log($"GuestDoubanSeasonByYear found [name]: {suggestItem.Name} [Sid]: {suggestItem.Sid} (suggest)");
|
||||
this.Log($"GuestDoubanSeasonByYear found -> {suggestItem.Name}({suggestItem.Sid}) (suggest)");
|
||||
return suggestItem.Sid;
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
var item = result.Where(x => x.Category == "电视剧" && x.Year == year).FirstOrDefault();
|
||||
if (item != null && !string.IsNullOrEmpty(item.Sid))
|
||||
{
|
||||
this.Log($"GuestDoubanSeasonByYear found [name]: {item.Name} [Sid]: {item.Sid}");
|
||||
this.Log($"GuestDoubanSeasonByYear found -> {item.Name}({item.Sid})");
|
||||
return item.Sid;
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
if (movieItem != null)
|
||||
{
|
||||
// bt种子都是英文名,但电影是中日韩泰印法地区时,都不适用相似匹配,去掉限制
|
||||
this.Log($"GuestByTmdb found [name]: {movieItem.Title} [tmdbID]: {movieItem.Id}");
|
||||
this.Log($"GuestByTmdb found -> {movieItem.Title}({movieItem.Id})");
|
||||
return movieItem.Id.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
break;
|
||||
|
@ -236,7 +236,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
if (seriesItem != null)
|
||||
{
|
||||
// bt种子都是英文名,但电影是中日韩泰印法地区时,都不适用相似匹配,去掉限制
|
||||
this.Log($"GuestByTmdb found [name]: {seriesItem.Name} [tmdbID]: {seriesItem.Id}");
|
||||
this.Log($"GuestByTmdb found -> {seriesItem.Name}({seriesItem.Id})");
|
||||
return seriesItem.Id.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
{
|
||||
SearchProviderName = TmdbProviderName,
|
||||
ProviderIds = new Dictionary<string, string> { { MetadataProvider.Tmdb.ToString(), x.Id.ToString(CultureInfo.InvariantCulture) } },
|
||||
Name = x.Title ?? x.OriginalTitle,
|
||||
Name = string.Format("[TMDB]{0}", x.Title ?? x.OriginalTitle),
|
||||
ImageUrl = this._tmdbApi.GetPosterUrl(x.PosterPath),
|
||||
Overview = x.Overview,
|
||||
ProductionYear = x.ReleaseDate?.Year,
|
||||
|
|
|
@ -57,13 +57,13 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
|
||||
if (metaSource != MetaSource.Tmdb && !string.IsNullOrEmpty(sid))
|
||||
{
|
||||
// 从sereis获取正确名称,季名称有时不对
|
||||
// 从sereis获取正确名称,info的季名称是第x季
|
||||
var series = await this._doubanApi.GetMovieAsync(sid, cancellationToken).ConfigureAwait(false);
|
||||
if (series == null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
var seriesName = RemoveSeasonSubfix(series.Name);
|
||||
var seasonName = RemoveSeasonSubfix(series.Name);
|
||||
|
||||
// 没有季id,但存在tmdbid,尝试从tmdb获取对应季的年份信息,用于从豆瓣搜索对应季数据
|
||||
if (string.IsNullOrEmpty(seasonSid))
|
||||
|
@ -77,9 +77,9 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
seasonYear = season?.AirDate?.Year ?? 0;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(seriesName) && seasonYear > 0)
|
||||
if (!string.IsNullOrEmpty(seasonName) && seasonYear > 0)
|
||||
{
|
||||
seasonSid = await this.GuestDoubanSeasonByYearAsync(seriesName, seasonYear, cancellationToken).ConfigureAwait(false);
|
||||
seasonSid = await this.GuestDoubanSeasonByYearAsync(seasonName, seasonYear, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
Overview = subject.Intro,
|
||||
ProductionYear = subject.Year,
|
||||
Genres = subject.Genres,
|
||||
PremiereDate = subject.ScreenTime,
|
||||
PremiereDate = subject.ScreenTime, // 发行日期
|
||||
IndexNumber = info.IndexNumber,
|
||||
};
|
||||
|
||||
|
@ -132,21 +132,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
}
|
||||
|
||||
|
||||
// 从豆瓣获取不到季信息,直接使用series信息(还是不替换旧有信息好??)
|
||||
result.Item = new Season
|
||||
{
|
||||
ProviderIds = new Dictionary<string, string> { { DoubanProviderId, sid } },
|
||||
Name = series.Name,
|
||||
OriginalTitle = series.OriginalName,
|
||||
CommunityRating = series.Rating,
|
||||
Overview = series.Intro,
|
||||
ProductionYear = series.Year,
|
||||
Genres = series.Genres,
|
||||
PremiereDate = series.ScreenTime,
|
||||
};
|
||||
|
||||
result.QueriedById = true;
|
||||
result.HasMetadata = true;
|
||||
// 从豆瓣获取不到季信息
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -162,47 +148,6 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// 季手工修正(先手工修改元数据,再刷新元数据->覆盖所有元数据),通过季名称重新搜索
|
||||
// var guessName = Regex.Replace(info.Name, Pattern, " ");
|
||||
// this.Log($"Try search season by name. original name: {info.Name} guess name: {guessName}");
|
||||
// var guessSid = await this.GuestByDoubanAsync(info, cancellationToken).ConfigureAwait(false);
|
||||
// if (!string.IsNullOrEmpty(guessSid))
|
||||
// {
|
||||
|
||||
// var subject = await this._doubanApi.GetMovieAsync(guessSid, cancellationToken).ConfigureAwait(false);
|
||||
// if (subject != null)
|
||||
// {
|
||||
// subject.Celebrities = await this._doubanApi.GetCelebritiesBySidAsync(guessSid, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// var movie = new Season
|
||||
// {
|
||||
// ProviderIds = new Dictionary<string, string> { { DoubanProviderId, subject.Sid } },
|
||||
// Name = subject.Name,
|
||||
// OriginalTitle = subject.OriginalName,
|
||||
// CommunityRating = subject.Rating,
|
||||
// Overview = subject.Intro,
|
||||
// ProductionYear = subject.Year,
|
||||
// Genres = subject.Genres,
|
||||
// PremiereDate = subject.ScreenTime,
|
||||
// IndexNumber = info.IndexNumber,
|
||||
// };
|
||||
|
||||
// result.Item = movie;
|
||||
// result.HasMetadata = true;
|
||||
// subject.Celebrities.Take(this.config.MaxCastMembers).ToList().ForEach(c => result.AddPerson(new PersonInfo
|
||||
// {
|
||||
// Name = c.Name,
|
||||
// Type = c.RoleType,
|
||||
// Role = c.Role,
|
||||
// ImageUrl = c.Img,
|
||||
// ProviderIds = new Dictionary<string, string> { { DoubanProviderId, c.Id } },
|
||||
// }));
|
||||
|
||||
// return result;
|
||||
// }
|
||||
// }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -222,6 +167,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
result.HasMetadata = true;
|
||||
result.Item = new Season
|
||||
{
|
||||
Name = seasonResult.Name,
|
||||
IndexNumber = seasonNumber,
|
||||
Overview = seasonResult.Overview,
|
||||
PremiereDate = seasonResult.AirDate,
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
{
|
||||
SearchProviderName = TmdbProviderName,
|
||||
ProviderIds = new Dictionary<string, string> { { MetadataProvider.Tmdb.ToString(), x.Id.ToString(CultureInfo.InvariantCulture) } },
|
||||
Name = x.Name ?? x.OriginalName,
|
||||
Name = string.Format("[TMDB]{0}", x.Name ?? x.OriginalName),
|
||||
ImageUrl = this._tmdbApi.GetPosterUrl(x.PosterPath),
|
||||
Overview = x.Overview,
|
||||
ProductionYear = x.FirstAirDate?.Year,
|
||||
|
|
Loading…
Reference in New Issue