private void UpdateRelease()
        {
            this.detailsEditor.CommitChanges(this.CollectionManager);

            bool hasTrackArtists = this.release.Tracklist.Any(t => !string.IsNullOrEmpty(t.JoinedArtists));

            foreach (Track track in this.release.Tracklist)
            {
                if (hasTrackArtists)
                {
                    if (track.Artists.Join() != track.JoinedArtists)
                    {
                        track.Artists.Clear();
                        track.Artists.Add(new TrackArtist()
                        {
                            Artist = CollectionManager.GetOrCreateArtist(track.JoinedArtists)
                        });
                    }
                }
                else
                {
                    track.Artists.Clear();
                }
            }

            ThumbnailGenerator.UpdateReleaseThumbnail(release, this.imagesEditor);

            this.release.DateModified = DateTime.Now;
        }
 private void UpdateRelease()
 {
     this.detailsEditor.CommitChanges(this.CollectionManager);
     foreach (TabItem tab in this.tabs.Items)
     {
         ImportTracksDiscEditor discEditor = (ImportTracksDiscEditor)tab.Content;
         discEditor.CommitChanges(this.CollectionManager);
     }
     ThumbnailGenerator.UpdateReleaseThumbnail(this.DatabaseRelease, this.imagesEditor);
     this.DatabaseRelease.DateAdded         = DateTime.Now;
     this.DatabaseRelease.DateModified      = DateTime.Now;
     this.DatabaseRelease.DateAudioModified = DateTime.Now;
 }
Пример #3
0
        public Release ImportRelease(Stream stream)
        {
            using (XmlReader reader = this.CreateReader(stream))
            {
                reader.Read();
                Assert.IsTrue(reader.NodeType == XmlNodeType.XmlDeclaration);

                reader.Read();
                reader.AssertElementStart(Keys.Release);

                Release release = this.ReadRelease(reader);
                ThumbnailGenerator.UpdateReleaseThumbnail(release, this.collectionManager.ImageHandler);
                release.UpdateDynamicProperties();

                return(release);
            }
        }
        private void UpdateImageForRelease(ReleaseData releaseData, ImageViewModel selectedItem)
        {
            string        extension = Path.GetExtension(selectedItem.DiscogsImage.Uri);
            string        mimeType  = MimeHelper.GetMimeTypeForExtension(extension);
            DatabaseImage image     = new DatabaseImage()
            {
                Description = "Auto import from Discogs",
                Extension   = extension,
                IsMain      = true,
                MimeType    = mimeType,
                Type        = ImageType.FrontCover
            };

            releaseData.Release.Images.Add(image);
            releaseData.Release.DateModified = DateTime.Now;
            this.CollectionManager.ImageHandler.StoreImage(image, selectedItem.Data);
            ThumbnailGenerator.UpdateReleaseThumbnail(releaseData.Release, this.CollectionManager.ImageHandler);
            this.CollectionManager.Save(releaseData.Release);

            this.CollectionManager.Operations.WriteTags(releaseData.Release);
        }