theres things you need to keep in mind!
the input file has to be in the following format:
Code: Select all
/flam_player/mp3/Amy Holland - She's On Fire.mp3
/flam_player/mp3/Angel City - Back In Time.mp3
/flam_player/mp3/Angel City - Calling You.mp3
Code: Select all
<song src="../../../../flam_player/mp3/Above & Beyond - Alone Tonight.mp3">
here's the code if you want to make any changes to it. for example i had to adjust the "new line" at end of file, because flashchat is gay and it fucks up when its missing new line or if theres too many new lines.
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void std_err(void) {
perror("\nError");
exit(1);
}
int main(int argc, char *argv[]) {
FILE *fd,
*fdo;
char buff[1000],
*p,
*title,
*artist;
if(argc < 3) {
printf("\n"
"Usage: %s <music.txt> <output.XML>\n"
"\n", argv[0]);
exit(1);
}
fd = fopen(argv[1], "rb");
if(!fd) std_err();
fdo = fopen(argv[2], "wb");
if(!fd) std_err();
fprintf(fdo,
"<?xml version=\"1.0\"?>\r\n"
"<main>\r\n");
while(fgets(buff, sizeof(buff), fd)) {
for(p = buff; *p && (*p != '\n') && (*p != '\r'); p++);
*p = 0;
if(!buff[0]) continue;
fprintf(fdo,
"\t<song src=\"../../../..%s\">\r\n",
buff);
title = "";
artist = "";
p = strstr(buff, " - ");
if(!p) p = strstr(buff, "_-_");
if(p) {
*p = 0;
title = p + 3;
p = strrchr(title, '.');
if(p) *p = 0;
p = strrchr(buff, '/');
if(p) artist = p + 1;
}
fprintf(fdo,
"\t\t<title>%s</title>\r\n"
"\t\t<artist>%s</artist>\r\n"
"\t\t<genre></genre>\r\n"
"\t\t<duration></duration>\r\n"
"\t</song>\r\n",
artist,
title);
}
fprintf(fdo, "\r\n\r\n</main>");
fclose(fd);
fclose(fdo);
printf("- done\n");
return(0);
}
Anyways, thanks Luigi