2
0

Track.cs 1.5 KB

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