Beispiel #1
0
        public static void SetTrackNumber()
        {
            string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            foreach (
                string file in
                Directory.EnumerateFiles(exePath.Substring(0, exePath.LastIndexOf("\\") + 1), "*.mp3",
                                         SearchOption.AllDirectories))
            {
                UltraID3 u = new UltraID3();
                u.Read(file);
                string OnlyFileName = u.FileName.Substring(u.FileName.LastIndexOf("\\") + 1).Replace(".mp3", "");

                OnlyFileName = OnlyFileName.Substring(OnlyFileName.Length - 3, 3);

                short trackNumber = Convert.ToInt16(OnlyFileName);

                if (trackNumber <= 255)
                {
                    u.TrackNum = trackNumber;
                    u.Write();
                }
                else
                {
                    WriteLog("Track Length More Than 255 For File Name : " + u.FileName);
                }
            }

            WriteLog("Track Changed");
        }
Beispiel #2
0
        public void UltraID3Test()
        {
            UltraID3 ultraID3 = new UltraID3();

            ultraID3.Read(@"e:\Music\Antenne Bayern Radio\Mirror Dawn.mp3");
            testContextInstance.WriteLine(ultraID3.Artist);
            testContextInstance.WriteLine(ultraID3.Genre);

            //ultraID3.Genre = "Rock";
            //ultraID3.Write();

            MPEGFrameInfo mpegFrameInfo = ultraID3.FirstMPEGFrameInfo;

            if (ultraID3.ID3v1Tag.ExistsInFile)
            {
            }
            ID3v2Tag           id3v2Tag = ultraID3.ID3v2Tag;
            ID3FrameCollection frames   = id3v2Tag.Frames;

            for (int i = 0; i < frames.Count; i++)
            {
                ID3v2Frame frame = frames[i];
            }

            id3v2Tag.Genre = "Chillout";
            ultraID3.Write();
        }
Beispiel #3
0
        public override async void EndOfTrack(SpotifySession session)
        {
            session.PlayerPlay(false);
            wr.Close();

            // Move File
            var dir = downloadPath + escape(downloadingTrack.Album().Name()) + "\\";

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            var fileName = dir + escape(GetTrackFullName(downloadingTrack)) + ".mp3";

            if (GetDownloadType() == DownloadType.OVERWRITE && File.Exists(fileName))
            {
                File.Delete(fileName);
            }
            File.Move("downloading", fileName);

            // Tag
            var u = new UltraID3();

            u.Read(fileName);
            u.Artist   = GetTrackArtistsNames(downloadingTrack);
            u.Title    = downloadingTrack.Name();
            u.Album    = downloadingTrack.Album().Name();
            u.TrackNum = (short)downloadingTrack.Index();
            u.Year     = (short)downloadingTrack.Album().Year();

            var imageID = downloadingTrack.Album().Cover(ImageSize.Large);
            var image   = SpotifySharp.Image.Create(session, imageID);

            await WaitForBool(image.IsLoaded);

            var tc  = TypeDescriptor.GetConverter(typeof(Bitmap));
            var bmp = (Bitmap)tc.ConvertFrom(image.Data());

            var pictureFrame = new ID3v23PictureFrame(bmp, PictureTypes.CoverFront, "image", TextEncodingTypes.ISO88591);

            u.ID3v2Tag.Frames.Add(pictureFrame);

            u.Write();

            base.EndOfTrack(session);

            if (OnDownloadProgress != null)
            {
                OnDownloadProgress(100);
            }

            if (OnDownloadComplete != null)
            {
                OnDownloadComplete(true);
            }
        }
Beispiel #4
0
 static void AddAlbumArt(string albumArtPath, UltraID3 u)
 {
     using (Image img = Image.FromFile(albumArtPath))
     {
         ID3FrameCollection myArtworkCollection = u.ID3v2Tag.Frames.GetFrames(MultipleInstanceID3v2FrameTypes.ID3v23Picture);
         ID3v23PictureFrame AlbumArt = new ID3v23PictureFrame(new Bitmap(img), PictureTypes.CoverFront, "", TextEncodingTypes.ISO88591);
         u.ID3v2Tag.Frames.Add(AlbumArt);
         u.Write();
     }
 }
Beispiel #5
0
        public void Write()
        {
            u.ID3v2Tag.Frames.Remove(ID3v2FrameTypes.ID3v23UserDefinedText);
            ID3v23UserDefinedTextFrame n = default(ID3v23UserDefinedTextFrame);

            System.Text.StringBuilder s = new System.Text.StringBuilder();

            for (int i = 0; i < this.UserText.Count; i++)
            {
                n             = new ID3v23UserDefinedTextFrame(this.UserText.GetValues(i)[0]);
                n.Description = this.UserText.GetKey(i);
                //n.UserDefinedText = this.UserText.GetValues(i)[0];

                u.ID3v2Tag.Frames.Add(n);

                s.Append(n.Description + ":" + n.UserDefinedText);
            }

            u.ID3v2Tag.Frames.SetComments("DBInfo", s.ToString());

            u.Write();
        }
Beispiel #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.mode == 1)
            {
                //Setting the progress bar value to 0 and then it sets it t the number of files that end with ".mp3" inside a folder (including subfolders)
                progressBar1.Value = 0;
                progressBar1.Maximum = Directory.GetFiles(Properties.Settings.Default.path, "*.mp3", SearchOption.AllDirectories).Length;

                foreach (string file in Directory.GetFiles(Properties.Settings.Default.path, "*.mp3", SearchOption.AllDirectories))
                {
                    //It uses Ultra ID3 Library to access ID3 tags
                    UltraID3 mp3 = new UltraID3();
                    mp3.Read(file);

                    string title = mp3.Title;

                    //If the title inside ID3 tags isn't empty
                    if (title.Trim() != "")
                    {
                        string[] a1 = file.Split('\\'); //splits the path
                        string final = file.Substring(0, file.Length - a1[a1.Length - 1].Length) + title + ".mp3";
                        if (!File.Exists(final))
                            File.Move(file, final);
                    }

                    progressBar1.Value++;
                }
            }
            if (Properties.Settings.Default.mode == 2)
            {
                //SAME
                progressBar1.Value = 0;
                progressBar1.Maximum = Directory.GetFiles(Properties.Settings.Default.path, "*.mp3", SearchOption.AllDirectories).Length;

                foreach (string file in Directory.GetFiles(Properties.Settings.Default.path, "*.mp3", SearchOption.AllDirectories))
                {
                    UltraID3 mp3 = new UltraID3();
                    mp3.Read(file);

                    string[] a1 = file.Split('\\');
                    string final = a1[a1.Length - 1].Substring(0, a1[a1.Length - 1].Length - 4);

                    mp3.Title = final;

                    mp3.Write();

                    progressBar1.Value++;
                }
            }
        }
Beispiel #7
0
        public static void ChangeAlbumWithParentFolder()
        {
            string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            int fileCount = 0;

            foreach (string file in Directory.EnumerateFiles(exePath.Substring(0, exePath.LastIndexOf("\\") + 1), "*.mp3", SearchOption.AllDirectories))
            {
                UltraID3 u = new UltraID3();
                u.Read(file);

                string ParentFolderName =
                    u.FileName.Substring(u.FileName.LastIndexOf("\\", u.FileName.LastIndexOf("\\") - 1) + 1,
                                         u.FileName.LastIndexOf("\\", u.FileName.LastIndexOf("\\")) -
                                         u.FileName.LastIndexOf("\\", u.FileName.LastIndexOf("\\") - 1) - 1);

                try
                {
                    if (ParentFolderName.Length >= 30)
                    {
                        WriteLog("Length More Than 30 For Album Name : " + ParentFolderName);
                        u.Album = ParentFolderName.Substring(0, 30);
                    }
                    else
                    {
                        u.Album = ParentFolderName;
                    }

                    u.Write();
                    WriteLog("Done For File Name : " + u.FileName);

                    fileCount++;
                }
                catch (Exception e)
                {
                    WriteLog("Following Error For File : " + u.FileName);
                    WriteLog(e.Message);
                }
            }
        }
Beispiel #8
0
        public int TratarInfo(string caminho)
        {
            int processed = 0;

            string[] lstArquivos = Directory.GetFiles(caminho, "*.mp3");

            bool achou;

            foreach (string arq in lstArquivos)
            {
                achou = false;
                u.Read(arq);
                if (string.IsNullOrEmpty(u.Title))
                {
                    achou   = true;
                    u.Title = BuscarDados(arq);
                }

                if (string.IsNullOrEmpty(u.Artist))
                {
                    achou    = true;
                    u.Artist = BuscarDados(arq, true);
                }

                if (string.IsNullOrEmpty(u.Album))
                {
                    achou   = true;
                    u.Album = "[Baixados]";
                }

                if (achou)
                {
                    u.Write();
                    processed++;
                }
            }

            return(processed);
        }
Beispiel #9
0
        public static void ChangeTitleWithFileName()
        {
            string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            int fileCount = 0;

            foreach (string file in Directory.EnumerateFiles(exePath.Substring(0, exePath.LastIndexOf("\\") + 1), "*.mp3", SearchOption.AllDirectories))
            {
                UltraID3 u = new UltraID3();
                u.Read(file);
                string OnlyFileName = u.FileName.Substring(u.FileName.LastIndexOf("\\") + 1).Replace(".mp3", "");
                try
                {
                    if (OnlyFileName.Length >= 30)
                    {
                        WriteLog("Length More Than 30 For File Name : " + u.FileName);
                        u.Title = OnlyFileName.Substring(0, 30);
                    }
                    else
                    {
                        u.Title = OnlyFileName;
                    }

                    u.Write();
                    WriteLog("Done For File Name : " + u.FileName);

                    fileCount++;
                }
                catch (Exception e)
                {
                    WriteLog("Following Error For File : " + u.FileName);
                    WriteLog(e.Message);
                }
            }
            Console.WriteLine("All Done For File Number : " + fileCount);
        }
Beispiel #10
0
        private void btnDownload_Click(object sender, EventArgs e)
        {
            WebClient client = new WebClient();
            string    finalPath;

            SetEnabled(false);
            SetInfo("Downloading Songs ...");
            totalTracksCount = m_lbxEntries.CheckedItems.Count;
            List <Track> tracks = m_lbxEntries.CheckedItems.Cast <Track>().ToList();

            if (chkBxDownloadPath.Checked)
            {
                finalPath = downloadFolder;
            }
            else
            {
                finalPath = m_Direcotry;
            }

            if (type != SearchType.TRACK)
            {
                finalPath = Path.Combine(finalPath, title);
                if (!System.IO.Directory.Exists(finalPath))
                {
                    System.IO.Directory.CreateDirectory(finalPath);
                }
            }

            ThreadPool.QueueUserWorkItem(
                (_) =>
            {
                foreach (var track in tracks)
                {
                    string fileName = String.Format("{0}.mp3", track.title);
                    foreach (var chr in Path.GetInvalidFileNameChars().Union(Path.GetInvalidPathChars()))
                    {
                        fileName = fileName.Replace("" + chr, "_");
                    }

                    SetInfo("Downloading " + fileName);
                    tracksCount++;

                    tempDownloadFolder = Path.Combine(finalPath, fileName);

                    if (File.Exists(tempDownloadFolder))
                    {
                        if (chkBxSkip.Checked)
                        {
                            continue;
                        }
                        else
                        {
                            File.Delete(tempDownloadFolder);
                        }
                    }

                    // string streamurl = client.DownloadString(new Uri(string.Format("http://api.soundcloud.com/i1/tracks/{0}/streams?client_id={1}", track.id, clientID)));

                    wbClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
                    wbClient.DownloadFileCompleted   += HandleDownloadComplete;

                    var syncObject = new Object();
                    lock (syncObject)
                    {
                        wbClient.DownloadFileAsync(new Uri(track.streamurl), tempDownloadFolder, syncObject);
                        Monitor.Wait(syncObject);
                    }

                    var u = new UltraID3();
                    u.Read(tempDownloadFolder);

                    if (track.artwork_url != null && chkBxImageTags.Checked)
                    {
                        Stream stream = wbClient.OpenRead(track.artwork_url);
                        Bitmap bmp    = new Bitmap(stream);

                        var pictureFrame = new ID3v23PictureFrame(bmp, PictureTypes.CoverFront, "image", TextEncodingTypes.ISO88591);
                        u.ID3v2Tag.Frames.Add(pictureFrame);
                    }

                    string[] splitTitle = null;
                    if (track.title.Contains("-"))
                    {
                        splitTitle = track.title.Split('-');
                        u.Title    = splitTitle[1];
                    }
                    if (chkBxArtistTag.Checked)
                    {
                        if (splitTitle != null)
                        {
                            u.Artist = splitTitle[0];
                        }
                        else
                        {
                            u.Artist = ((User)track.user).username;
                        }
                    }
                    u.Write();
                }

                SetInfo("Finished Downloading!");
                SetEnabled(true);
                SetChecked(false);
                totalTracksCount = 0;
                tracksCount      = 0;
                if (chkBxOpenFolder.Checked)
                {
                    System.Diagnostics.Process.Start("explorer.exe", finalPath);
                }
            });
        }
Beispiel #11
0
        public override async void EndOfTrack(SpotifySession session)
        {
            session.PlayerPlay(false);
            wr.Close();

            // Move File
            string album = downloadingTrack.Album().Name();
            album = filterForFileName(album);

            var dir = downloadPath + album + "\\";
            if (!Directory.Exists(dir))
                Directory.CreateDirectory(dir);

            string song = GetTrackFullName(downloadingTrack);
            song = filterForFileName(song);

            var fileName = dir + song + ".mp3";

            try
            {
                File.Move("downloading", fileName);
                FileInfo fileInfo = new FileInfo(fileName);
                String path = fileInfo.DirectoryName;
            }
            catch (Exception e) {

                File.Delete("downloading");
                LogString("Track deleted because the track already exists! Path: " + fileName + " Track Name:" + SpotifyDownloader.GetTrackFullName(downloadingTrack));
                
                base.EndOfTrack(session);

                if (OnDownloadProgress != null)
                    OnDownloadProgress(100);

                if (OnDownloadComplete != null)
                    OnDownloadComplete();
                
                return;
            }

            try
            {
                // Tag
                var u = new UltraID3();
                //u.GetMPEGTrackInfo();
                u.Read(fileName);
                u.Artist = GetTrackArtistsNames(downloadingTrack);
                u.Title = downloadingTrack.Name();
                u.Album = downloadingTrack.Album().Name();

                var imageID = downloadingTrack.Album().Cover(ImageSize.Large);
                var image = SpotifySharp.Image.Create(session, imageID);
                await WaitForBool(image.IsLoaded);

                var tc = TypeDescriptor.GetConverter(typeof(Bitmap));
                var bmp = (Bitmap)tc.ConvertFrom(image.Data());

                var pictureFrame = new ID3v23PictureFrame(bmp, PictureTypes.CoverFront, "image", TextEncodingTypes.ISO88591);
                u.ID3v2Tag.Frames.Add(pictureFrame);

                u.Write();

                base.EndOfTrack(session);
            }
            catch (Exception e) { };

            LogString("Track downloaded and saved! Path: " + fileName + " Track Name:" + SpotifyDownloader.GetTrackFullName(downloadingTrack));

            if (OnDownloadProgress != null)
                OnDownloadProgress(100);

            if (OnDownloadComplete != null)
                OnDownloadComplete();
        }
        private static void UpdateInfoFromFileName(UltraID3 uid3, string regExpr, string userRegExpString)
        {
            try
            {
                Regex trackinfoRegexp = new Regex(regExpr, RegexOptions.Singleline);
                ///TODO: string _t = ComboBox_ExtractTagsFromFNmane.Text;

                SortedList ht = new SortedList();
                if (userRegExpString.IndexOf(RE_ARTIS) != -1)
                {
                    ht.Add(userRegExpString.IndexOf(RE_ARTIS), RE_ARTIS);
                }
                if (userRegExpString.IndexOf(RE_TRACKNR) != -1)
                {
                    ht.Add(userRegExpString.IndexOf(RE_TRACKNR), RE_TRACKNR);
                }
                if (userRegExpString.IndexOf(RE_ALBUM) != -1)
                {
                    ht.Add(userRegExpString.IndexOf(RE_ALBUM), RE_ALBUM);
                }
                if (userRegExpString.IndexOf(RE_YEAR) != -1)
                {
                    ht.Add(userRegExpString.IndexOf(RE_YEAR), RE_YEAR);
                }
                if (userRegExpString.IndexOf(RE_TITLE) != -1)
                {
                    ht.Add(userRegExpString.IndexOf(RE_TITLE), RE_TITLE);
                }



                foreach (Match m in trackinfoRegexp.Matches(uid3.FileName))
                {
                    IEnumerator enHt = ht.Keys.GetEnumerator();

                    for (int i = 1; i < m.Groups.Count; i++)
                    {
                        enHt.MoveNext();
                        int   key = (int)enHt.Current;
                        Group g   = m.Groups[i];
                        try
                        {
                            switch (ht[key].ToString())
                            {
                            case RE_TITLE:
                                uid3.Title          = g.Value;
                                uid3.ID3v1Tag.Title = g.Value;
                                uid3.ID3v2Tag.Title = g.Value;
                                break;

                            case RE_ARTIS:
                                uid3.Artist          = g.Value;
                                uid3.ID3v1Tag.Artist = g.Value;
                                uid3.ID3v2Tag.Artist = g.Value;
                                break;

                            case RE_ALBUM:
                                uid3.Album          = g.Value;
                                uid3.ID3v1Tag.Album = g.Value;
                                uid3.ID3v2Tag.Album = g.Value;
                                break;

                            case RE_TRACKNR:
                                try{
                                    uid3.SetTrackNum(g.Value);
                                }catch {}
                                try{
                                    uid3.ID3v1Tag.SetTrackNum(g.Value);
                                }
                                catch { }
                                try
                                {
                                    uid3.ID3v2Tag.SetTrackNum(g.Value);
                                }
                                catch { }
                                break;

                            case RE_YEAR:
                                uid3.SetYear(g.Value);
                                uid3.ID3v1Tag.SetYear(g.Value);
                                uid3.ID3v2Tag.SetYear(g.Value);
                                break;
                            }
                        }
                        catch { }
                    }
                }
                uid3.Write();
            }
            catch { }
        }
Beispiel #13
0
        /// <summary>
        /// Removes all image frames from the parameter mp3.
        /// Returns true if any files were removed.
        /// </summary>
        private static bool RemoveAllImages(string p_musicPath)
        {
            bool removed = false;

            UltraID3 myMp3 = new UltraID3();
            myMp3.Read(p_musicPath);

            // frame collection consists of all ID3v2 data, in addition to images
            // therefore, must only delete image frames
            // start by getting only the image frames

            ID3FrameCollection imageFrames =
                myMp3.ID3v23Tag.Frames.GetFrames(MultipleInstanceFrameTypes.Picture);

            if (imageFrames.Count > 0)
            {
                myMp3.ID3v23Tag.Frames.Remove(FrameTypes.Picture);

                myMp3.ID3v23Tag.WriteFlag = true;
                myMp3.Write();

                removed = true;
            }

            // clean up local variables

            imageFrames.Clear();
            myMp3 = null;

            return removed;
        }
Beispiel #14
0
        public void UpdateTags(string connectionString, string musicDrive)
        {
            int songId    = 0;
            int batchSize = 100;

            while (true)
            {
                bool songTaken = false;
                using (var dataContext = new MusicEntities1())
                {
                    IQueryable <SONG> songs = dataContext.SONG.Where(s => s.ID > songId && s.LOCATION.ToLower().Contains(".mp3")).OrderBy(s => s.ID).Take(batchSize);

                    foreach (SONG song in songs)
                    {
                        songTaken = true;
                        try
                        {
                            FileInfo fileInfo      = new FileInfo(song.LOCATION);
                            string   directoryRoot = Directory.GetDirectoryRoot(song.LOCATION);
                            string   filename      = song.LOCATION;
                            if (directoryRoot.ToLower().IndexOf(musicDrive) != 0)
                            {
                                filename = filename.Substring(1);
                                filename = musicDrive + filename;
                            }
                            string genre = null;

                            UltraID3 ultraID3 = new UltraID3();
                            ultraID3.Read(filename);

                            genre = ultraID3.Genre;

                            IID3v2 iD3v2 = ID3v2Helper.CreateID3v2(filename);

                            if (string.IsNullOrWhiteSpace(genre))
                            {
                                genre = iD3v2.Genre;
                            }

                            IID3v1 iD3v1 = ID3v1Helper.CreateID3v1(filename);
                            if (string.IsNullOrWhiteSpace(genre))
                            {
                                genre = GenreHelper.GenreByIndex[iD3v1.GenreIndex];
                            }

                            ID3v2Tag id3v2Tag = ultraID3.ID3v2Tag;

                            if ((genre != song.GENRE) &&
                                (!string.IsNullOrWhiteSpace(song.GENRE)) &&
                                (song.GENRE.ToLower().IndexOf("blues") == -1) &&
                                (song.GENRE.ToLower().IndexOf("other") == -1) &&
                                (song.GENRE.ToLower().IndexOf("unknown") == -1)
                                )
                            {
                                Console.WriteLine(String.Format("{0}, DB genre: {1}, Disk genre: {2}", filename, song.GENRE, genre));

                                try
                                {
                                    ultraID3.Genre = song.GENRE;
                                }
                                catch (Exception e1)
                                {
                                    Console.WriteLine(String.Format("Exception, song: {0}, {1}, {2}", song.LOCATION, e1.Message, e1.StackTrace));
                                }

                                id3v2Tag.Genre = song.GENRE;
                                ultraID3.Write();
                            }
                        }
                        catch (System.IO.DirectoryNotFoundException)
                        {
                            Console.WriteLine(String.Format("Exception, file not found, song: {0}", song.LOCATION));
                        }
                        catch (System.IO.FileNotFoundException)
                        {
                            Console.WriteLine(String.Format("Exception, file not found, song: {0}", song.LOCATION));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(String.Format("Exception, song: {0}, {1}, {2}", song.LOCATION, ex.Message, ex.StackTrace));
                        }
                        songId = song.ID;
                    }
                }
                if (!songTaken)
                {
                    break;
                }
            }
        }
        // Update ID3 tags on the downloaded mp3
        private void tagFile(MusicFile file)
        {
            int iRetries = 0;
            _files[0].DownloadedFile.Refresh();
            while ((!_files[0].DownloadedFile.Exists || _files[0].DownloadedFile.Length == 0) && iRetries < 30)
            {
                // Downloaded, but not flushed?  Sleep for a little while.
                iRetries++;
                System.Threading.Thread.Sleep(1000);
                _files[0].DownloadedFile.Refresh();
            }

            if (iRetries == 30)
            {
                // The file was never written.  We really need some proper error handling, but this will have to
                // do for now.
                throw new Exception("File " + _files[0].DownloadedFile.Name + " has a size of zero bytes and cannot be tagged.");
            }
            else
            {
                UltraID3 tagger = new UltraID3();
                tagger.Read(file.DownloadedFile.FullName);

                tagger.ID3v2Tag.Album = file.Album;
                tagger.ID3v2Tag.Artist = file.Artist;
                tagger.ID3v2Tag.Title = file.Title;

                tagger.Write();
            }
        }
Beispiel #16
0
        public override async void EndOfTrack(SpotifySession session)
        {
            session.PlayerPlay(false);
            wr.Close();

            // Move File
            var dir = downloadPath + escape(downloadingTrack.Album().Name()) + "\\";
            if (!Directory.Exists(dir))
                Directory.CreateDirectory(dir);
            var fileName = dir + escape(GetTrackFullName(downloadingTrack)) + ".mp3";
            if(GetDownloadType() == DownloadType.OVERWRITE && File.Exists(fileName))
                File.Delete(fileName);
            File.Move("downloading", fileName);

            // Tag
            var u = new UltraID3();
            u.Read(fileName);
            u.Artist = GetTrackArtistsNames(downloadingTrack);
            u.Title = downloadingTrack.Name();
            u.Album = downloadingTrack.Album().Name();
            u.TrackNum = (short)downloadingTrack.Index();

            var imageID = downloadingTrack.Album().Cover(ImageSize.Large);
            var image = SpotifySharp.Image.Create(session, imageID);
            await WaitForBool(image.IsLoaded);

            var tc = TypeDescriptor.GetConverter(typeof(Bitmap));
            var bmp = (Bitmap)tc.ConvertFrom(image.Data());

            var pictureFrame = new ID3v23PictureFrame(bmp, PictureTypes.CoverFront, "image", TextEncodingTypes.ISO88591);
            u.ID3v2Tag.Frames.Add(pictureFrame);

            u.Write();

            base.EndOfTrack(session);

            if (OnDownloadProgress != null)
                OnDownloadProgress(100);

            if (OnDownloadComplete != null)
                OnDownloadComplete(true);
        }
Beispiel #17
0
        /// <summary>
        /// 
        /// </summary>
        private static void AttachIDv2(string p_musicPath)
        {
            UltraID3 myMp3 = new UltraID3();
            myMp3.Read(p_musicPath);

            // get base data

            string band = myMp3.Artist;
            string album = myMp3.Album;
            string title = myMp3.Title;
            string genre = myMp3.Genre;
            short? year = myMp3.Year;

            // create IDv2 frames if necessary

            if (myMp3.ID3v23Tag.Frames.Count <= 1)
            {
                ID3ArtistFrame artistFr = new ID3ArtistFrame(band);
                ID3AlbumFrame albumFr = new ID3AlbumFrame(album);
                ID3TitleFrame titleFr = new ID3TitleFrame(title);
                ID3GenreFrame genreFr = new ID3GenreFrame(genre);
                ID3YearFrame yearFr = new ID3YearFrame(year);

                artistFr.TextEncodingType = TextEncodingTypes.Unicode;
                albumFr.TextEncodingType = TextEncodingTypes.Unicode;
                titleFr.TextEncodingType = TextEncodingTypes.Unicode;
                genreFr.TextEncodingType = TextEncodingTypes.Unicode;
                yearFr.TextEncodingType = TextEncodingTypes.Unicode;

                myMp3.ID3v23Tag.Frames.Add(artistFr);
                myMp3.ID3v23Tag.Frames.Add(albumFr);
                myMp3.ID3v23Tag.Frames.Add(titleFr);
                myMp3.ID3v23Tag.Frames.Add(genreFr);
                myMp3.ID3v23Tag.Frames.Add(yearFr);

                myMp3.ID3v23Tag.WriteFlag = true;
                myMp3.Write();
            }

            // clean up local variables

               //         imageFrames.Clear();
            myMp3 = null;
        }
Beispiel #18
0
 public bool Download()
 {
     bool success = false;
     UltraID3 u = new UltraID3();
     if (!Directory.Exists(_LocalDir))
         Directory.CreateDirectory(_LocalDir);
     if (!File.Exists(_LocalUrl))
     {
         try { wc.DownloadFile(_RemoteUrl, _LocalUrl); success = true; }
         catch { Console.ForegroundColor = ConsoleColor.Red; }
     }
     else
         success = true;
     u.Read(_LocalUrl);
     u.ID3v2Tag.Album = _Album;
     u.ID3v2Tag.Artist = _Artist;
     u.ID3v2Tag.Title = _Title;
     u.ID3v2Tag.TrackNum = _TrackNum;
     AddAlbumArt(Path.Combine(_LocalDir, albumArtFilename), u);
     u.Write();
     return success;
 }
        private static void UpdateInfoFromFileName(UltraID3 uid3, string regExpr, string userRegExpString)
        {
            try
            {
                Regex trackinfoRegexp = new Regex(regExpr, RegexOptions.Singleline);
                ///TODO: string _t = ComboBox_ExtractTagsFromFNmane.Text;

                SortedList ht = new SortedList();
                if (userRegExpString.IndexOf(RE_ARTIS) != -1) ht.Add(userRegExpString.IndexOf(RE_ARTIS), RE_ARTIS);
                if (userRegExpString.IndexOf(RE_TRACKNR) != -1) ht.Add(userRegExpString.IndexOf(RE_TRACKNR), RE_TRACKNR);
                if (userRegExpString.IndexOf(RE_ALBUM) != -1) ht.Add(userRegExpString.IndexOf(RE_ALBUM), RE_ALBUM);
                if (userRegExpString.IndexOf(RE_YEAR) != -1) ht.Add(userRegExpString.IndexOf(RE_YEAR), RE_YEAR);
                if (userRegExpString.IndexOf(RE_TITLE) != -1) ht.Add(userRegExpString.IndexOf(RE_TITLE), RE_TITLE);

                foreach (Match m in trackinfoRegexp.Matches(uid3.FileName))
                {
                    IEnumerator enHt = ht.Keys.GetEnumerator();

                    for (int i = 1; i < m.Groups.Count; i++)
                    {
                        enHt.MoveNext();
                        int key = (int)enHt.Current;
                        Group g = m.Groups[i];
                        try
                        {
                            switch (ht[key].ToString())
                            {
                                case RE_TITLE:
                                    uid3.Title = g.Value;
                                    uid3.ID3v1Tag.Title = g.Value;
                                    uid3.ID3v2Tag.Title = g.Value;
                                    break;

                                case RE_ARTIS:
                                    uid3.Artist = g.Value;
                                    uid3.ID3v1Tag.Artist = g.Value;
                                    uid3.ID3v2Tag.Artist = g.Value;
                                    break;

                                case RE_ALBUM:
                                    uid3.Album = g.Value;
                                    uid3.ID3v1Tag.Album = g.Value;
                                    uid3.ID3v2Tag.Album = g.Value;
                                    break;

                                case RE_TRACKNR:
                                    try{
                                        uid3.SetTrackNum(g.Value);
                                    }catch{}
                                    try{
                                        uid3.ID3v1Tag.SetTrackNum(g.Value);
                                    }
                                    catch { }
                                    try
                                    {
                                        uid3.ID3v2Tag.SetTrackNum(g.Value);
                                    }
                                    catch { }
                                    break;

                                case RE_YEAR:
                                    uid3.SetYear(g.Value);
                                    uid3.ID3v1Tag.SetYear(g.Value);
                                    uid3.ID3v2Tag.SetYear(g.Value);
                                    break;

                            }
                        }
                        catch { }

                    }
                }
                uid3.Write();
            }
            catch { }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (Path.GetExtension(label1.Text).Equals(".m4a"))
            {
                string tempFile = Path.GetPathRoot(label1.Text) + "test" + Path.GetExtension(label1.Text);

                string argument = "\"" + tempFile + "\"";
                if (cTitle.Checked == true)
                {
                    argument = argument + " --title \"" + infoTitle.Text + "\"";
                }
                if (cArtist.Checked == true)
                {
                    argument = argument + " --artist \"" + infoArtist.Text + "\"";
                }
                if (cAlbum.Checked == true)
                {
                    argument = argument + " --album \"" + infoAlbum.Text + "\"";
                }
                if (cGenre.Checked == true)
                {
                    argument = argument + " --genre \"" + infoGenre.Text + "\"";
                }
                if (cAlbumArtist.Checked == true)
                {
                    argument = argument + " --albumArtist \"" + infoAlbumArtist.Text + "\"";
                }
                if (cSAlbum.Checked == true)
                {
                    argument = argument + " --sortOrder album \"" + infoSAlbum.Text + "\"";
                }
                if (cTrackNo.Checked == true)
                {
                    if (infoTrackNoTotal.Text != "")
                    {
                        argument = argument + " --tracknum \"" + infoTrackNo.Text + "/" + infoTrackNoTotal.Text + "\"";
                    }
                    else
                    {
                        argument = argument + " --tracknum \"" + infoTrackNo.Text + "\"";
                    }
                }
                if (cDiscNo.Checked == true)
                {
                    if (infoDiscNoTotal.Text != "")
                    {
                        argument = argument + " --tracknum \"" + infoDiscNo.Text + "/" + infoDiscNoTotal.Text + "\"";
                    }
                    else
                    {
                        argument = argument + " --tracknum \"" + infoDiscNo.Text + "\"";
                    }
                }
                argument = argument + " --overWrite";


                if (File.Exists(tempFile))
                {
                    File.Delete(tempFile);
                }

                File.Move(label1.Text, tempFile);



                Process p = new Process();
                p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                p.StartInfo.FileName    = "ap.exe";
                p.StartInfo.Arguments   = argument;
                p.Start();
                p.WaitForExit();

                File.Move(tempFile, label1.Text);
            }
            else
            {
                UltraID3 ID3 = new UltraID3();
                ID3.Read(label1.Text);
                if (cTitle.Checked == true)
                {
                    ID3.Title = infoTitle.Text;
                }
                if (cArtist.Checked == true)
                {
                    ID3.Artist = infoArtist.Text;
                }
                if (cAlbum.Checked == true)
                {
                    ID3.Album = infoAlbum.Text;
                }
                //ID3.Genre = infoGenre.Text;
                if (cTrackNo.Checked == true)
                {
                    ID3.TrackNum = Int16.Parse(infoTrackNo.Text);
                }
                ID3.Write();
            }
        }
Beispiel #21
0
        private void btnDownload_Click(object sender, EventArgs e)
        {
            string finalPath;
            SetEnabled(false);
            SetInfo("Downloading Songs");
            totalTracksCount = m_lbxEntries.CheckedItems.Count;
            var tracks = m_lbxEntries.CheckedItems.Cast<Track>();

            if (chkBxDownloadPath.Checked)
            {
                finalPath = downloadFolder;
            }
            else
            {
                finalPath = m_Direcotry;
            }

            if (type != SearchType.TRACK)
            {
                finalPath = Path.Combine(finalPath, title);
                if (!System.IO.Directory.Exists(finalPath))
                {
                    System.IO.Directory.CreateDirectory(finalPath);
                }
            }

            ThreadPool.QueueUserWorkItem(
                (_) =>
                {
                    foreach (var track in tracks)
                    {
                        string fileName = String.Format("{0}.mp3", track.title);
                        foreach (var chr in Path.GetInvalidFileNameChars().Union(Path.GetInvalidPathChars()))
                        {
                            fileName = fileName.Replace("" + chr, "_");
                        }

                        SetInfo("Downloading " + fileName);
                        tracksCount++;

                        tempDownloadFolder = Path.Combine(finalPath, fileName);

                        if (File.Exists(tempDownloadFolder))
                        {
                            if (chkBxSkip.Checked)
                            {
                                continue;
                            }
                            else
                            {
                                File.Delete(tempDownloadFolder);
                            }
                        }

                        string url = String.Format("{0}/stream.json?client_id={1}", track.uri, clientID);
                        wbClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
                        wbClient.DownloadFileCompleted += HandleDownloadComplete;

                        var syncObject = new Object();
                        lock (syncObject)
                        {
                            wbClient.DownloadFileAsync(new Uri(url), tempDownloadFolder, syncObject);
                            Monitor.Wait(syncObject);
                        }

                        var u = new UltraID3();
                        u.Read(tempDownloadFolder);
                       
                        if (track.artwork_url != null && chkBxImageTags.Checked)
                        {
                            Stream stream = wbClient.OpenRead(track.artwork_url);
                            Bitmap bmp = new Bitmap(stream);

                            var pictureFrame = new ID3v23PictureFrame(bmp, PictureTypes.CoverFront, "image", TextEncodingTypes.ISO88591);
                            u.ID3v2Tag.Frames.Add(pictureFrame);
                        }
                        if (track.title.Contains("-"))
                        {
                            string[] splitTitle = track.title.Split('-');
                            u.Title = splitTitle[1];
                            if (chkBxArtistTag.Checked)
                            {
                                u.Artist = splitTitle[0]; //((User)track.user).username;
                            }
                        }
                        else
                        {
                            u.Title = track.title;
                        }
                        u.Write();
                    }

                    SetInfo("Finished Downloading!");
                    SetEnabled(true);
                    SetChecked(false);
                    totalTracksCount = 0;
                    tracksCount = 0;
                    if (chkBxOpenFolder.Checked)
                    {
                        System.Diagnostics.Process.Start("explorer.exe", finalPath);
                    }
                });
        }
Beispiel #22
0
        public void SyncTagsToFiles()
        {
            using (var dataContext = new MusicEntities1())
            {
                IQueryable <SONG> songs     = dataContext.SONG.OrderByDescending(s => s.UPDATED).Take(5000);
                SONG[]            songArray = songs.ToArray();

                foreach (SONG song in songArray)
                {
                    try
                    {
                        if (Regex.IsMatch(song.LOCATION, ".mp3", RegexOptions.IgnoreCase))
                        {
                            FileInfo fileInfo      = new FileInfo(song.LOCATION);
                            string   directoryRoot = Directory.GetDirectoryRoot(song.LOCATION);
                            string   filename      = song.LOCATION;
                            if (directoryRoot.ToLower().IndexOf("e:\\") == -1)
                            {
                                filename = filename.Substring(1);
                                filename = "e" + filename;
                            }

                            string genre = null;

                            IID3v2 iD3v2 = ID3v2Helper.CreateID3v2(filename);
                            genre = iD3v2.Genre;

                            UltraID3 ultraID3 = new UltraID3();
                            ultraID3.Read(filename);
                            if (string.IsNullOrWhiteSpace(genre))
                            {
                                genre = ultraID3.Genre;
                            }
                            else if (ultraID3.Genre != genre)
                            {
//                                ultraID3.Genre = genre;
                            }

                            IID3v1 iD3v1 = ID3v1Helper.CreateID3v1(filename);
                            if (Regex.IsMatch(genre, "("))
                            {
                                genre = GenreHelper.GenreByIndex[iD3v1.GenreIndex];
                            }

//                            ID3v2Tag id3v2Tag = ultraID3.ID3v2Tag;


                            if ((genre != song.GENRE) &&
                                (!string.IsNullOrWhiteSpace(song.GENRE))
                                //&& (song.GENRE.ToLower().IndexOf("blues")==-1)
                                //&& (song.GENRE.ToLower().IndexOf("other") == -1)
                                //&& (song.GENRE.ToLower().IndexOf("unknown") == -1)
                                )
                            {
                                testContextInstance.WriteLine("{0}, DB genre: {1}, Disk genre: {2}", filename, song.GENRE, genre);

                                try
                                {
                                    ultraID3.Genre = song.GENRE;
                                    iD3v2.Genre    = song.GENRE;
                                }
                                catch (Exception e1)
                                {
                                    testContextInstance.WriteLine("Exception, song: {0}, {1}, {2}", song.LOCATION, e1.Message, e1.StackTrace);
                                }

                                iD3v2.Save(filename);
                                ultraID3.Write();
                            }
                        }
                    }
                    catch (System.IO.DirectoryNotFoundException)
                    {
                        testContextInstance.WriteLine("Exception, file not found, song: {0}", song.LOCATION);
                    }
                    catch (System.IO.FileNotFoundException)
                    {
                        testContextInstance.WriteLine("Exception, file not found, song: {0}", song.LOCATION);
                    }
                    catch (Exception ex)
                    {
                        testContextInstance.WriteLine("Exception, song: {0}, {1}, {2}", song.LOCATION, ex.Message, ex.StackTrace);
                    }
                }
            }
        }
Beispiel #23
0
        /// <summary>
        /// Attaches the cover file to the mp3's picture frames.
        /// </summary>
        private static void AttachCover(string p_musicPath, string p_coverPath)
        {
            UltraID3 myMp3 = new UltraID3();
            myMp3.Read(p_musicPath);

            System.Drawing.Bitmap cover = new System.Drawing.Bitmap(p_coverPath);
               // cover = new System.Drawing.Bitmap(cover.GetThumbnailImage(100, 100, null, IntPtr.Zero));

            ID3PictureFrame AlbumArt = new ID3PictureFrame(
                cover, PictureTypes.CoverFront, "Attached picture", TextEncodingTypes.ISO88591);

            myMp3.ID3v23Tag.Frames.Add(AlbumArt);
            myMp3.ID3v23Tag.WriteFlag = true;
            myMp3.Write();

            myMp3 = null;
        }
Beispiel #24
0
        public void SyncTagsToDb()
        {
            using (var dataContext = new MusicEntities1())
            {
                IQueryable <SONG> songs = from s in dataContext.SONG
                                          orderby s.ID
                                          select s;

                foreach (SONG song in songs)
                {
                    try
                    {
                        if (Regex.IsMatch(song.LOCATION, ".mp3", RegexOptions.IgnoreCase))
                        {
                            FileInfo fileInfo      = new FileInfo(song.LOCATION);
                            string   directoryRoot = Directory.GetDirectoryRoot(song.LOCATION);
                            string   filename      = song.LOCATION;
                            if (directoryRoot.ToLower().IndexOf("e:\\") == -1)
                            {
                                filename = filename.Substring(1);
                                filename = "e" + filename;
                            }

                            string genre = null;

                            UltraID3 ultraID3 = new UltraID3();
                            ultraID3.Read(filename);

                            genre = ultraID3.Genre;

                            IID3v2 iD3v2 = ID3v2Helper.CreateID3v2(filename);

                            if (string.IsNullOrWhiteSpace(genre))
                            {
                                genre = iD3v2.Genre;
                            }

                            IID3v1 iD3v1 = ID3v1Helper.CreateID3v1(filename);
                            if (string.IsNullOrWhiteSpace(genre))
                            {
                                genre = GenreHelper.GenreByIndex[iD3v1.GenreIndex];
                            }

                            ID3v2Tag id3v2Tag = ultraID3.ID3v2Tag;

                            //if ((!string.IsNullOrEmpty(ultraID3.Genre)) &&
                            //    (!string.IsNullOrEmpty(id3v2Tag.Genre)) &&
                            //    (ultraID3.Genre != id3v2Tag.Genre)
                            //    )
                            //{
                            //    testContextInstance.WriteLine("{0}, {1}", ultraID3.Genre, id3v2Tag.Genre);
                            //}

                            //genre = id3v2Tag.Genre;

                            //if (string.IsNullOrWhiteSpace(genre))
                            //{
                            //    genre = ultraID3.Genre;
                            //}

                            //if (!string.IsNullOrWhiteSpace(ultraID3.Genre))
                            //{
                            //    genre = ultraID3.Genre;
                            //}

                            //if (string.IsNullOrWhiteSpace(genre))
                            //{
                            //    genre = id3v2Tag.Genre;
                            //}


                            if ((genre != song.GENRE) &&
                                (!string.IsNullOrWhiteSpace(song.GENRE))
                                //&& (song.GENRE.ToLower().IndexOf("blues")==-1)
                                //&& (song.GENRE.ToLower().IndexOf("other") == -1)
                                //&& (song.GENRE.ToLower().IndexOf("unknown") == -1)
                                )
                            {
                                testContextInstance.WriteLine("{0}, DB genre: {1}, Disk genre: {2}", filename, song.GENRE, genre);

                                try
                                {
                                    if ((song.UPDATED > fileInfo.LastWriteTime) &&
                                        (song.GENRE != "Other"))
                                    {
                                        id3v2Tag.Genre = song.GENRE;
                                        ultraID3.Write();
                                    }
                                    else if (genre != "Other")
                                    {
                                        song.GENRE = genre;
                                    }
                                }
                                catch (Exception e1)
                                {
                                    testContextInstance.WriteLine("Exception, song: {0}, {1}, {2}", song.LOCATION, e1.Message, e1.StackTrace);
                                }
                            }
                        }
                    }
                    catch (System.IO.DirectoryNotFoundException)
                    {
                        testContextInstance.WriteLine("Exception, file not found, song: {0}", song.LOCATION);
                    }
                    catch (System.IO.FileNotFoundException)
                    {
                        testContextInstance.WriteLine("Exception, file not found, song: {0}", song.LOCATION);
                    }
                    catch (Exception ex)
                    {
                        testContextInstance.WriteLine("Exception, song: {0}, {1}, {2}", song.LOCATION, ex.Message, ex.StackTrace);
                    }
                }
                dataContext.SaveChanges();
            }
        }
 private void SetID3Tag(string path, Track track)
 {
     try
     {
         var tagger = new UltraID3();
         tagger.Read(path);
         tagger.Title = track.Title;
         tagger.Artist = track.User.Username;
         tagger.Genre = track.Genre;
         tagger.Write();
     }
     catch (Exception ex)
     {
         var entries = new[]
         {
             new LogEntry("Error tagging ", true, false),
             new LogEntry(track.Title, false, false, Config.SoundCloudColor),
             new LogEntry(".", false),
             new LogEntry(ex.Message),
         };
         _logProvider.Log(LogItem.Create(entries));
     }
 }
 private void SetID3Tags(Track track, string path)
 {
     try
     {
         var tagger = new UltraID3();
         tagger.Read(path);
         tagger.Title = track.Title;
         tagger.Artist = track.User.Username;
         tagger.Genre = track.Genre;
         tagger.Write();
     }
     catch (Exception ex)
     {
         LogSpecial("Error tagging ", string.Empty, ".", track.Title, string.Empty);
         Log(ex.Message);
     }
 }
Beispiel #27
0
        static void Main(string[] args)
        {
            var fileName = @"C:\Avi\Entertainment\My Music\English\Misc\[E] - The Black Eyed Peas - Boom Boom Pow.mp3";
            Console.WriteLine(string.Format(@"File read for the test is : '{0}'", fileName));
            Console.WriteLine();
            //// using downloaded c# files from
            //// Ref Link: http://www.developerfusion.com/code/4684/read-mp3-tag-information-id3v1-and-id3v2/
            //var mp3 = new Mp3Info(fileName);
            ////reading all the tags format
            //mp3.ReadAll();

            //Console.WriteLine("Property: [ID3v1] \t[ID3v2]");
            //Console.WriteLine(string.Format("Album: [{0}] \t[{1}]", mp3.id3v1.Album, mp3.id3v2.Album));
            //Console.WriteLine(string.Format("Title: [{0}] \t[{1}]", mp3.id3v1.Title, mp3.id3v2.Title));
            //Console.WriteLine(string.Format("Artist: [{0}] \t[{1}]", mp3.id3v1.Artist, mp3.id3v2.Artist));
            //Console.WriteLine(string.Format("Track: [{0}] \t[{1}]", mp3.id3v1.Track, mp3.id3v2.Track));
            //Console.WriteLine(string.Format("Year: [{0}] \t[{1}]", mp3.id3v1.Year, mp3.id3v2.Year));
            //Console.WriteLine(string.Format("Genre: [{0}] \t[{1}]", mp3.id3v1.Genre, mp3.id3v2.Genre));
            //Console.WriteLine(string.Format("Comment: [{0}] \t[{1}]", mp3.id3v1.Comment, mp3.id3v2.Comment));

            // using utlraID3Lib.
            // Ref Link: http://home.fuse.net/honnert/UltraID3Lib/index.htm#Cost
            var mp3 = new UltraID3();
            mp3.Read(fileName);

            Console.WriteLine("Property: [ID3v1] \t[ID3v2]");
            Console.WriteLine(string.Format("Album: [{0}] \t[{1}]", mp3.ID3v1Tag.Album, mp3.ID3v23Tag.Album));
            Console.WriteLine(string.Format("Title: [{0}] \t[{1}]", mp3.ID3v1Tag.Title, mp3.ID3v23Tag.Title));
            Console.WriteLine(string.Format("Artist: [{0}] \t[{1}]", mp3.ID3v1Tag.Artist, mp3.ID3v23Tag.Artist));
            Console.WriteLine(string.Format("Track: [{0}] \t[{1}]", mp3.ID3v1Tag.TrackNum, mp3.ID3v23Tag.TrackCount));
            Console.WriteLine(string.Format("Year: [{0}] \t[{1}]", mp3.ID3v1Tag.Year, mp3.ID3v23Tag.Year));
            Console.WriteLine(string.Format("Genre: [{0}] \t[{1}]", mp3.ID3v1Tag.Genre, mp3.ID3v23Tag.Genre));
            Console.WriteLine(string.Format("Comment: [{0}] \t[{1}]", mp3.ID3v1Tag.Comments, mp3.ID3v23Tag.Comments));

            var yesNo = "";

            do
            {
                Console.WriteLine();
                Console.Write("Do you want to update file tags[y/n]: ");
                yesNo = Console.ReadLine();
            } while (yesNo.ToLower() != "y" && yesNo.ToLower() != "n");

            if (yesNo.ToLower() == "y")
            {
                Console.WriteLine("Title: ");
                var title = Console.ReadLine();
                Console.WriteLine("Artist: ");
                var artist = Console.ReadLine();
                Console.WriteLine("Album: ");
                var album = Console.ReadLine();
                Console.WriteLine("Year: ");
                var year = Console.ReadLine();

                short yearNum;
                short.TryParse(year, out yearNum);


                mp3.ID3v1Tag.Title = title;
                mp3.ID3v1Tag.Artist = artist;
                mp3.ID3v1Tag.Album = album;
                if (yearNum != 0)
                    mp3.ID3v1Tag.Year = yearNum;

                mp3.ID3v23Tag.Title = mp3.ID3v1Tag.Title;
                mp3.ID3v23Tag.Artist = mp3.ID3v1Tag.Artist;
                mp3.ID3v23Tag.Album = mp3.ID3v1Tag.Album;
                mp3.ID3v23Tag.Year = mp3.ID3v1Tag.Year;

                mp3.Write();
            }

            Console.ReadKey();
        }