Actually what I need to do,
I have some music albums downloaded from Internet. Those files contain some unwanted things or blank on the Title, Artist, Comments, and Album tags. So I need to put correct/real information to these files. So first I have renamed properly files using file Move functionality in programming language. So after that I can put name as a Title easily. I’m using extra library UltraID3Lib and it is free. You can download it from http://home.fuse.net/honnert/hundred/?UltraID3Lib.
I have used System.IO and HundredMilesSoftware.UltraID3Lib references and this is the sample method I have used.

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

1 Comment for this entry

Leave a Reply

Copyright © 2009 DevSmart(BlogReader r). Running on Wordpress | Theme by itx.