Exemplo n.º 1
0
        private bool ImportTrackData(DiscogsSelectReleaseWindow selectReleaseWindow)
        {
            int discNumber = 1;

            foreach (var disc in this.discs)
            {
                DiscogsMatchWindow matchWindow = new DiscogsMatchWindow(
                    this.collectionManager,
                    disc,
                    selectReleaseWindow.Release);

                if (matchWindow.ShowDialog(this.window) != true)
                {
                    return(false);
                }

                ++discNumber;
            }
            return(true);
        }
        public void Merge()
        {
            string discogsReleaseString = release.DiscogsReleaseId == 0 ? null : release.DiscogsReleaseId.ToString();

            DiscogsSelectReleaseWindow selectReleaseWindow = new DiscogsSelectReleaseWindow(discogsReleaseString);
            if (selectReleaseWindow.ShowDialog(this.window) == true && selectReleaseWindow.Release != null)
            {
                var discogsRelease = selectReleaseWindow.Release;

                DiscogsSelectImportOptions importOptionsWindow = new DiscogsSelectImportOptions();
                if (importOptionsWindow.ShowDialog(this.window) == true)
                {
                    if (importOptionsWindow.ImportTrackData)
                    {
                        if (!ImportTrackData(selectReleaseWindow))
                        {
                            return;
                        }
                    }
                    if (importOptionsWindow.ImportAlbumArtist)
                    {
                        ImportAlbumArtist(discogsRelease, importOptionsWindow);
                    }
                    if (importOptionsWindow.ImportImages)
                    {
                        ImportImages(discogsRelease);
                    }
                    if (importOptionsWindow.ImportReleaseDate)
                    {
                        this.release.ReleaseDate = ReleaseDate.Parse(discogsRelease.ReleaseDate);
                    }
                    if (importOptionsWindow.ImportTitle)
                    {
                        this.release.Title = discogsRelease.Title;
                    }
                    if (importOptionsWindow.ImportCatalogInformation)
                    {
                        this.release.Country = discogsRelease.Country;
                        this.release.Genre = discogsRelease.Genres.FirstOrDefault();
                        if (discogsRelease.Labels.Length >= 1)
                        {
                            var discogsLabel = discogsRelease.Labels[0];
                            if (discogsRelease.Labels.Length > 1)
                            {
                                DiscogsSelectLabelWindow selectLabelWindow = new DiscogsSelectLabelWindow(discogsRelease);
                                selectLabelWindow.Owner = this.window;
                                if (selectLabelWindow.ShowDialog() != true)
                                {
                                    return;
                                }
                                discogsLabel = selectLabelWindow.SelectedLabel;
                            }

                            this.release.Label = discogsLabel.Aggregate.NameFixed;
                            this.release.CatalogNumber = discogsLabel.CatalogNumber;
                        }
                    }
                    if (importOptionsWindow.ImportNotes)
                    {
                        this.release.Notes = discogsRelease.Notes;
                    }

                    this.release.DiscogsReleaseId = discogsRelease.Id;
                    this.release.DiscogsMasterId = discogsRelease.MasterId;
                }
            }
        }
        private bool ImportTrackData(DiscogsSelectReleaseWindow selectReleaseWindow)
        {
            int discNumber = 1;
            foreach (var disc in this.discs)
            {
                DiscogsMatchWindow matchWindow = new DiscogsMatchWindow(
                    this.collectionManager,
                    disc,
                    selectReleaseWindow.Release);

                if (matchWindow.ShowDialog(this.window) != true)
                {
                    return false;
                }

                ++discNumber;
            }
            return true;
        }
Exemplo n.º 4
0
        public void Merge()
        {
            string discogsReleaseString = release.DiscogsReleaseId == 0 ? null : release.DiscogsReleaseId.ToString();

            DiscogsSelectReleaseWindow selectReleaseWindow = new DiscogsSelectReleaseWindow(discogsReleaseString);

            if (selectReleaseWindow.ShowDialog(this.window) == true && selectReleaseWindow.Release != null)
            {
                var discogsRelease = selectReleaseWindow.Release;

                DiscogsSelectImportOptions importOptionsWindow = new DiscogsSelectImportOptions();
                if (importOptionsWindow.ShowDialog(this.window) == true)
                {
                    if (importOptionsWindow.ImportTrackData)
                    {
                        if (!ImportTrackData(selectReleaseWindow))
                        {
                            return;
                        }
                    }
                    if (importOptionsWindow.ImportAlbumArtist)
                    {
                        ImportAlbumArtist(discogsRelease, importOptionsWindow);
                    }
                    if (importOptionsWindow.ImportImages)
                    {
                        ImportImages(discogsRelease);
                    }
                    if (importOptionsWindow.ImportReleaseDate)
                    {
                        this.release.ReleaseDate = ReleaseDate.Parse(discogsRelease.ReleaseDate);
                    }
                    if (importOptionsWindow.ImportTitle)
                    {
                        this.release.Title = discogsRelease.Title;
                    }
                    if (importOptionsWindow.ImportCatalogInformation)
                    {
                        this.release.Country = discogsRelease.Country;
                        this.release.Genre   = discogsRelease.Genres.FirstOrDefault();
                        if (discogsRelease.Labels.Length >= 1)
                        {
                            var discogsLabel = discogsRelease.Labels[0];
                            if (discogsRelease.Labels.Length > 1)
                            {
                                DiscogsSelectLabelWindow selectLabelWindow = new DiscogsSelectLabelWindow(discogsRelease);
                                selectLabelWindow.Owner = this.window;
                                if (selectLabelWindow.ShowDialog() != true)
                                {
                                    return;
                                }
                                discogsLabel = selectLabelWindow.SelectedLabel;
                            }

                            this.release.Label         = discogsLabel.Aggregate.NameFixed;
                            this.release.CatalogNumber = discogsLabel.CatalogNumber;
                        }
                    }
                    if (importOptionsWindow.ImportNotes)
                    {
                        this.release.Notes = discogsRelease.Notes;
                    }

                    this.release.DiscogsReleaseId = discogsRelease.Id;
                    this.release.DiscogsMasterId  = discogsRelease.MasterId;
                }
            }
        }