2021-05-06 15:39:20 -07:00
|
|
|
#nullable disable
|
|
|
|
|
2020-08-22 12:56:24 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 13:01:16 -07:00
|
|
|
using System;
|
2019-02-28 15:22:57 -07:00
|
|
|
using System.Globalization;
|
2019-10-15 08:49:49 -07:00
|
|
|
using System.Text.Json.Serialization;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Entities
|
|
|
|
{
|
|
|
|
public class LinkedChild
|
|
|
|
{
|
2021-05-11 04:55:46 -07:00
|
|
|
public LinkedChild()
|
|
|
|
{
|
|
|
|
Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
|
|
|
|
}
|
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public string Path { get; set; }
|
2020-06-15 14:43:52 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public LinkedChildType Type { get; set; }
|
2020-06-15 14:43:52 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public string LibraryItemId { get; set; }
|
|
|
|
|
2019-10-15 08:49:49 -07:00
|
|
|
[JsonIgnore]
|
2018-12-27 16:27:57 -07:00
|
|
|
public string Id { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
2021-05-11 04:55:46 -07:00
|
|
|
/// Gets or sets the linked item id.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
|
|
|
public Guid? ItemId { get; set; }
|
|
|
|
|
|
|
|
public static LinkedChild Create(BaseItem item)
|
|
|
|
{
|
|
|
|
var child = new LinkedChild
|
|
|
|
{
|
|
|
|
Path = item.Path,
|
|
|
|
Type = LinkedChildType.Manual
|
|
|
|
};
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(child.Path))
|
|
|
|
{
|
2019-02-28 15:22:57 -07:00
|
|
|
child.LibraryItemId = item.Id.ToString("N", CultureInfo.InvariantCulture);
|
2018-12-27 16:27:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return child;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|