LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 August 27 2010

Xsever
Member

Song Tag Title to Filename

Hello everyone,

It's been a while I know, but that's because I was in Lebanon.

Anyway, back to the point.

I am trying to find a software that will automatically (batch) replace the filename of a song by its title which is contained in its tag information.

I use mp3tag and TagScanner, but both of them do not seem to have such a feature. I did a Google search wihtout valuable findings.

I would really appreciate your help.

Thanks,

Offline

#2 August 27 2010

xterm
Moderator

Re: Song Tag Title to Filename

See if this helps in any way.

http://musicbrainz.org/

Alternatively, if you're a programmer and would like to do it manually, such a task is easily accomplished.

If you're a C++ developer use TagLib, if you're a .NET/Mono developer use TagLib#

If you need some assistance, let me know.

Last edited by xterm (August 27 2010)

Offline

#3 August 27 2010

xterm
Moderator

Re: Song Tag Title to Filename

I got curious so i gave it a shot myself. Works like a charm. Tried it on Mono given that i dont know the operating system you use. There are billions ways you can improve it.

	class MainClass
	{
		public static void Main (string[] args)
		{
			try{
				DirectoryInfo location = new DirectoryInfo(@"c:\mp3");
				foreach(var entry in location.GetFiles()){
					TagLib.File music_file = TagLib.File.Create(entry.FullName);
					entry.MoveTo(music_file.Tag.Title + entry.Extension);
				}
			}catch(Exception ex){
				Console.WriteLine (ex.Message);
			}
		}
	}

Last edited by xterm (August 28 2010)

Offline

#4 August 28 2010

Xsever
Member

Re: Song Tag Title to Filename

Hello xterm,

Let me thank you first of all for your effort.

I know some very basic C++ since I am an Engineering Student. I took it from a numerical method solving-point so I basically do not know it.

In which language is the code you have written? I tried compiling it as C++, but it gave me an error.

Could you please help me try this?

Thanks,

Offline

#5 August 28 2010

xterm
Moderator

Re: Song Tag Title to Filename

It's C#

I just noticed your signature.

P.S.: If you don't want to go through all this trouble and you trust me ;) I could build it as an application for you and send you the binaries. Though i do think it's a good exercise for you to try.

Please follow these installation instructions:

1- Download and install GTK#
2- Download and install MonoDevelop
3- You don't need to install .NET 3.5 given that it comes with W7 by default.
4- Download the following library and extract it to your disk

Please follow these implementation instructions:

1- Run MonoDevelop
2- File > New > Solution
3- Select the C# node in the tree and select the console application.
4- Type in the location you wish to store the solution in
5- Type "Client" in the Name box and TitleToTag in the solution name box then hit Forward.
6- Skip the additional features (don't select any) and click finish.
7- Within the solution explorer on the left, expand the Solution and the Project (Client).
8- Right Click References then hit Edit References.
9- Select the .NET Assemblies tab in the window that popped out and navigate to the folder where you extracted the library you downloaded in the previous part. Navigate to the Libraries folder within that folder and select the taglib-sharp.dll file then hit "Add" to the right.
10- Now that your setup is complete, double click on Main.cs in the solution explorer to open up the file then replace its content with the following:

using System;
using TagLib;
using System.IO;

namespace Client
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			try{
				DirectoryInfo location = new DirectoryInfo(args[0]);
				foreach(var entry in location.GetFiles()){
					TagLib.File music_file = TagLib.File.Create(entry.FullName);
					Console.WriteLine (music_file.Tag.Title);
                                        if(music_file.Tag.Title != null && !music_file.Tag.Title.Equals(String.Empty))
					           entry.MoveTo(args[1] + music_file.Tag.Title + entry.Extension);
				}
			}catch(Exception ex){
				Console.WriteLine (ex.Message);
			}
		}
	}
}

11- Save the file, and hit F8 to build.
12- If all goes well, open up a command prompt and navigate to your project location, specifically to the bin\debug folder.
13- There should be a file called Client.exe available now that you can use with the following command:

Client c:\mypath\to\mp3\folder c:\path\to\output\location

Notes

1- Make sure you copy a few songs to a test folder and use that folder for your test.
2- If this works out for you on the test, reply back and i'll update the code for you to handle sub folders and such.

Last edited by xterm (August 28 2010)

Offline

#6 August 28 2010

rolf
Member

Re: Song Tag Title to Filename

Xsever, if you have PHP installed, I can also write a quick PHP snipped that would do this. It can also be done using WScript, in which case you will only need to install a com object to handle ID3 tags (assuming you're on Windows). example:
http://www.promixis.com/forums/archive/ … 10587.html
If you're on Linux, it can probably be done in bash, using things such as awk, sed, grep...

Offline

#7 August 28 2010

Georges
Member

Re: Song Tag Title to Filename

Or you can get MediaMonkey. It does the job for you.

I can send you the MediaMonkey Gold Serial if you want too. (PM me for that).

Offline

#8 August 28 2010

Bassem
Member

Re: Song Tag Title to Filename

Tagscanner. Perfect. I use it for all my music, it's extremely powerful for batch operations. You can set any kind of naming criteria.

Here's the homepage. It's freeware:
http://www.tucows.com/preview/341611

Offline

#9 August 28 2010

Xsever
Member

Re: Song Tag Title to Filename

@ Bassem

How can I do what I want to do in TagScanner? I have it and I use it, but I can't find a way to replace the filename by the song's tag title.

Please let me know.


@ Others

I will provide feedback on your methods as soon as I have time. Since I have TagScanner installed, I will see if it can do the task for me.

Last edited by Xsever (August 28 2010)

Offline

#10 August 28 2010

darkredbbb
Member

Re: Song Tag Title to Filename

Tag&Rename http://www.softpointer.com/tr.htm
I use it on Windows, it's really good.

Offline

#11 August 28 2010

Xsever
Member

Re: Song Tag Title to Filename

Tag&Rename did the job. Do you a serial for it that you can PM me?

Thanks,

Offline

#12 August 28 2010

Xsever
Member

Re: Song Tag Title to Filename

I found a way to do it in TagScanner! Thanks a lot everyone.

@xterm

Please let me know if you would still want me to test and provide feedback for your code.

Thank you!

Offline

#13 August 28 2010

Bassem
Member

Re: Song Tag Title to Filename

Xsever wrote:

I found a way to do it in TagScanner!

Good to hear. You can also set album art and other metadata in batches, turn all caps into normal text, etc.

Offline

#14 August 28 2010

xterm
Moderator

Re: Song Tag Title to Filename

Xsever wrote:

I found a way to do it in TagScanner! Thanks a lot everyone.

@xterm

Please let me know if you would still want me to test and provide feedback for your code.

Thank you!

No no, i glad you found a way. My code works.

Offline

#15 August 28 2010

Xsever
Member

Re: Song Tag Title to Filename

Thanks a lot guys !

Offline

Board footer