2017-09-18 03:20:36 +00:00
|
|
|
using NzbDrone.Common.Extensions;
|
2017-06-18 02:27:01 +00:00
|
|
|
using NzbDrone.Core.Datastore;
|
2017-04-20 23:19:47 +00:00
|
|
|
using System;
|
2018-12-15 00:02:43 +00:00
|
|
|
using System.Linq;
|
2017-04-20 23:19:47 +00:00
|
|
|
using System.Collections.Generic;
|
2018-12-15 00:02:43 +00:00
|
|
|
using Marr.Data;
|
2017-04-20 23:19:47 +00:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.Music
|
|
|
|
{
|
2017-06-13 02:02:17 +00:00
|
|
|
public class Album : ModelBase
|
2017-04-20 23:19:47 +00:00
|
|
|
{
|
|
|
|
public Album()
|
|
|
|
{
|
2017-11-16 02:24:33 +00:00
|
|
|
Genres = new List<string>();
|
2017-04-20 23:19:47 +00:00
|
|
|
Images = new List<MediaCover.MediaCover>();
|
2018-12-15 00:02:43 +00:00
|
|
|
Links = new List<Links>();
|
2018-04-08 06:48:34 +00:00
|
|
|
Ratings = new Ratings();
|
2018-12-15 00:02:43 +00:00
|
|
|
Artist = new Artist();
|
2017-04-20 23:19:47 +00:00
|
|
|
}
|
|
|
|
|
2017-06-28 02:25:51 +00:00
|
|
|
public const string RELEASE_DATE_FORMAT = "yyyy-MM-dd";
|
|
|
|
|
2018-12-15 00:02:43 +00:00
|
|
|
// These correspond to columns in the Albums table
|
|
|
|
// These are metadata entries
|
|
|
|
public int ArtistMetadataId { get; set; }
|
2017-06-18 02:27:01 +00:00
|
|
|
public string ForeignAlbumId { get; set; }
|
2017-06-25 13:17:49 +00:00
|
|
|
public string Title { get; set; }
|
2018-12-15 00:02:43 +00:00
|
|
|
public string Overview { get; set; }
|
2018-07-20 22:33:56 +00:00
|
|
|
public string Disambiguation { get; set; }
|
2017-06-28 02:25:51 +00:00
|
|
|
public DateTime? ReleaseDate { get; set; }
|
2017-04-20 23:19:47 +00:00
|
|
|
public List<MediaCover.MediaCover> Images { get; set; }
|
2018-12-15 00:02:43 +00:00
|
|
|
public List<Links> Links { get; set; }
|
2017-04-30 16:34:53 +00:00
|
|
|
public List<string> Genres { get; set; }
|
2017-11-16 02:24:33 +00:00
|
|
|
public String AlbumType { get; set; }
|
2017-11-26 03:51:37 +00:00
|
|
|
public List<SecondaryAlbumType> SecondaryTypes { get; set; }
|
2017-06-25 13:17:49 +00:00
|
|
|
public Ratings Ratings { get; set; }
|
2018-12-15 00:02:43 +00:00
|
|
|
|
|
|
|
// These are Lidarr generated/config
|
|
|
|
public string CleanTitle { get; set; }
|
|
|
|
public int ProfileId { get; set; }
|
|
|
|
public bool Monitored { get; set; }
|
|
|
|
public bool AnyReleaseOk { get; set; }
|
|
|
|
public DateTime? LastInfoSync { get; set; }
|
|
|
|
public DateTime Added { get; set; }
|
|
|
|
public AddArtistOptions AddOptions { get; set; }
|
|
|
|
|
|
|
|
// These are dynamically queried from other tables
|
|
|
|
public LazyLoaded<ArtistMetadata> ArtistMetadata { get; set; }
|
|
|
|
public LazyLoaded<List<AlbumRelease>> AlbumReleases { get; set; }
|
|
|
|
public LazyLoaded<Artist> Artist { get; set; }
|
|
|
|
|
|
|
|
//compatibility properties with old version of Album
|
|
|
|
public int ArtistId { get { return Artist?.Value?.Id ?? 0; } set { Artist.Value.Id = value; } }
|
2017-06-18 02:27:01 +00:00
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return string.Format("[{0}][{1}]", ForeignAlbumId, Title.NullSafe());
|
|
|
|
}
|
2018-01-18 02:28:47 +00:00
|
|
|
|
|
|
|
public void ApplyChanges(Album otherAlbum)
|
|
|
|
{
|
|
|
|
ForeignAlbumId = otherAlbum.ForeignAlbumId;
|
|
|
|
ProfileId = otherAlbum.ProfileId;
|
|
|
|
AddOptions = otherAlbum.AddOptions;
|
|
|
|
Monitored = otherAlbum.Monitored;
|
2018-12-15 00:02:43 +00:00
|
|
|
AnyReleaseOk = otherAlbum.AnyReleaseOk;
|
2018-01-18 02:28:47 +00:00
|
|
|
}
|
2017-04-20 23:19:47 +00:00
|
|
|
}
|
|
|
|
}
|