Track.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using Jellyfin.Data.Interfaces;
  4. namespace Jellyfin.Data.Entities.Libraries
  5. {
  6. /// <summary>
  7. /// An entity representing a track.
  8. /// </summary>
  9. public class Track : LibraryItem, IHasReleases
  10. {
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="Track"/> class.
  13. /// </summary>
  14. /// <param name="album">The album.</param>
  15. public Track(MusicAlbum album)
  16. {
  17. if (album == null)
  18. {
  19. throw new ArgumentNullException(nameof(album));
  20. }
  21. album.Tracks.Add(this);
  22. Releases = new HashSet<Release>();
  23. TrackMetadata = new HashSet<TrackMetadata>();
  24. }
  25. /// <summary>
  26. /// Initializes a new instance of the <see cref="Track"/> class.
  27. /// </summary>
  28. /// <remarks>
  29. /// Default constructor. Protected due to required properties, but present because EF needs it.
  30. /// </remarks>
  31. protected Track()
  32. {
  33. }
  34. /// <summary>
  35. /// Gets or sets the track number.
  36. /// </summary>
  37. public int? TrackNumber { get; set; }
  38. /// <inheritdoc />
  39. public virtual ICollection<Release> Releases { get; protected set; }
  40. /// <summary>
  41. /// Gets or sets a collection containing the track metadata.
  42. /// </summary>
  43. public virtual ICollection<TrackMetadata> TrackMetadata { get; protected set; }
  44. }
  45. }