• A Great friend to the HardForum with a great kid that he is trying to get a scholorship to continue his schooling. Please give hime a vote! Only 24 hours left! Thanks.
    If you have an VOTE FOR KEENAN!

Need some batch file help

sparky3009

Gawd
Joined
Jan 5, 2006
Messages
530
Ok, so I have a website with a media player on it. To make a playlist, I need to use an xml file.

Since I don't want to make the playlist by handwriting everything... I want to make a batch file that I can drag and drop mp3 or flv files onto and have it append that to the xml file.

The format for the xml file is like this:
Code:
<?xml version='1.0' encoding='UTF-8' ?>

<playlist version='1' xmlns='http://xspf.org/ns/0/'>
	<trackList>
		<track>
			<creator>[ARTIST]</creator>
			<title>[SONG NAME]</title>
			<location>[WEB LINK TO FILE]</location>
			<image>[WEB LINK TO IMAGE IF IT'S NOT A VID]</image>
		</track>
	</trackList>
</playlist>

I'm not asking anyone to write the batch file for me... I just have NO idea where to start. Plus my scripting teacher didn't really teach me anything... luckily we didn't have a final in that class.

I don't need it to insert the image link... I want it to do that eventually, but I don't want to make a huge project out of it and then never finish it because it's overwhelming.

The things I need to know I guess are:
*how to have it add the <track> to </track> parts in between <tracklist> and </tracklist>
*how to use a variable for the file names, because all the files are in the same web directory, I just don't know how to make it add the file name (I would be using the batch file with files on my computer to get the names, then putting them in the web directory online, so I have the files on my hdd to drag/drop onto the batch file).
*the syntax to append static information to the xml file
*that's actually all I can think of for now, but I might get stuck down the road
Or if someone has a better way to do this than a batch file.....
 
you're not going to be able to do that with a batch file very easily, the windows batch interpreter is quite shitty.

I'm not sure if drag and drop is doable with many scripts
 
you're not going to be able to do that with a batch file very easily, the windows batch interpreter is quite shitty.

I'm not sure if drag and drop is doable with many scripts

BOO! Any suggestion for an easier way to do it? Other than write the XML by hand.
 
There are some php scripts out there for doing exactly this....There is a prepackaged one that can even pull the mp3s image from the ID3 tag info if it exists. You should really look into that.

http://sourceforge.net/projects/php-xspf-gen/

Bonus of the PHP is that you never have to run it, the php file can be the playlist location and will run automatically each time you visit the page. For some odd reason it would not be recognized by the swf if named generator.php, but is if named generator2.php (for me).

Pretty sure that one is for the OLD xspf player and not JW player, so you would have to edit it....

HERE http://www.trbailey.net/xspf/
Is another one, although you should be able to google xspf or jw player and PHP to find many more.
 
Back
Top