Solved: mp3 sorting

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

doomlord289

Thread Starter
Joined
Nov 1, 2005
Messages
192
My friend has a lot of his CDs backed up on his computer in a single folder. He recently decided he wanted to file this in subfolders first by artist, then by album. He asked me if I could write a program to do this, but I have no idea how I would go about doing this. So my question is this:
Is there a way, using any programming language, to:

1. Get the artist info from an mp3 file
2. Create a folder with the artist name using that data
3. Move that file to the new folder
4. Get the album info from an mp3 file
5. Create a folder with the album name using that data
6. Move that file to the new folder
7. Have the program loop until there are no more mp3 files in the original folder

I know C++ and some DOS so those would be best, but I will learn a new programming language if I must.
 
Joined
Dec 7, 2005
Messages
146
hi
just a suggestion. you can do it in Perl. i did mine in unix env. the minimalistic code below is done in unix, but you can do it in windows env too..just get Perl for windows and the necessary package. Activestate perl is quite popular so you can give it a try.

#!/usr/bin/perl
use MP3::Info; # package downloaded from CPAN
use File::Copy 'move';
my $dir = q(/somedir/path);
chdir($dir);
while( <*mp3> )
{
my $file = $_;
my $info = get_mp3tag($file);
my $artist = $info->{ARTIST} ;
#my $album = $info->{ALBUM};
#my $title = $info->{TITLE};
-d $artist or mkdir($artist,0744);
move($file , $artist);
}

of course, there are other ways to do it, in batch, in VB, in C++, Java etc ...somebody else have to come up with it...:)
 

doomlord289

Thread Starter
Joined
Nov 1, 2005
Messages
192
thanks for the script, but I'd like it in dos or c++, or something for windows
 

Squashman

Retired Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
You can run perl with ActiveState on Windows. I am sure you could probably do it with Cygwin as well but I haven't looked.
 

doomlord289

Thread Starter
Joined
Nov 1, 2005
Messages
192
ok thanks, but i'd still like some other language if someone could think of it.
 
Joined
Dec 7, 2005
Messages
146
doomlord289 said:
I know C++ and some DOS so those would be best, but I will learn a new programming language if I must.
since you know C++ , you can also "translate" the Perl script into C++ code. Except now , you have to get yourself a C++ class that helps you read the MP3 header information , or you could code the class yourself but then you must know the MP3 header specifications, etc etc..sorry, can't help you with C++ here.

so good luck
 

doomlord289

Thread Starter
Joined
Nov 1, 2005
Messages
192
thanks squashman

I'll still need to write my own when the trial runs out though.:(
 

Squashman

Retired Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
Just talked with someone today and they said iTunes can do this as well.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top