mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-10 04:06:17 +00:00
Rework season folder parsing (#11748)
This commit is contained in:
@@ -2512,8 +2512,11 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public int? GetSeasonNumberFromPath(string path)
|
||||
=> SeasonPathParser.Parse(path, true, true).SeasonNumber;
|
||||
public int? GetSeasonNumberFromPath(string path, Guid? parentId)
|
||||
{
|
||||
var parentPath = parentId.HasValue ? GetItemById(parentId.Value)?.ContainingFolderPath : null;
|
||||
return SeasonPathParser.Parse(path, parentPath, true, true).SeasonNumber;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool FillMissingEpisodeNumbersFromPath(Episode episode, bool forceRefresh)
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
|
||||
var path = args.Path;
|
||||
|
||||
var seasonParserResult = SeasonPathParser.Parse(path, true, true);
|
||||
var seasonParserResult = SeasonPathParser.Parse(path, series.ContainingFolderPath, true, true);
|
||||
|
||||
var season = new Season
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
{
|
||||
if (child.IsDirectory)
|
||||
{
|
||||
if (IsSeasonFolder(child.FullName, isTvContentType))
|
||||
if (IsSeasonFolder(child.FullName, path, isTvContentType))
|
||||
{
|
||||
_logger.LogDebug("{Path} is a series because of season folder {Dir}.", path, child.FullName);
|
||||
return true;
|
||||
@@ -155,11 +155,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
/// Determines whether [is season folder] [the specified path].
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="parentPath">The parentpath.</param>
|
||||
/// <param name="isTvContentType">if set to <c>true</c> [is tv content type].</param>
|
||||
/// <returns><c>true</c> if [is season folder] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||
private static bool IsSeasonFolder(string path, bool isTvContentType)
|
||||
private static bool IsSeasonFolder(string path, string parentPath, bool isTvContentType)
|
||||
{
|
||||
var seasonNumber = SeasonPathParser.Parse(path, isTvContentType, isTvContentType).SeasonNumber;
|
||||
var seasonNumber = SeasonPathParser.Parse(path, parentPath, isTvContentType, isTvContentType).SeasonNumber;
|
||||
|
||||
return seasonNumber.HasValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user