Optimize identity
This commit is contained in:
parent
a7431c5bd5
commit
a51c145361
|
@ -492,14 +492,18 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
}
|
||||
|
||||
|
||||
|
||||
protected string GetOriginalFileName(ItemLookupInfo info)
|
||||
{
|
||||
// movie放在文件夹中时,应该使用文件夹名
|
||||
switch (info)
|
||||
{
|
||||
case SeriesInfo:
|
||||
case SeasonInfo:
|
||||
case MovieInfo:
|
||||
// 当movie放在文件夹中并只有一部影片时, info.name是根据文件夹名解析的,但info.Path是影片的路径名
|
||||
// 当movie放在文件夹中并有多部影片时,info.Name和info.Path都是具体的影片
|
||||
var directoryName = Path.GetFileName(Path.GetDirectoryName(info.Path));
|
||||
if (directoryName != null && directoryName.Contains(info.Name))
|
||||
{
|
||||
return directoryName;
|
||||
}
|
||||
return Path.GetFileNameWithoutExtension(info.Path) ?? info.Name;
|
||||
default:
|
||||
return Path.GetFileNameWithoutExtension(info.Path) ?? info.Name;
|
||||
|
|
|
@ -90,16 +90,9 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
/// <inheritdoc />
|
||||
public async Task<MetadataResult<Movie>> GetMetadata(MovieInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
this.Log($"GetMovieMetadata of [name]: {info.Name}");
|
||||
this.Log($"GetMovieMetadata of [name]: {info.Name} IsAutomated: {info.IsAutomated}");
|
||||
var result = new MetadataResult<Movie>();
|
||||
|
||||
// 处理extras影片
|
||||
var extraResult = this.HandleExtraType(info);
|
||||
if (extraResult != null)
|
||||
{
|
||||
return extraResult;
|
||||
}
|
||||
|
||||
// 使用刷新元数据时,providerIds会保留旧有值,只有识别/新增才会没值
|
||||
var sid = info.GetProviderId(DoubanProviderId);
|
||||
var tmdbId = info.GetProviderId(MetadataProvider.Tmdb);
|
||||
|
@ -109,6 +102,13 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
var hasDoubanMeta = metaSource != MetaSource.Tmdb && !string.IsNullOrEmpty(sid);
|
||||
if (!hasDoubanMeta && !hasTmdbMeta)
|
||||
{
|
||||
// 处理extras影片
|
||||
var extraResult = this.HandleExtraType(info);
|
||||
if (extraResult != null)
|
||||
{
|
||||
return extraResult;
|
||||
}
|
||||
|
||||
// 自动扫描搜索匹配元数据
|
||||
sid = await this.GuessByDoubanAsync(info, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
/// <inheritdoc />
|
||||
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
this.Log($"GetSeriesMetadata of [name]: {info.Name} [providerIds]: {info.ProviderIds.ToJson()} IsAutomated: {info.IsAutomated}");
|
||||
this.Log($"GetSeriesMetadata of [name]: {info.Name} IsAutomated: {info.IsAutomated}");
|
||||
var result = new MetadataResult<Series>();
|
||||
|
||||
var sid = info.GetProviderId(DoubanProviderId);
|
||||
|
|
Loading…
Reference in New Issue