mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-01 02:35:02 -05:00
Fix several Stackoverflows (#14783)
This commit is contained in:
parent
deee04ae38
commit
c02a24e32a
@ -701,19 +701,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var customRating = CustomRating;
|
return GetCustomRatingForComparision();
|
||||||
if (!string.IsNullOrEmpty(customRating))
|
|
||||||
{
|
|
||||||
return customRating;
|
|
||||||
}
|
|
||||||
|
|
||||||
var parent = DisplayParent;
|
|
||||||
if (parent is not null)
|
|
||||||
{
|
|
||||||
return parent.CustomRatingForComparison;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -791,6 +779,26 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// <value>The remote trailers.</value>
|
/// <value>The remote trailers.</value>
|
||||||
public IReadOnlyList<MediaUrl> RemoteTrailers { get; set; }
|
public IReadOnlyList<MediaUrl> RemoteTrailers { get; set; }
|
||||||
|
|
||||||
|
private string GetCustomRatingForComparision(HashSet<Guid> callstack = null)
|
||||||
|
{
|
||||||
|
callstack ??= new();
|
||||||
|
var customRating = CustomRating;
|
||||||
|
if (!string.IsNullOrEmpty(customRating))
|
||||||
|
{
|
||||||
|
return customRating;
|
||||||
|
}
|
||||||
|
|
||||||
|
callstack.Add(Id);
|
||||||
|
|
||||||
|
var parent = DisplayParent;
|
||||||
|
if (parent is not null && !callstack.Contains(parent.Id))
|
||||||
|
{
|
||||||
|
return parent.GetCustomRatingForComparision(callstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual double GetDefaultPrimaryImageAspectRatio()
|
public virtual double GetDefaultPrimaryImageAspectRatio()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -568,7 +568,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (recursive && child is Folder folder)
|
if (recursive && child is Folder folder)
|
||||||
{
|
{
|
||||||
await folder.RefreshMetadataRecursive(folder.Children.ToList(), refreshOptions, true, progress, cancellationToken).ConfigureAwait(false);
|
await folder.RefreshMetadataRecursive(folder.Children.Except([this, child]).ToList(), refreshOptions, true, progress, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,16 +152,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(PrimaryVersionId))
|
return GetMediaSourceCount();
|
||||||
{
|
|
||||||
var item = LibraryManager.GetItemById(PrimaryVersionId);
|
|
||||||
if (item is Video video)
|
|
||||||
{
|
|
||||||
return video.MediaSourceCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return LinkedAlternateVersions.Length + LocalAlternateVersions.Length + 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,6 +250,27 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public override MediaType MediaType => MediaType.Video;
|
public override MediaType MediaType => MediaType.Video;
|
||||||
|
|
||||||
|
private int GetMediaSourceCount(HashSet<Guid> callstack = null)
|
||||||
|
{
|
||||||
|
callstack ??= new();
|
||||||
|
if (!string.IsNullOrEmpty(PrimaryVersionId))
|
||||||
|
{
|
||||||
|
var item = LibraryManager.GetItemById(PrimaryVersionId);
|
||||||
|
if (item is Video video)
|
||||||
|
{
|
||||||
|
if (callstack.Contains(video.Id))
|
||||||
|
{
|
||||||
|
return video.LinkedAlternateVersions.Length + video.LocalAlternateVersions.Length + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
callstack.Add(video.Id);
|
||||||
|
return video.GetMediaSourceCount(callstack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return LinkedAlternateVersions.Length + LocalAlternateVersions.Length + 1;
|
||||||
|
}
|
||||||
|
|
||||||
public override List<string> GetUserDataKeys()
|
public override List<string> GetUserDataKeys()
|
||||||
{
|
{
|
||||||
var list = base.GetUserDataKeys();
|
var list = base.GetUserDataKeys();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user