2020-09-01 08:36:45 -07:00
|
|
|
#pragma warning disable CA2227
|
|
|
|
|
2019-06-01 13:40:01 -07:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2020-08-30 15:50:54 -07:00
|
|
|
using Jellyfin.Data.Interfaces;
|
2019-06-01 13:40:01 -07:00
|
|
|
|
2020-08-29 10:30:09 -07:00
|
|
|
namespace Jellyfin.Data.Entities.Libraries
|
2019-06-01 13:40:01 -07:00
|
|
|
{
|
2020-08-30 15:50:54 -07:00
|
|
|
/// <summary>
|
|
|
|
/// An entity representing a track.
|
|
|
|
/// </summary>
|
|
|
|
public class Track : LibraryItem, IHasReleases
|
2020-05-02 14:56:05 -07:00
|
|
|
{
|
|
|
|
/// <summary>
|
2020-08-30 15:50:54 -07:00
|
|
|
/// Initializes a new instance of the <see cref="Track"/> class.
|
2020-05-02 14:56:05 -07:00
|
|
|
/// </summary>
|
2020-08-30 15:50:54 -07:00
|
|
|
/// <param name="album">The album.</param>
|
|
|
|
public Track(MusicAlbum album)
|
2020-05-02 14:56:05 -07:00
|
|
|
{
|
2020-08-30 15:50:54 -07:00
|
|
|
if (album == null)
|
2020-06-20 01:35:29 -07:00
|
|
|
{
|
2020-08-30 15:50:54 -07:00
|
|
|
throw new ArgumentNullException(nameof(album));
|
2020-06-20 01:35:29 -07:00
|
|
|
}
|
|
|
|
|
2020-08-30 15:50:54 -07:00
|
|
|
album.Tracks.Add(this);
|
2020-05-02 14:56:05 -07:00
|
|
|
|
2020-08-30 15:50:54 -07:00
|
|
|
Releases = new HashSet<Release>();
|
|
|
|
TrackMetadata = new HashSet<TrackMetadata>();
|
2020-05-02 14:56:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2020-08-30 15:50:54 -07:00
|
|
|
/// Initializes a new instance of the <see cref="Track"/> class.
|
2020-05-02 14:56:05 -07:00
|
|
|
/// </summary>
|
2020-08-30 15:50:54 -07:00
|
|
|
/// <remarks>
|
|
|
|
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
|
|
|
/// </remarks>
|
|
|
|
protected Track()
|
2020-05-02 14:56:05 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2020-08-30 15:50:54 -07:00
|
|
|
/// Gets or sets the track number.
|
2020-05-02 14:56:05 -07:00
|
|
|
/// </summary>
|
2020-08-30 15:50:54 -07:00
|
|
|
public int? TrackNumber { get; set; }
|
2020-05-02 14:56:05 -07:00
|
|
|
|
2020-08-30 15:50:54 -07:00
|
|
|
/// <inheritdoc />
|
2020-05-02 14:56:05 -07:00
|
|
|
public virtual ICollection<Release> Releases { get; protected set; }
|
2019-06-01 13:40:01 -07:00
|
|
|
|
2020-08-30 15:50:54 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets a collection containing the track metadata.
|
|
|
|
/// </summary>
|
2020-05-02 14:56:05 -07:00
|
|
|
public virtual ICollection<TrackMetadata> TrackMetadata { get; protected set; }
|
|
|
|
}
|
2019-06-01 13:40:01 -07:00
|
|
|
}
|