public SongInAlbumEditContract(SongInAlbum songInAlbum, ContentLanguagePreference languagePreference) { ParamIs.NotNull(() => songInAlbum); DiscNumber = songInAlbum.DiscNumber; SongInAlbumId = songInAlbum.Id; TrackNumber = songInAlbum.TrackNumber; ArtistString = string.Empty; SongAdditionalNames = string.Empty; SongId = 0; var song = songInAlbum.Song; if (song != null) { Artists = song.ArtistList.Select(a => new ArtistContract(a, languagePreference)).ToArray(); ArtistString = song.ArtistString[languagePreference]; SongName = song.TranslatedName[languagePreference]; SongAdditionalNames = string.Join(", ", song.AllNames.Where(n => n != SongName)); SongId = song.Id; } else { Artists = new ArtistContract[0]; SongName = songInAlbum.Name; } IsCustomTrack = song == null; }
private Artist[] GetArtists(ArtistContract[] contracts) { return contracts .Select(a => a.Id == vocalist.Id ? vocalist : new Artist(TranslatedString.Create(a.Name)) {Id = a.Id}) .ToArray(); }
public ArtistForSongContract(ArtistContract artistContract) { ParamIs.NotNull(() => artistContract); Artist = artistContract; }
public ArtistForUserContract(OwnedArtistForUser ownedArtistForUser, ContentLanguagePreference languagePreference) { ParamIs.NotNull(() => ownedArtistForUser); Artist = new ArtistContract(ownedArtistForUser.Artist, languagePreference); Id = ownedArtistForUser.Id; User = new UserContract(ownedArtistForUser.User); }
public GroupForArtistContract(GroupForArtist groupForArtist, ContentLanguagePreference languagePreference) { ParamIs.NotNull(() => groupForArtist); Group = new ArtistContract(groupForArtist.Group, languagePreference); Id = groupForArtist.Id; Member = new ArtistContract(groupForArtist.Member, languagePreference); }
public ArtistForArtistContract(ArtistForArtist groupForArtist, ContentLanguagePreference languagePreference) { ParamIs.NotNull(() => groupForArtist); Parent = new ArtistContract(groupForArtist.Parent, languagePreference); Id = groupForArtist.Id; LinkType = groupForArtist.LinkType; Member = new ArtistContract(groupForArtist.Member, languagePreference); }
public ArtistEditViewModel(ArtistContract artist, IUserPermissionContext permissionContext, ArtistForEditContract editedArtist = null) : this() { ParamIs.NotNull(() => artist); Artist = artist; AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext); EditedArtist = editedArtist; }
public ArchivedArtistVersionDetailsContract(ArchivedArtistVersion archived, ArchivedArtistVersion comparedVersion, ContentLanguagePreference languagePreference) { ArchivedVersion = new ArchivedArtistVersionContract(archived); Artist = new ArtistContract(archived.Artist, languagePreference); ComparedVersion = comparedVersion != null ? new ArchivedArtistVersionContract(comparedVersion) : null; ComparedVersionId = comparedVersion != null ? comparedVersion.Id : 0; Name = Artist.Name; ComparableVersions = archived.Artist.ArchivedVersionsManager.Versions .Where(v => v != archived) .Select(a => new ArchivedObjectVersionContract(a)) .ToArray(); Versions = ComparedArtistsContract.Create(archived, comparedVersion); ComparedVersionId = Versions.SecondId; }
public ArchivedArtistVersionDetailsContract(ArchivedArtistVersion archived, ArchivedArtistVersion comparedVersion, IUserPermissionContext permissionContext) { ParamIs.NotNull(() => archived); ArchivedVersion = new ArchivedArtistVersionContract(archived); Artist = new ArtistContract(archived.Artist, permissionContext.LanguagePreference); ComparedVersion = comparedVersion != null ? new ArchivedArtistVersionContract(comparedVersion) : null; ComparedVersionId = comparedVersion != null ? comparedVersion.Id : 0; Name = Artist.Name; ComparableVersions = archived.Artist.ArchivedVersionsManager .GetPreviousVersions(archived, permissionContext) .Select(a => ArchivedObjectVersionWithFieldsContract.Create(a, a.Diff.ChangedFields.Value, a.Reason)) .ToArray(); Versions = ComparedArtistsContract.Create(archived, comparedVersion); ComparedVersionId = Versions.SecondId; }
public void SetUp() { album = new Album(new LocalizedString("Synthesis", ContentLanguageSelection.English)); producer = new Artist(TranslatedString.Create("Tripshots")) { Id = 1, ArtistType = ArtistType.Producer }; vocalist = new Artist(TranslatedString.Create("Hatsune Miku")) { Id = 39, ArtistType = ArtistType.Vocaloid }; producerContract = new ArtistContract(producer, ContentLanguagePreference.Default); vocalistContract = new ArtistContract(vocalist, ContentLanguagePreference.Default); song1 = new Song(new LocalizedString("Nebula", ContentLanguageSelection.English)) { Id = 2 }; song1.AddArtist(producer); album.AddArtist(producer); album.AddArtist(vocalist); var songInAlbum = new SongInAlbum(song1, album, 1, 1); songInAlbumContract = new SongInAlbumEditContract(songInAlbum, ContentLanguagePreference.Default); songInAlbumContract.Artists = new[] { producerContract }; }
public ArtistDetailsContract(Artist artist, ContentLanguagePreference languagePreference, IUserPermissionContext userContext, IEntryImagePersister imageStore) : base(artist, languagePreference) { AllNames = string.Join(", ", artist.AllNames.Where(n => n != Name)); BaseVoicebank = artist.BaseVoicebank != null ? new ArtistContract(artist.BaseVoicebank, languagePreference) : null; CanRemoveTagUsages = EntryPermissionManager.CanRemoveTagUsages(userContext, artist); CreateDate = artist.CreateDate; Description = artist.Description; Draft = artist.Status == EntryStatus.Draft; TranslatedName = new TranslatedStringContract(artist.TranslatedName); LatestAlbums = new AlbumForApiContract[] {}; LatestSongs = new SongForApiContract[] {}; OwnerUsers = artist.OwnerUsers.Select(u => new UserContract(u.User)).ToArray(); Pictures = artist.Pictures.Select(p => new EntryPictureFileContract(p, imageStore)).ToArray(); TopAlbums = new AlbumForApiContract[] {}; TopSongs = new SongForApiContract[] {}; WebLinks = artist.WebLinks.Select(w => new WebLinkContract(w)).OrderBy(w => w.DescriptionOrUrl).ToArray(); CharacterDesigner = artist.ArtistLinksOfType(ArtistLinkType.CharacterDesigner, LinkDirection.ManyToOne, allowInheritance: true) .Select(g => new ArtistContract(g, languagePreference)).FirstOrDefault(); CharacterDesignerOf = artist.ArtistLinksOfType(ArtistLinkType.CharacterDesigner, LinkDirection.OneToMany) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(a => a.Name).ToArray(); if (artist.CanHaveChildVoicebanks) { var children = artist.ChildVoicebanks .Where(c => !c.Deleted) .Select(c => new ArtistContract(c, languagePreference)) .ToArray(); // Show child voicebanks with release date first ChildVoicebanks = children .Where(c => c.ReleaseDate.HasValue) .OrderBy(c => c.ReleaseDate) .Concat(children.Where(c => !c.ReleaseDate.HasValue)) .ToArray(); } else { ChildVoicebanks = new ArtistContract[0]; } Groups = artist.ArtistLinksOfType(ArtistLinkType.Group, LinkDirection.ManyToOne) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(g => g.Name).ToArray(); Illustrators = artist.ArtistLinksOfType(ArtistLinkType.Illustrator, LinkDirection.ManyToOne, allowInheritance: true) .Select(g => new ArtistContract(g, languagePreference)).ToArray(); IllustratorOf = artist.ArtistLinksOfType(ArtistLinkType.Illustrator, LinkDirection.OneToMany) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(a => a.Name).ToArray(); Manager = artist.ArtistLinksOfType(ArtistLinkType.Manager, LinkDirection.ManyToOne, allowInheritance: true) .Select(g => new ArtistContract(g, languagePreference)).FirstOrDefault(); Members = artist.ArtistLinksOfType(ArtistLinkType.Group, LinkDirection.OneToMany) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(g => g.Name).ToArray(); Tags = artist.Tags.ActiveUsages .Select(u => new TagUsageForApiContract(u, languagePreference)) .OrderByDescending(t => t.Count).ToArray(); VoiceProviders = artist.ArtistLinksOfType(ArtistLinkType.VoiceProvider, LinkDirection.ManyToOne, allowInheritance: true) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(a => a.Name).ToArray(); Voicebanks = artist.ArtistLinksOfType(ArtistLinkType.VoiceProvider, LinkDirection.OneToMany) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(a => a.Name).ToArray(); }
public ArtistForUserContract(ArtistContract artist) { Artist = artist; }
private void UpdateSongArtists(Song song, ArtistContract[] artists) { song.SyncArtists(artists, GetArtists); }
public ArtistSelectionForTrackContract(Artist artist, bool selected, ContentLanguagePreference languagePreference) { Artist = new ArtistContract(artist, languagePreference); Selected = selected; }
public ArtistForArtistForApiContract(ArtistForArtist link, LinkDirection direction, ContentLanguagePreference languagePreference) { Artist = new ArtistContract(link.GetArtist(direction), languagePreference); LinkType = link.LinkType; }