private void discEditor_ItemAdding(object sender, TrackAddingEventArgs e) { this.UpdateRelease(); string albumArtists = string.IsNullOrEmpty(e.ImportTrackItem.SourceItem.Tag.AlbumArtists) ? e.ImportTrackItem.SourceItem.Tag.Artists : e.ImportTrackItem.SourceItem.Tag.AlbumArtists; string artists = string.IsNullOrEmpty(e.ImportTrackItem.SourceItem.Tag.Artists) ? e.ImportTrackItem.SourceItem.Tag.AlbumArtists : e.ImportTrackItem.SourceItem.Tag.Artists; if (string.IsNullOrEmpty(this.DatabaseRelease.JoinedAlbumArtists) && !string.IsNullOrEmpty(albumArtists)) { this.DatabaseRelease.Artists.Clear(); this.DatabaseRelease.Artists.Add(new ReleaseArtist() { Artist = this.CollectionManager.GetOrCreateArtist(albumArtists) }); this.DatabaseRelease.JoinedAlbumArtists = albumArtists; } if (string.IsNullOrEmpty(this.DatabaseRelease.Title)) { this.DatabaseRelease.Title = e.ImportTrackItem.SourceItem.Tag.Album; } if (this.DatabaseRelease.ReleaseDate.Type == ReleaseDateType.Invalid && e.ImportTrackItem.SourceItem.Tag.Year != 0) { this.DatabaseRelease.ReleaseDate = new ReleaseDate(e.ImportTrackItem.SourceItem.Tag.Year); } if (string.IsNullOrEmpty(this.DatabaseRelease.Genre)) { this.DatabaseRelease.Genre = e.ImportTrackItem.SourceItem.Tag.Genre; } if (artists != this.DatabaseRelease.JoinedAlbumArtists && !string.IsNullOrEmpty(artists)) { foreach (Track track in this.DatabaseRelease.Tracklist) { if (string.IsNullOrEmpty(track.JoinedArtists)) { track.Artists.Add(new TrackArtist() { Artist = this.CollectionManager.GetOrCreateArtist(artists) }); track.JoinedArtists = artists; } } e.ImportTrackItem.Track.Artists.Add(new TrackArtist() { Artist = this.CollectionManager.GetOrCreateArtist(artists) }); e.ImportTrackItem.Track.JoinedArtists = artists; } this.detailsEditor.Release = null; this.detailsEditor.Release = this.DatabaseRelease; this.RefreshAllDiscs(); }
private void discEditor_ItemAdding(object sender, TrackAddingEventArgs e) { this.UpdateRelease(); string albumArtists = string.IsNullOrEmpty(e.ImportTrackItem.SourceItem.Tag.AlbumArtists) ? e.ImportTrackItem.SourceItem.Tag.Artists : e.ImportTrackItem.SourceItem.Tag.AlbumArtists; string artists = string.IsNullOrEmpty(e.ImportTrackItem.SourceItem.Tag.Artists) ? e.ImportTrackItem.SourceItem.Tag.AlbumArtists : e.ImportTrackItem.SourceItem.Tag.Artists; if (string.IsNullOrEmpty(this.DatabaseRelease.JoinedAlbumArtists) && !string.IsNullOrEmpty(albumArtists)) { this.DatabaseRelease.Artists.Clear(); this.DatabaseRelease.Artists.Add(new ReleaseArtist() { Artist = this.CollectionManager.GetOrCreateArtist(albumArtists) }); this.DatabaseRelease.JoinedAlbumArtists = albumArtists; } if (string.IsNullOrEmpty(this.DatabaseRelease.Title)) { this.DatabaseRelease.Title = e.ImportTrackItem.SourceItem.Tag.Album; } if (this.DatabaseRelease.ReleaseDate.Type == ReleaseDateType.Invalid && e.ImportTrackItem.SourceItem.Tag.Year != 0) { this.DatabaseRelease.ReleaseDate = new ReleaseDate(e.ImportTrackItem.SourceItem.Tag.Year); } if (string.IsNullOrEmpty(this.DatabaseRelease.Genre)) { this.DatabaseRelease.Genre = e.ImportTrackItem.SourceItem.Tag.Genre; } if (artists != this.DatabaseRelease.JoinedAlbumArtists && !string.IsNullOrEmpty(artists)) { foreach (Track track in this.DatabaseRelease.Tracklist) { if (string.IsNullOrEmpty(track.JoinedArtists)) { track.Artists.Add(new TrackArtist() { Artist = this.CollectionManager.GetOrCreateArtist(artists) }); track.JoinedArtists = artists; } } e.ImportTrackItem.Track.Artists.Add(new TrackArtist() { Artist = this.CollectionManager.GetOrCreateArtist(artists) }); e.ImportTrackItem.Track.JoinedArtists = artists; } this.detailsEditor.Release = null; this.detailsEditor.Release = this.DatabaseRelease; this.RefreshAllDiscs(); }