Archived

This topic is now archived and is closed to further replies.

iamwithstupid

newbie question!!

Recommended Posts

iamwithstupid    326
just wondering what you guys thought was the quickest way to solve this problem: i need a program, which will scan a folder and then produce an ouput file of say the artist and then the title seperated by a -the title of the track, all the songs will be mp3's and the ouptut file will need to be a .inc! need any more information just post! thanks in advance [edited by - iamwithstupid on October 21, 2002 7:37:43 AM]

Share this post


Link to post
Share on other sites
Michalson    1657
It depends on how far you are and what you want to do.

For general information visit ID3.org.

The simplest one to read is version 1 of the ID3 tag (the information that is optionally attached to an MP3 file). It has a fixed structure that looks like this:

Tag: 3 characters
Title, Artist, Comment, Album: 30 characters each
Year: 4 characters
Genre: 1 unsigned byte


What you want to do is read that structure from the very end of the file, so from position FileSize-StructureSize. In order to check if the tag is present you see if the Tag element contains the characters "TAG". Reading ID3v2 tags is more complex and would suggest that you visit the website for a complete explanation.

Getting a list of MP3 files differs depending on what language you use. What you want to look for is a FindFirst and FindNext (or similarly named) function. Your code would then look like this:


Result=FindFirst("c:\folder\*.mp3",SearchRecord)
while Result=True
Save SearchRecord information
Result=FindNext(SearchRecord)


Now what do you actually want to do with this? If you want to generate music lists then use Winamp or any number of customizable programs from download.com. If you want to rename all your files to match the tags (such as rename them all to "Artist - Track Name.mp3") then there are already existing free tools to do that.

[edited by - michalson on October 21, 2002 8:39:43 AM]

Share this post


Link to post
Share on other sites
iamwithstupid    326
Thanks Michalson but i don''t want to read the tags from the mp3''s. The file name already contains the artist and song name. I simply want to scan all the files that are in that folder and then produce an output .inc file to be read by a php script. Effectively making an array, without me typing in all of the tracks manually into the array.

Thanks again Michalson
anyone got suggestions?
thanks in advance!!

Share this post


Link to post
Share on other sites
SabreMan    504
What exactly''s the problem? Use a scripting language for the task, such as Python. List the directory contents using os.listdir(), and use string processing functions to manipulate the returned strings into the format you require before writing to an output file.

Share this post


Link to post
Share on other sites
Cyberdrek    100
quote:
Original post by iamwithstupid
Thanks Michalson but i don''t want to read the tags from the mp3''s. The file name already contains the artist and song name. I simply want to scan all the files that are in that folder and then produce an output .inc file to be read by a php script. Effectively making an array, without me typing in all of the tracks manually into the array.

Thanks again Michalson
anyone got suggestions?
thanks in advance!!


Just for your information, extension aren''t taken into consideration when working with PHP.


[Cyberdrek | the last true sorcerer | Spirit Mage - mutedfaith.com]

Share this post


Link to post
Share on other sites