Holladiewaldfee,
ich hatte da mal was für die Tipps&Tricks geschrieben, ist aber wohl untergegangen.
Ich darf Dir meinen Code einfach ungeniert hier hin klatschen, ohne Rücksicht auf Verluste?
------
<?php
$mysqldb = "mp3";
$mp3_dir = "d:\mp3\";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>mp3conv</title>
</head>
<body>
<table cellspacing=0 cellpadding=2 border=1>
<tr>
<th>Sontitel</th>
<th>Künstler</th>
<th>Album</th>
<th>Jahr</th>
<th>Kommentar</th>
<th>Track</th>
<th>Songtyp</th>
</tr>
<?php
@set_time_limit(0);
$mid = mysql_connect("localhost", "root", "");
mysql_select_db($mysqldb, $mid);
$id3 = Array();
$id3[0] = "Blues";
$id3[1] = "Classic Rock";
$id3[2] = "Country";
$id3[3] = "Dance";
$id3[4] = "Disco";
$id3[5] = "Funk";
$id3[6] = "Grunge";
$id3[7] = "Hip-Hop";
$id3[8] = "Jazz";
$id3[9] = "Metal";
$id3[10] = "New Age";
$id3[11] = "Oldies";
$id3[12] = "Other";
$id3[13] = "Pop";
$id3[14] = "R&B";
$id3[15] = "Rap";
$id3[16] = "Reggae";
$id3[17] = "Rock";
$id3[18] = "Techno";
$id3[19] = "Industrial";
$id3[20] = "Alternative";
$id3[21] = "Ska";
$id3[22] = "Death Metal";
$id3[23] = "Pranks";
$id3[24] = "Soundtrack";
$id3[25] = "Euro-Techno";
$id3[26] = "Ambient";
$id3[27] = "Trip-Hop";
$id3[28] = "Vocal";
$id3[29] = "Jazz+Funk";
$id3[30] = "Fusion";
$id3[31] = "Trance";
$id3[32] = "Classical";
$id3[33] = "Instrumental";
$id3[34] = "Acid";
$id3[35] = "House";
$id3[36] = "Game";
$id3[37] = "Sound Clip";
$id3[38] = "Gospel";
$id3[39] = "Noise";
$id3[40] = "AlternRock";
$id3[41] = "Bass";
$id3[42] = "Soul";
$id3[43] = "Punk";
$id3[44] = "Space";
$id3[45] = "Meditative";
$id3[46] = "Instrumental Pop";
$id3[47] = "Instrumental Rock";
$id3[48] = "Ethnic";
$id3[49] = "Gothic";
$id3[50] = "Darkwave";
$id3[51] = "Techno-Industrial";
$id3[52] = "Electronic";
$id3[53] = "Pop-Folk";
$id3[54] = "Eurodance";
$id3[55] = "Dream";
$id3[56] = "Southern Rock";
$id3[57] = "Comedy";
$id3[58] = "Cult";
$id3[59] = "Gangsta";
$id3[60] = "Top 40";
$id3[61] = "Christian Rap";
$id3[62] = "Pop/Funk";
$id3[63] = "Jungle";
$id3[64] = "Native American";
$id3[65] = "Cabaret";
$id3[66] = "New Wave";
$id3[67] = "Psychadelic";
$id3[68] = "Rave";
$id3[69] = "Showtunes";
$id3[70] = "Trailer";
$id3[71] = "Lo-Fi";
$id3[72] = "Tribal";
$id3[73] = "Acid Punk";
$id3[74] = "Acid Jazz";
$id3[75] = "Polka";
$id3[76] = "Retro";
$id3[77] = "Musical";
$id3[78] = "Rock & Roll";
$id3[79] = "Hard Rock";
// WINAMP-Extensions
$id3[80] = "Folk";
$id3[81] = "Folk-Rock";
$id3[82] = "National Folk";
$id3[83] = "Swing";
$id3[84] = "Fast Fusion";
$id3[85] = "Bebob";
$id3[86] = "Latin";
$id3[87] = "Revival";
$id3[88] = "Celtic";
$id3[89] = "Bluegrass";
$id3[90] = "Avantgarde";
$id3[91] = "Gothic Rock";
$id3[92] = "Progressive Rock";
$id3[93] = "Psychedelic Rock";
$id3[94] = "Symphonic Rock";
$id3[95] = "Slow Rock";
$id3[96] = "Big Band";
$id3[97] = "Chorus";
$id3[98] = "Easy Listening";
$id3[99] = "Acoustic";
$id3[100] = "Humour";
$id3[101] = "Speech";
$id3[102] = "Chanson";
$id3[103] = "Opera";
$id3[104] = "Chamber Music";
$id3[105] = "Sonata";
$id3[106] = "Symphony";
$id3[107] = "Booty Bass";
$id3[108] = "Primus";
$id3[109] = "Porn Groove";
$id3[110] = "Satire";
$id3[111] = "Slow Jam";
$id3[112] = "Club";
$id3[113] = "Tango";
$id3[114] = "Samba";
$id3[115] = "Folklore";
$id3[116] = "Ballad";
$id3[117] = "Power Ballad";
$id3[118] = "Rhythmic Soul";
$id3[119] = "Freestyle";
$id3[120] = "Duet";
$id3[121] = "Punk Rock";
$id3[122] = "Drum Solo";
$id3[123] = "A capella";
$id3[124] = "Euro-House";
$id3[125] = "Dance Hall";
function list_dir($dirname)
{
if($dirname[strlen($dirname)-1]!='\')
$dirname.='\';
static $result_array=array();
$handle=opendir($dirname);
while (false !== ($file = readdir($handle)))
{
if($file=='.'||$file=='..')
continue;
if(is_dir($dirname.$file))
list_dir($dirname.$file.'\');
else
$result_array[]=$dirname.$file;
}
closedir($handle);
return $result_array;
}
$ta = list_dir($mp3_dir);
for($i=0, $j=count($ta); $i<$j; $i++)
{
$fp = fopen($ta[$i], "rb");
fseek($fp, -128, SEEK_END);
$isid3 = fread($fp, 128);
if(substr($isid3, 0, 3)=="TAG")
{ $songtitle = str_replace("#", "", trim(substr($isid3, 3, 30)));
$artist = str_replace("#", "", trim(substr($isid3, 33, 30)));
$album = str_replace("#", "", trim(substr($isid3, 63, 30)));
$year = str_replace("#", "", trim(substr($isid3, 93, 4)));
$comment = str_replace("#", "", trim(substr($isid3, 97, 28)));
$track = ord(trim(substr($isid3, 126, 1)));
$songtype = (int)ord(trim(substr($isid3, 127, 1)));
echo "<tr><td>".$songtitle."</td><td>".$artist."</td><td>".$album."</td><td>".$year."</td><td>".$comment."</td><td>".$track."</td><td>".$id3[$songtype]."</td></tr>";
}
else
{ $ta2 = explode("-", basename($ta[$i]), 2);
$songtitle = str_replace("#", "", trim(substr($ta2[1],0,strlen($ta2[1])-4)));
$artist = str_replace("#", "", trim($ta2[0]));
if($songtitle == "")
{ $songtitle = $artist;
$artist = ""; }
$album = ""; $year = ""; $comment = ""; $track = ""; $songtype = "";
echo "<tr><td>".$songtitle."</td><td>".$artist."</td><td></td><td></td><td></td><td></td></tr>";
}
fclose($fp);
$query = "INSERT INTO mp3 VALUES ("", "".addslashes($songtitle)."", "".addslashes($artist)."", "".addslashes($album)."", "".addslashes($year)."", "".addslashes($comment)."", "".addslashes($track)."", "".addslashes($songtype)."", "".str_replace("#", "", addslashes(dirname($ta[$i])))."", "".str_replace("#", "", addslashes(basename($ta[$i])))."")";
mysql_query($query);
}
mysql_close();
?>
</table>
</body>
</html>
-------
Natürlich solltest Du ihn vorher noch an Deine Gegebenheiten anpassen ;-)
Ciao,
Harry
Man weiß erst was man hatte, wenn man es verloren hat.
Intelligenz ist nicht zwingend etwas positives.