Skip to content

Commit

Permalink
Optimize identify
Browse files Browse the repository at this point in the history
  • Loading branch information
cxfksword committed Feb 3, 2023
1 parent 0b521f2 commit 5f80ade
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions Jellyfin.Plugin.MetaShark/Providers/BaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ protected BaseProvider(IHttpClientFactory httpClientFactory, ILogger logger, ILi
item = result.Where(x => x.Year == info.Year && x.Name == searchName).FirstOrDefault();
if (item != null)
{
this.Log($"GuessByDouban of [name]: {searchName} found Sid: {item.Sid} (suggest)");
this.Log($"GuessByDouban found [name]: {item.Name} [Sid]: {item.Sid} (suggest)");
return item.Sid;
}
item = result.Where(x => x.Year == info.Year).FirstOrDefault();
if (item != null)
{
this.Log($"GuessByDouban of [name]: {searchName} found Sid: {item.Sid} (suggest)");
this.Log($"GuessByDouban found [name]: {item.Name} [Sid]: {item.Sid} (suggest)");
return item.Sid;
}
}
Expand All @@ -149,7 +149,7 @@ protected BaseProvider(IHttpClientFactory httpClientFactory, ILogger logger, ILi
item = result.Where(x => x.Category == cat && x.Year == info.Year).FirstOrDefault();
if (item != null)
{
this.Log($"GuessByDouban of [name]: {searchName} found Sid: {item.Sid}");
this.Log($"GuessByDouban found [name]: {item.Name} [Sid]: {item.Sid}");
return item.Sid;
}
}
Expand All @@ -158,7 +158,7 @@ protected BaseProvider(IHttpClientFactory httpClientFactory, ILogger logger, ILi
item = result.Where(x => x.Category == cat).FirstOrDefault();
if (item != null)
{
this.Log($"GuessByDouban of [name]: {searchName} found Sid: {item.Sid}");
this.Log($"GuessByDouban found [name]: {item.Name} [Sid]: {item.Sid}");
return item.Sid;
}

Expand All @@ -181,13 +181,13 @@ protected BaseProvider(IHttpClientFactory httpClientFactory, ILogger logger, ILi
var suggestItem = suggestResult.Where(x => x.Year == year && x.Name == name).FirstOrDefault();
if (suggestItem != null)
{
this.Log($"GuestDoubanSeasonByYear of [name] found Sid: \"{suggestItem.Sid}\" (suggest)");
this.Log($"GuestDoubanSeasonByYear found [name]: {suggestItem.Name} [Sid]: {suggestItem.Sid} (suggest)");
return suggestItem.Sid;
}
suggestItem = suggestResult.Where(x => x.Year == year).FirstOrDefault();
if (suggestItem != null)
{
this.Log($"GuestDoubanSeasonByYear of [name] found Sid: \"{suggestItem.Sid}\" (suggest)");
this.Log($"GuestDoubanSeasonByYear found [name]: {suggestItem.Name} [Sid]: {suggestItem.Sid} (suggest)");
return suggestItem.Sid;
}
}
Expand All @@ -198,10 +198,11 @@ protected BaseProvider(IHttpClientFactory httpClientFactory, ILogger logger, ILi
var item = result.Where(x => x.Category == "电视剧" && x.Year == year).FirstOrDefault();
if (item != null && !string.IsNullOrEmpty(item.Sid))
{
this.Log($"GuestDoubanSeasonByYear of [name] found Sid: \"{item.Sid}\"");
this.Log($"GuestDoubanSeasonByYear found [name]: {item.Name} [Sid]: {item.Sid}");
return item.Sid;
}

this.Log($"GuestDoubanSeasonByYear not found!");
return null;
}

Expand All @@ -225,6 +226,7 @@ protected BaseProvider(IHttpClientFactory httpClientFactory, ILogger logger, ILi
if (movieItem != null)
{
// bt种子都是英文名,但电影是中日韩泰印法地区时,都不适用相似匹配,去掉限制
this.Log($"GuestByTmdb found [name]: {movieItem.Title} [tmdbID]: {movieItem.Id}");
return movieItem.Id.ToString(CultureInfo.InvariantCulture);
}
break;
Expand All @@ -234,6 +236,7 @@ protected BaseProvider(IHttpClientFactory httpClientFactory, ILogger logger, ILi
if (seriesItem != null)
{
// bt种子都是英文名,但电影是中日韩泰印法地区时,都不适用相似匹配,去掉限制
this.Log($"GuestByTmdb found [name]: {seriesItem.Name} [tmdbID]: {seriesItem.Id}");
return seriesItem.Id.ToString(CultureInfo.InvariantCulture);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion Jellyfin.Plugin.MetaShark/Providers/SeasonProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task<MetadataResult<Season>> GetMetadata(SeasonInfo info, Cancellat
{
return result;
}
var seriesName = series.Name;
var seriesName = RemoveSeasonSubfix(series.Name);

// 没有季id,但存在tmdbid,尝试从tmdb获取对应季的年份信息,用于从豆瓣搜索对应季数据
if (string.IsNullOrEmpty(seasonSid))
Expand Down

0 comments on commit 5f80ade

Please sign in to comment.