Simplification
This commit is contained in:
parent
69d2368fbc
commit
457229c56d
|
@ -68,6 +68,11 @@ namespace Emby.Naming.TV
|
||||||
var parsingResult = new EpisodePathParser(_options)
|
var parsingResult = new EpisodePathParser(_options)
|
||||||
.Parse(path, isDirectory, isNamed, isOptimistic, supportsAbsoluteNumbers, fillExtendedInfo);
|
.Parse(path, isDirectory, isNamed, isOptimistic, supportsAbsoluteNumbers, fillExtendedInfo);
|
||||||
|
|
||||||
|
if (!parsingResult.Success)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new EpisodeInfo(path)
|
return new EpisodeInfo(path)
|
||||||
{
|
{
|
||||||
Container = container,
|
Container = container,
|
||||||
|
|
|
@ -2529,25 +2529,16 @@ namespace Emby.Server.Implementations.Library
|
||||||
EpisodeInfo episodeInfo = null;
|
EpisodeInfo episodeInfo = null;
|
||||||
if (episode.IsFileProtocol)
|
if (episode.IsFileProtocol)
|
||||||
{
|
{
|
||||||
episodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming) ?? new EpisodeInfo(episode.Path);
|
episodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming);
|
||||||
// Resolve from parent folder if it's not the Season folder
|
// Resolve from parent folder if it's not the Season folder
|
||||||
if (!episodeInfo.EpisodeNumber.HasValue && episode.Parent.GetType() == typeof(Folder))
|
if (episodeInfo == null && episode.Parent.GetType() == typeof(Folder))
|
||||||
{
|
{
|
||||||
var episodeInfoFromFolder = resolver.Resolve(Path.GetDirectoryName(episode.Path)!, true, null, null, isAbsoluteNaming);
|
episodeInfo = resolver.Resolve(Path.GetDirectoryName(episode.Path)!, true, null, null, isAbsoluteNaming);
|
||||||
// merge the missing information
|
if (episodeInfo != null)
|
||||||
episodeInfo.SeriesName = episodeInfoFromFolder?.SeriesName;
|
{
|
||||||
episodeInfo.EpisodeNumber ??= episodeInfoFromFolder?.EpisodeNumber;
|
// add the container
|
||||||
episodeInfo.EndingEpisodeNumber ??= episodeInfoFromFolder?.EndingEpisodeNumber;
|
episodeInfo.Container = Path.GetExtension(episode.Path)?.TrimStart('.');
|
||||||
episodeInfo.SeasonNumber ??= episodeInfoFromFolder?.SeasonNumber;
|
}
|
||||||
episodeInfo.Container ??= episodeInfoFromFolder?.Container;
|
|
||||||
episodeInfo.Format3D ??= episodeInfoFromFolder?.Format3D;
|
|
||||||
episodeInfo.Is3D = episodeInfoFromFolder?.Is3D ?? episodeInfo.Is3D;
|
|
||||||
episodeInfo.IsStub = episodeInfoFromFolder?.IsStub ?? episodeInfo.IsStub;
|
|
||||||
episodeInfo.StubType = episodeInfoFromFolder?.StubType;
|
|
||||||
episodeInfo.IsByDate = episodeInfoFromFolder?.IsByDate ?? episodeInfo.IsByDate;
|
|
||||||
episodeInfo.Day ??= episodeInfoFromFolder?.Day;
|
|
||||||
episodeInfo.Month ??= episodeInfoFromFolder?.Month;
|
|
||||||
episodeInfo.Year ??= episodeInfoFromFolder?.Year;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user