Remove default season number. #13

This commit is contained in:
cxfksword 2023-02-23 20:03:01 +08:00
parent e020a5950c
commit 4e31feecc6
2 changed files with 15 additions and 9 deletions

View File

@ -145,7 +145,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
info.Year = parseResult.Year; info.Year = parseResult.Year;
info.Name = parseResult.ChineseName ?? parseResult.Name; info.Name = parseResult.ChineseName ?? parseResult.Name;
// 没有season级目录或文件命名不规范时ParentIndexNumber会为null // 没有season级目录(即虚拟季)ParentIndexNumber默认是1季文件夹命名不规范时ParentIndexNumber默认是null
if (info.ParentIndexNumber is null) if (info.ParentIndexNumber is null)
{ {
info.ParentIndexNumber = parseResult.ParentIndexNumber; info.ParentIndexNumber = parseResult.ParentIndexNumber;
@ -163,7 +163,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
} }
// 当没有season级目录时默认为1即当成只有一季 // // 当没有season级目录时默认为1即当成只有一季不需要处理虚拟季jellyfin默认传的ParentIndexNumber=1
// if (info.ParentIndexNumber is null && season != null && season.LocationType == LocationType.Virtual) // if (info.ParentIndexNumber is null && season != null && season.LocationType == LocationType.Virtual)
// { // {
// this.Log("FixSeasonNumber: season is virtual, set to default 1"); // this.Log("FixSeasonNumber: season is virtual, set to default 1");
@ -171,7 +171,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
// } // }
} }
// 从series文件夹名称猜出season number 没有季文件夹的在SeasonProvider处理不了因为info.Path会为空只能在这里处理 // 从季文件夹名称猜出season number
var seasonFolderPath = Path.GetDirectoryName(info.Path); var seasonFolderPath = Path.GetDirectoryName(info.Path);
if (info.ParentIndexNumber is null && seasonFolderPath != null) if (info.ParentIndexNumber is null && seasonFolderPath != null)
{ {
@ -185,12 +185,12 @@ namespace Jellyfin.Plugin.MetaShark.Providers
info.ParentIndexNumber = 0; info.ParentIndexNumber = 0;
} }
// 设为默认季数为1 // // 设为默认季数为1问题当同时存在S01和剧场版季文件夹时剧场版的影片会因为默认第一季而在S01也显示出来
if (info.ParentIndexNumber is null) // if (info.ParentIndexNumber is null)
{ // {
this.Log("FixSeasonNumber: season number is null, set to default 1"); // this.Log("FixSeasonNumber: season number is null, set to default 1");
info.ParentIndexNumber = 1; // info.ParentIndexNumber = 1;
} // }
// 特典优先使用文件名特典除了前面特别设置还有SXX/Season XX等默认的 // 特典优先使用文件名特典除了前面特别设置还有SXX/Season XX等默认的

View File

@ -139,6 +139,12 @@ namespace Jellyfin.Plugin.MetaShark.Providers
return null; return null;
} }
// 没有季文件夹即虚拟季info.Path会为空直接用series的sid
if (string.IsNullOrEmpty(info.Path))
{
return sid;
}
// 从sereis获取正确名称info.Name当是标准格式如S01等时会变成第x季非标准名称默认文件名 // 从sereis获取正确名称info.Name当是标准格式如S01等时会变成第x季非标准名称默认文件名
var series = await this._doubanApi.GetMovieAsync(sid, cancellationToken).ConfigureAwait(false); var series = await this._doubanApi.GetMovieAsync(sid, cancellationToken).ConfigureAwait(false);
if (series == null) if (series == null)