Files
jellyfin-jellyfin-1/MediaBrowser.Controller/Entities/LinkedChild.cs

46 lines
985 B
C#
Raw Normal View History

#nullable disable
#pragma warning disable CS1591
using System;
using System.Globalization;
2018-12-27 18:27:57 -05:00
namespace MediaBrowser.Controller.Entities
{
public class LinkedChild
{
public LinkedChild()
{
}
2018-12-27 18:27:57 -05:00
public string Path { get; set; }
2020-06-16 09:43:52 +12:00
2018-12-27 18:27:57 -05:00
public LinkedChildType Type { get; set; }
2020-06-16 09:43:52 +12:00
2018-12-27 18:27:57 -05:00
public string LibraryItemId { get; set; }
/// <summary>
/// Gets or sets the linked item id.
2018-12-27 18:27:57 -05:00
/// </summary>
public Guid? ItemId { get; set; }
public static LinkedChild Create(BaseItem item)
{
ArgumentNullException.ThrowIfNull(item);
2018-12-27 18:27:57 -05:00
var child = new LinkedChild
{
Path = item.Path,
Type = LinkedChildType.Manual
};
if (string.IsNullOrEmpty(child.Path))
{
child.LibraryItemId = item.Id.ToString("N", CultureInfo.InvariantCulture);
2018-12-27 18:27:57 -05:00
}
return child;
}
}
}