2020-08-22 21:29:54 +00:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-06-01 20:40:01 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
|
|
namespace Jellyfin.Data.Entities
|
|
|
|
{
|
2020-05-02 21:56:05 +00:00
|
|
|
public partial class MediaFile
|
|
|
|
{
|
|
|
|
partial void Init();
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
|
|
|
/// </summary>
|
|
|
|
protected MediaFile()
|
|
|
|
{
|
|
|
|
MediaFileStreams = new HashSet<MediaFileStream>();
|
|
|
|
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
|
|
|
/// </summary>
|
|
|
|
public static MediaFile CreateMediaFileUnsafe()
|
|
|
|
{
|
|
|
|
return new MediaFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Public constructor with required data.
|
2020-05-02 21:56:05 +00:00
|
|
|
/// </summary>
|
2020-06-19 10:21:49 +00:00
|
|
|
/// <param name="path">Relative to the LibraryRoot.</param>
|
2020-05-02 21:56:05 +00:00
|
|
|
/// <param name="kind"></param>
|
|
|
|
/// <param name="_release0"></param>
|
|
|
|
public MediaFile(string path, Enums.MediaFileKind kind, Release _release0)
|
|
|
|
{
|
2020-06-20 08:35:29 +00:00
|
|
|
if (string.IsNullOrEmpty(path))
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException(nameof(path));
|
|
|
|
}
|
|
|
|
|
2020-05-02 21:56:05 +00:00
|
|
|
this.Path = path;
|
|
|
|
|
|
|
|
this.Kind = kind;
|
|
|
|
|
2020-06-20 08:35:29 +00:00
|
|
|
if (_release0 == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException(nameof(_release0));
|
|
|
|
}
|
|
|
|
|
2020-05-02 21:56:05 +00:00
|
|
|
_release0.MediaFiles.Add(this);
|
|
|
|
|
|
|
|
this.MediaFileStreams = new HashSet<MediaFileStream>();
|
|
|
|
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Static create function (for use in LINQ queries, etc.)
|
|
|
|
/// </summary>
|
2020-06-19 10:21:49 +00:00
|
|
|
/// <param name="path">Relative to the LibraryRoot.</param>
|
2020-05-02 21:56:05 +00:00
|
|
|
/// <param name="kind"></param>
|
|
|
|
/// <param name="_release0"></param>
|
|
|
|
public static MediaFile Create(string path, Enums.MediaFileKind kind, Release _release0)
|
|
|
|
{
|
|
|
|
return new MediaFile(path, kind, _release0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* Properties
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Backing field for Id.
|
2020-05-02 21:56:05 +00:00
|
|
|
/// </summary>
|
|
|
|
internal int _Id;
|
|
|
|
/// <summary>
|
|
|
|
/// When provided in a partial class, allows value of Id to be changed before setting.
|
|
|
|
/// </summary>
|
|
|
|
partial void SetId(int oldValue, ref int newValue);
|
|
|
|
/// <summary>
|
|
|
|
/// When provided in a partial class, allows value of Id to be changed before returning.
|
|
|
|
/// </summary>
|
|
|
|
partial void GetId(ref int result);
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Identity, Indexed, Required.
|
2020-05-02 21:56:05 +00:00
|
|
|
/// </summary>
|
|
|
|
[Key]
|
|
|
|
[Required]
|
|
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
public int Id
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
int value = _Id;
|
|
|
|
GetId(ref value);
|
2020-06-19 09:57:37 +00:00
|
|
|
return _Id = value;
|
2020-05-02 21:56:05 +00:00
|
|
|
}
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2020-05-02 21:56:05 +00:00
|
|
|
protected set
|
|
|
|
{
|
|
|
|
int oldValue = _Id;
|
|
|
|
SetId(oldValue, ref value);
|
|
|
|
if (oldValue != value)
|
|
|
|
{
|
|
|
|
_Id = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Backing field for Path.
|
2020-05-02 21:56:05 +00:00
|
|
|
/// </summary>
|
|
|
|
protected string _Path;
|
|
|
|
/// <summary>
|
|
|
|
/// When provided in a partial class, allows value of Path to be changed before setting.
|
|
|
|
/// </summary>
|
|
|
|
partial void SetPath(string oldValue, ref string newValue);
|
|
|
|
/// <summary>
|
|
|
|
/// When provided in a partial class, allows value of Path to be changed before returning.
|
|
|
|
/// </summary>
|
|
|
|
partial void GetPath(ref string result);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Required, Max length = 65535
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Relative to the LibraryRoot.
|
2020-05-02 21:56:05 +00:00
|
|
|
/// </summary>
|
|
|
|
[Required]
|
|
|
|
[MaxLength(65535)]
|
|
|
|
[StringLength(65535)]
|
|
|
|
public string Path
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
string value = _Path;
|
|
|
|
GetPath(ref value);
|
2020-06-19 09:57:37 +00:00
|
|
|
return _Path = value;
|
2020-05-02 21:56:05 +00:00
|
|
|
}
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2020-05-02 21:56:05 +00:00
|
|
|
set
|
2019-06-01 20:40:01 +00:00
|
|
|
{
|
2020-05-02 21:56:05 +00:00
|
|
|
string oldValue = _Path;
|
|
|
|
SetPath(oldValue, ref value);
|
|
|
|
if (oldValue != value)
|
|
|
|
{
|
|
|
|
_Path = value;
|
|
|
|
}
|
2019-06-01 20:40:01 +00:00
|
|
|
}
|
2020-05-02 21:56:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Backing field for Kind.
|
2020-05-02 21:56:05 +00:00
|
|
|
/// </summary>
|
|
|
|
protected Enums.MediaFileKind _Kind;
|
|
|
|
/// <summary>
|
|
|
|
/// When provided in a partial class, allows value of Kind to be changed before setting.
|
|
|
|
/// </summary>
|
|
|
|
partial void SetKind(Enums.MediaFileKind oldValue, ref Enums.MediaFileKind newValue);
|
|
|
|
/// <summary>
|
|
|
|
/// When provided in a partial class, allows value of Kind to be changed before returning.
|
|
|
|
/// </summary>
|
|
|
|
partial void GetKind(ref Enums.MediaFileKind result);
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Required.
|
2020-05-02 21:56:05 +00:00
|
|
|
/// </summary>
|
|
|
|
[Required]
|
|
|
|
public Enums.MediaFileKind Kind
|
|
|
|
{
|
|
|
|
get
|
2019-06-01 20:40:01 +00:00
|
|
|
{
|
2020-05-02 21:56:05 +00:00
|
|
|
Enums.MediaFileKind value = _Kind;
|
|
|
|
GetKind(ref value);
|
2020-06-19 09:57:37 +00:00
|
|
|
return _Kind = value;
|
2019-06-01 20:40:01 +00:00
|
|
|
}
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2020-05-02 21:56:05 +00:00
|
|
|
set
|
2019-06-01 20:40:01 +00:00
|
|
|
{
|
2020-05-02 21:56:05 +00:00
|
|
|
Enums.MediaFileKind oldValue = _Kind;
|
|
|
|
SetKind(oldValue, ref value);
|
|
|
|
if (oldValue != value)
|
|
|
|
{
|
|
|
|
_Kind = value;
|
|
|
|
}
|
2019-06-01 20:40:01 +00:00
|
|
|
}
|
2020-05-02 21:56:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Required, ConcurrenyToken.
|
2020-05-02 21:56:05 +00:00
|
|
|
/// </summary>
|
|
|
|
[ConcurrencyCheck]
|
|
|
|
[Required]
|
|
|
|
public uint RowVersion { get; set; }
|
2019-06-01 20:40:01 +00:00
|
|
|
|
2020-05-02 21:56:05 +00:00
|
|
|
public void OnSavingChanges()
|
|
|
|
{
|
|
|
|
RowVersion++;
|
|
|
|
}
|
2019-06-01 20:40:01 +00:00
|
|
|
|
2020-05-02 21:56:05 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* Navigation properties
|
|
|
|
*************************************************************************/
|
2019-06-01 20:40:01 +00:00
|
|
|
|
2020-05-02 21:56:05 +00:00
|
|
|
[ForeignKey("MediaFileStream_MediaFileStreams_Id")]
|
|
|
|
public virtual ICollection<MediaFileStream> MediaFileStreams { get; protected set; }
|
|
|
|
}
|
2019-06-01 20:40:01 +00:00
|
|
|
}
|
|
|
|
|