Ejemplo n.º 1
0
        private void ButtonRefresh_Click(object sender, EventArgs e)
        {
            this.ListLibrary.Items.Clear();

            if (Directory.Exists(Settings.LibraryLocation))
            {
                foreach (string file in Directory.GetFiles(Settings.LibraryLocation))
                {
                    try
                    {
                        TagLib.File tagLibFile = TagLib.File.Create(file);

                        TagFile tagFile = new TagFile();
                        tagFile.Location = file;

                        TagMeta tagMeta = new TagMeta();
                        tagMeta.Name   = tagLibFile.Tag.Title;
                        tagMeta.Album  = tagLibFile.Tag.Album;
                        tagMeta.Artist = tagLibFile.Tag.JoinedArtists;

                        tagFile.TagMeta = tagMeta;

                        this.ListLibrary.Items.Add(tagFile);
                    } catch (Exception exception)
                    {
                        MessageBox.Show("An error occured while loading " + file + ", details: " + exception.Message, "Something requires your attention.");
                    }
                }
            }
            else
            {
                MessageBox.Show("Please change the library location to a valid path in Settings.", "Something requires your attention.");
            }
        }
Ejemplo n.º 2
0
        private void ButtonDownload_Click(object sender, EventArgs e)
        {
            TagMeta tagMeta = new TagMeta();

            tagMeta.Name   = this.TextName.Text;
            tagMeta.Album  = this.TextAlbum.Text;
            tagMeta.Artist = this.TextArtist.Text;

            TagDownload tagDownload = new TagDownload();

            tagDownload.TagMeta    = tagMeta;
            tagDownload.YoutubeUri = this.TextYoutubeUri.Text;

            TagFile tagFile = new TagFile();

            tagFile.TagMeta = tagMeta;

            tagDownload.TagFile = tagFile;

            Context.QueueDownload(tagDownload);

            this.Close();
        }