So I made this program last night while I was talking with TDurden. I should've been doing my homework...but...yeah....
[url]http://www.thesarcasm.com/Music.html[/url]
Code:import java.util.*; import java.io.*; import org.farng.mp3.*; import org.farng.mp3.id3.*; import org.farng.mp3.lyrics3.*; public class MP3HTML { public static BufferedWriter out; public static void main(String[] args) throws IOException, TagException { Scanner in = new Scanner(new File("All.m3u")); String newIn = "", artist = "", title = ""; int progress = 0, total = 0; out = new BufferedWriter( new PrintWriter( new FileWriter( new File("Music.html")))); MP3Class mp3; ID3v1 id3v1 = new ID3v1(); ID3v2_2 id3v2_2 = new ID3v2_2(); ID3v2_3 id3v2_3 = new ID3v2_3(); ID3v2_4 id3v2_4 = new ID3v2_4(); writeHeader(); while(in.hasNext()){in.nextLine(); total++;} in = new Scanner(new File("All.m3u")); while(in.hasNext()) { mp3 = new MP3Class(in.nextLine()); if(mp3.getType() == 1) { try {id3v1 = new ID3v1(new RandomAccessFile(mp3.getLocation(), "r"));} catch (Exception e) {writeSong("Broken Tag", "Broken Tag");} try {writeSong(id3v1.getLeadArtist(), id3v1.getSongTitle());} catch (Exception e) {writeSong("Broken Tag", "Broken Tag");} } else if(mp3.getType() == 22) { try {id3v2_2 = new ID3v2_2(new RandomAccessFile(mp3.getLocation(), "r"));} catch (Exception e) {writeSong("Broken Tag", "Broken Tag");} try {writeSong(id3v2_2.getLeadArtist(), id3v2_2.getSongTitle());} catch (Exception e) {writeSong("Broken Tag", "Broken Tag");} } else if(mp3.getType() == 23) { try {id3v2_3 = new ID3v2_3(new RandomAccessFile(mp3.getLocation(), "r"));} catch (Exception e) {writeSong("Broken Tag", "Broken Tag");} try {writeSong(id3v2_3.getLeadArtist(), id3v2_3.getSongTitle());} catch (Exception e) {writeSong("Broken Tag", "Broken Tag");} } else if(mp3.getType() == 24) { try {id3v2_4 = new ID3v2_4(new RandomAccessFile(mp3.getLocation(), "r"));} catch (Exception e) {writeSong("Broken Tag", "Broken Tag");} try {writeSong(id3v2_4.getLeadArtist(), id3v2_4.getSongTitle());} catch (Exception e) {writeSong("Broken Tag", "Broken Tag");} } System.out.println(progress + "/" + total); progress++; } writeFooter(); out.close(); } public static void writeHeader() throws IOException { out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD Xhtml 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); out.write("<html>"); out.newLine(); out.write("\t<head>"); out.newLine(); out.write("\t\t<title>TheSarcasm.com - I rule</title>"); out.newLine(); out.write("\t\t<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" media=\"screen\" />"); out.newLine(); out.write("\t</head>"); out.newLine(); out.newLine(); out.write("<style type=\"text/css\">"); out.newLine(); out.write("*"); out.newLine(); out.write("{"); out.newLine(); out.write("\tpadding: 0;"); out.newLine(); out.write("\tmargin: 0;"); out.newLine(); out.write("}"); out.newLine(); out.write("body"); out.newLine(); out.write("{"); out.newLine(); out.write("\tbackground: #000000;"); out.newLine(); out.write("\ttext-align: center;"); out.newLine(); out.write("\tfont-size: 100%;"); out.newLine(); out.write("}"); out.newLine(); out.write("div"); out.newLine(); out.write("{"); out.newLine(); out.write("\ttext-align: left;"); out.newLine(); out.write("}"); out.newLine(); out.write("a"); out.newLine(); out.write("{"); out.newLine(); out.write("\ttext-decoration: none;"); out.newLine(); out.write("\tcolor: #00ffff;"); out.newLine(); out.write("\tfont: .6em Verdana,sans-serif;"); out.newLine(); out.write("}"); out.newLine(); out.write("a:hover"); out.newLine(); out.write("{"); out.newLine(); out.write("\ttext-decoration: underline;"); out.newLine(); out.write("}"); out.newLine(); out.write("#wrapper"); out.newLine(); out.write("{"); out.newLine(); out.write("\tmargin: 0 auto;"); out.newLine(); out.write("\twidth: 779px;"); out.newLine(); out.write("\tbackground-image: url(http://www.thesarcasm.com/images/body.jpg);"); out.newLine(); out.write("\tbackground-repeat: repeat-y;"); out.newLine(); out.write("}"); out.newLine(); out.write("#header"); out.newLine(); out.write("{"); out.newLine(); out.write("\tbackground: url(http://www.thesarcasm.com/images/head.jpg);"); out.newLine(); out.write("\theight: 198px;"); out.newLine(); out.write("\tbackground-repeat: repeat-y;"); out.newLine(); out.write("}"); out.newLine(); out.write("#main"); out.newLine(); out.write("{"); out.newLine(); out.write("\tfloat: left;"); out.newLine(); out.write("\twidth: 629px;"); out.newLine(); out.write("\tbackground: transparent;"); out.newLine(); out.write("}"); out.newLine(); out.write("#main p"); out.newLine(); out.write("{"); out.newLine(); out.write("\tfont: 0.7em Verdana,sans-serif;"); out.newLine(); out.write("\tcolor: #ffffff;"); out.newLine(); out.write("\tline-height: 1.7em;"); out.newLine(); out.write("\tmargin: .5em 100px .5em 100px;"); out.newLine(); out.write("}"); out.newLine(); out.write("#main a"); out.newLine(); out.write("{"); out.newLine(); out.write("\tcolor: #00ffff;"); out.newLine(); out.write("}"); out.newLine(); out.write("#main img"); out.newLine(); out.write("{"); out.newLine(); out.write("\tmargin-left: 10px;"); out.newLine(); out.write("\tpadding: 2px;"); out.newLine(); out.write("}"); out.newLine(); out.write("#sidebar"); out.newLine(); out.write("{"); out.newLine(); out.write("\tfloat: right;"); out.newLine(); out.write("\twidth: 150px;"); out.newLine(); out.write("\tpadding: 0 0 1em 0;"); out.newLine(); out.write("\tbackground: transparent;"); out.newLine(); out.write("}"); out.newLine(); out.write("#sidebar li"); out.newLine(); out.write("{"); out.newLine(); out.write("\tmargin: 0 .2 0 0em;"); out.newLine(); out.write("\tpadding: 2px 0 0 .5em;"); out.newLine(); out.write("\tlist-style-type: none;"); out.newLine(); out.write("}"); out.newLine(); out.write("#sidebar a"); out.newLine(); out.write("{"); out.newLine(); out.write("\ttext-align: right;"); out.newLine(); out.write("\tcolor: #00ffff;"); out.newLine(); out.write("\tfont: .6em Verdana,sans-serif;"); out.newLine(); out.write("}"); out.newLine(); out.write("#sidebar p"); out.newLine(); out.write("{"); out.newLine(); out.write("\ttext-align: left;"); out.newLine(); out.write("\tpadding: 2px 0 0 .0;"); out.newLine(); out.write("\tcolor: #ffffff;"); out.newLine(); out.write("\tfont: .8em Verdana,sans-serif;"); out.newLine(); out.write("}"); out.newLine(); out.write("#footer"); out.newLine(); out.write("{"); out.newLine(); out.write("\tclear: both;"); out.newLine(); out.write("\tmargin: 0 auto;"); out.newLine(); out.write("\tpadding: .5em;"); out.newLine(); out.write("\ttext-align: center;"); out.newLine(); out.write("\tbackground-image: url(http://www.thesarcasm.com/images/foot.jpg);"); out.newLine(); out.write("\theight: 24px;"); out.newLine(); out.write("}"); out.newLine(); out.write("#footer a"); out.newLine(); out.write("{"); out.newLine(); out.write("\tfont: .6em Verdana,sans-serif;"); out.newLine(); out.write("\tcolor: #00ffff;"); out.newLine(); out.write("}"); out.newLine(); out.write("#footer p"); out.newLine(); out.write("{"); out.newLine(); out.write("\tfont: .6em Verdana,sans-serif;"); out.newLine(); out.write("\tcolor: #ffffff;"); out.newLine(); out.write("}"); out.newLine(); out.write("</style>"); out.newLine(); out.write("\t<body>"); out.newLine(); out.write("\t\t<br /><br />"); out.newLine(); out.write("\t\t<div id=\"wrapper\">"); out.newLine(); out.write("\t\t<div id=\"header\">"); out.newLine(); out.write("\t\t\t<p align=\"center\"><br />"); out.newLine(); out.write("\t\t\t\t<img src=\"images/front.jpg\" />"); out.newLine(); out.write("\t\t\t</p>"); out.newLine(); out.write("\t\t</div>"); out.newLine(); out.write("\t\t<div id=\"main\"><br /><br />"); out.newLine(); out.write("\t\t\t<center>"); out.newLine(); out.write("\t\t\t\t<TABLE BORDER=\"1\">"); out.newLine(); out.write("\t\t\t\t<TR>"); out.newLine(); out.write("\t\t\t\t<TD ALIGN=\"center\"><p>Artist</p></TD>"); out.newLine(); out.write("\t\t\t\t<TD ALIGN=\"center\"><p>Title</p></TD>"); out.newLine(); out.write("\t\t\t\t</TR>"); out.newLine(); } public static void writeSong(String artist, String title) throws IOException { out.write("\n"); out.write("\t\t\t\t<TR>"); out.newLine(); out.write("\t\t\t\t<TD ALIGN=\"center\"><p>" + artist + "</p></TD>"); out.newLine(); out.write("\t\t\t\t<TD ALIGN=\"center\"><p>" + title + "</p></TD>"); out.newLine(); out.write("\t\t\t\t</TR>"); out.newLine(); } public static void writeFooter() throws IOException { out.write("</TABLE>"); out.newLine(); out.write("</center>"); out.newLine(); out.write("<br /><br />"); out.newLine(); out.write("</div>"); out.newLine(); out.write("<div id=\"footer\">"); out.newLine(); out.write("<a href=\"http://www.thesarcasm.com\">A Cock In Everyone's Mouth</a><br />"); out.newLine(); out.write("<a href=\"http://www.whitepaperclip.com\">WPC Productions</a>"); out.newLine(); out.write("</DIV>"); out.newLine(); out.write("</div>"); out.newLine(); out.write("<br /><br />"); out.newLine(); out.write("</body>"); out.newLine(); out.write("</html>"); out.newLine(); } }



