Change the MP3 file Details using .Net

This item was filled under [ .NET, Media, Programming, Visual Studio ]

For read this is in English visit http://devsmart.net/2009/change-the-mp3-file-details-using-net/

ඇත්තටම මට කරන්න අවෂය වූයේ මා සතු ඇති mp3 ඇල්බම් වල අනවෂය ලෙස සටහන්වී ඇති හා කිසිවක් නොවූ Title, Artist, Comments, සහ Album යන තොරතුරු නිවැරදි ලෙස සාදාගැනීමටයි. මම මුලින්ම කලේ ගොනුවේ නම නිවැරදිව සාදා ගැනීමයි. එය file Move ක්රuමය භාවිතා කර ලේසියෙන් rename කරගත හැකියි. පසුව මට ගොනුවේ නම Title ලෙස ‍පහසුවෙන් යෙදිය හැකියි නෙ. මම මෙය පහසුවෙන් කරගැනීමට UltraID3Lib කියන නොමිලයේ ලබාදෙන library එකක් භාවිතා කිරීමට සිදුවුනා. මෙය ඔබට http://home.fuse.net/honnert/hundred/?UltraID3Lib වෙතින් බාගත හැක.

ඒ වගේම System.IO සහ HundredMilesSoftware.UltraID3Lib යන references භාවිතා කර ලියූ method එක යි මේ.

private void setCustomPropertiesToMp3Files(string folder, string album, string artist)
{
    try
    {
        DirectoryInfo d = new DirectoryInfo(folder);
        if (d.Exists)
        {
            FileInfo[] myFiles = d.GetFiles();
            foreach (FileInfo item in myFiles)
            {
                if (item.Extension != ".mp3")
                    continue;
                UltraID3 u = new UltraID3();
                u.Read(item.FullName);

                u.Title = item.Name;
                u.Album = album;
                u.Artist = artist;
                u.Comments = "";
                u.Write();
            }
        }
        else
        {
            throw new Exception("Folder Path not Exists.");
        }
    }
    catch (Exception ex)
    {
        throw ex;
    }
}
  • Share/Bookmark


Popularity: 627 views
Tagged with: [ , ]
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.