Lidarr/src/NzbDrone.Core/Music/Album.cs

70 lines
2.5 KiB
C#
Raw Normal View History

2017-09-18 03:20:36 +00:00
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore;
2017-04-20 23:19:47 +00:00
using System;
using System.Linq;
2017-04-20 23:19:47 +00:00
using System.Collections.Generic;
using Marr.Data;
2017-04-20 23:19:47 +00:00
namespace NzbDrone.Core.Music
{
public class Album : ModelBase
2017-04-20 23:19:47 +00:00
{
public Album()
{
Genres = new List<string>();
2017-04-20 23:19:47 +00:00
Images = new List<MediaCover.MediaCover>();
Links = new List<Links>();
2018-04-08 06:48:34 +00:00
Ratings = new Ratings();
Artist = new Artist();
2017-04-20 23:19:47 +00:00
}
public const string RELEASE_DATE_FORMAT = "yyyy-MM-dd";
// These correspond to columns in the Albums table
// These are metadata entries
public int ArtistMetadataId { get; set; }
public string ForeignAlbumId { get; set; }
public string Title { get; set; }
public string Overview { get; set; }
public string Disambiguation { get; set; }
public DateTime? ReleaseDate { get; set; }
2017-04-20 23:19:47 +00:00
public List<MediaCover.MediaCover> Images { get; set; }
public List<Links> Links { get; set; }
public List<string> Genres { get; set; }
public String AlbumType { get; set; }
public List<SecondaryAlbumType> SecondaryTypes { get; set; }
public Ratings Ratings { get; set; }
// 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; } }
public override string ToString()
{
return string.Format("[{0}][{1}]", ForeignAlbumId, Title.NullSafe());
}
public void ApplyChanges(Album otherAlbum)
{
ForeignAlbumId = otherAlbum.ForeignAlbumId;
ProfileId = otherAlbum.ProfileId;
AddOptions = otherAlbum.AddOptions;
Monitored = otherAlbum.Monitored;
AnyReleaseOk = otherAlbum.AnyReleaseOk;
}
2017-04-20 23:19:47 +00:00
}
}