ColdFyre's MP3 Finder/lister V .2 - ColdFyre Creations(CFC) - http://cfyre.myip.org
Script modified:"; echo date("F d Y H:i:s.", filemtime("/mp3/index.php")); ?>
read_tag() == true) { //$ID3=str_replace(" echo "

ID3V1 Info:

File : $mp3_file
"; echo "----------------------------------
"; echo "ID3v1 : $ID3->tag
"; echo "Title : $ID3->title
"; echo "Artist : $ID3->artist
"; echo "Album : $ID3->album
"; echo "Year : $ID3->year
"; echo "Comment : $ID3->comm
"; echo "Track : $ID3->track
"; echo "Genre : $ID3->genre
"; echo "----------------------------------
"; $handle=fopen($mp3_file,"rb"); fseek($handle,0); $c=0; while ($header != 11111111) { $header = fgets($handle,2); $header = decbin(hexdec(bin2hex($header))); $c++; } $c = $c-1; echo "

Breakdown of first valid frame:

Header found at ". ($c) ." bytes into file
Analysis of first 4 bytes:
11111111 Byte $c "." (bits ". ((($c+1)*8) -8) ." - " . ((($c+1)*8) -1).")
111
"; //bits 8-15 $block1 = fgets($handle,2); $block1 = decbin(hexdec(bin2hex($block1))); $mpegid = substr($block1,2,2); echo "$mpegid"; $layer = substr($block1,4,2); echo "$layer"; $crc = substr($block1,6,1); echo "$crc Byte ". ($c+1) ." (bits ". ((($c+2)*8) -8) ." - " . ((($c+2)*8) -1).")
"; //bits 16-23 $block2 = fgets($handle,2); $block2 = decbin(hexdec(bin2hex($block2))); $bitrate = substr($block2,0,4); echo "$bitrate"; $sample = substr($block2,4,2); echo "$sample"; $padding = substr($block2,5,1); echo "$padding"; $priv = substr($block2,6,1); echo "$priv Byte ". ($c+2) ." (bits ". ((($c+3)*8) -8) ." - " . ((($c+3)*8) -1).")
"; //bits 24-31 $block3 = fgets($handle,3); $block3 = decbin(hexdec(bin2hex($block3))); $channel = substr($block3,0,2); echo "$channel"; $mode = substr($block3,2,2); echo "$mode"; $copyright = substr($block3,5,1); echo "$copyright"; $original = substr($block3,4,1); echo "$original"; $emphasis = substr($block3,6,2); echo "$emphasis Byte ". ($c+3) ." (bits ". ((($c+4)*8) -8) ." - " . ((($c+4)*8)-1) .")
"; fclose($handle); if ($sample == "00") $sample = "44100"; if ($sample == "01") $sample = "48000"; if ($sample == "10") $sample = "32000"; if ($bitrate == "0001") $bitrate = "32"; if ($bitrate == "0010") $bitrate = "40"; if ($bitrate == "0011") $bitrate = "48"; if ($bitrate == "0100") $bitrate = "56"; if ($bitrate == "0101") $bitrate = "64"; if ($bitrate == "0110") $bitrate = "80"; if ($bitrate == "0111") $bitrate = "96"; if ($bitrate == "1000") $bitrate = "112"; if ($bitrate == "1001") $bitrate = "128"; if ($bitrate == "1010") $bitrate = "160"; if ($bitrate == "1011") $bitrate = "192"; if ($bitrate == "1100") $bitrate = "224"; if ($bitrate == "1101") $bitrate = "246"; if ($bitrate == "1110") $bitrate = "320"; if ($bitrate == "1111") $bitrate = "BAD"; if ($layer == "01") $layer = "I"; if ($layer == "10") $layer = "II"; if ($layer == "11") $layer = "III"; if ($mpegid == "00") $mpegid = "2.5"; if ($mpegid == "10") $mpegid = "2"; if ($mpegid == "11") $mpegid = "1"; if ($channel == "00") $channel = "Stereo"; if ($channel == "01") $channel = "Joint stereo"; if ($channel == "10") $channel = "Dual mono"; if ($channel == "11") $channel = "Mono"; if ($channel == "00") $channel = "Stereo"; if ($mode == "00") $mode = "Intensity stereo: off, MS Stereo:,off"; if ($mode == "01") $mode = "Intensity stereo: on, MS Stereo:off"; if ($mode == "10") $mode = "Intensity stereo: off, MS Stereo: on"; if ($mode == "11") $mode = "Intensity stereo: on, MS Stereo: on"; if ($emphasis == "00") $emphasis = "None"; if ($emphasis == "01") $emphasis = "50/15"; if ($emphasis == "11") $emphasis = "CCIT J.17"; echo "

Key:

Frame synchronizer"; echo "
MPEG Version - $mpegid"; echo "
Layer - $layer"; echo "
CRC bit - $crc"; echo "
Bitrate - $bitrate kbps"; echo "
Samplerate - $sample Hz"; echo "
Padding - $padding"; echo "
Private - $priv"; echo "
Channels - $channel"; echo "
Mode extension - $mode"; echo "
Copyright - $copyright"; echo "
Original - $original"; echo "
Emphasis - $emphasis
"; echo "
Bits marked as 0 are no/off whereas 1 is yes/on"; } else { echo "Error!"; } return 0; } echo "
Location = /$dir
"; if ($handle = opendir("/www/htdocs/mp3/Techno&Trance/$dir")) { while (false !== ($file = readdir($handle))) { //if (!stristr($file,"..")) { $filearray[$x]=$file; $x++; //} } } natsort($filearray); reset($filearray); closedir($handle); echo "

"; //pull out dirs and remove non mp3 $coun=0; echo "COUNT: ". count($filearray); while ($coun != count($filearray)) { $file = $filearray[$coun]; $file_link = $file; $dir_link = $dir; $file=str_replace("%20"," ",$file); $dir_link=str_replace("%20"," ",$dir); $file=str_replace(" ","%20",$file); $dir=str_replace(" ","%20",$dir); $file_size=filesize("/www/htdocs/mp3/Techno&Trance/$dir_link/$file_link"); if ((!strstr($file,".mp3")) && (filesize("/www/htdocs/mp3/Techno&Trance/$dir_link/$file_link") != 4096)){ array_splice($filearray,$coun,1); $coun--; } if (is_dir($file)) { $dirarray[$coun]=$file;} if (!is_file($file) && (!is_dir($file)) && ($file_size == 4096)) { $dirarray[$coun]=$file;} //if (is_file($file)) { //} $coun++; } sort($dirarray); reset($dirarray); $coun=0; while ($coun != count($dirarray)) { $file = $dirarray[$coun]; $file_link = $file; $file=str_replace("%20"," ",$file); echo " "; $coun++; } echo ""; $coun=0; while ($coun <= count($filearray)) { $file = $filearray[$coun]; $file_link = $file; $dir_link = $dir; $file=str_replace("%20"," ",$file); $dir_link=str_replace("%20"," ",$dir); $file=str_replace(" ","%20",$file); $dir=str_replace(" ","%20",$dir); $file_size=filesize("/www/htdocs/mp3/Techno&Trance/$dir_link/$file_link"); // if (is_dir($file)) { echo " [DIR] $file_link
";} //if (!is_file($file) && (!is_dir($file)) && ($file_size == 4096)) { echo " [DIR] $file_link
";} if (is_link($file)) { echo " [SYM] $file_link
";} if (is_file($file)) { echo "";} if (!is_file($file) && (!is_dir($file)) && ($file_size != 4096)) { echo " ";} $coun++; } echo "
[DIR] $file
[FILE]$file_link" . round(($file_size /1024/1024),2 )." MB[DETAILS]
[FILE] $file_link" . round(($file_size /1024/1024),2 )." MB[DETAILS]
"; $total=count($filearray) - count($dirarray); echo "
Files listed: $total Directories listed:" . (count($dirarray) - 2)."
"; return 0; class ID3v1x { var $file_name; var $tag; var $title; var $artist; var $album; var $year; var $comm; var $track; var $genre; function ID3v1x($inputfile) { $this->file_name = $inputfile; } function read_tag() { $file = fopen($this->file_name, "rb"); if($file == false) { return false; } else { fseek($file, -128, SEEK_END); $this->tag = fgets($file, 4); if($this->tag == 'TAG') { $this->title = fgets($file, 31); $this->artist = fgets($file, 31); $this->album = fgets($file, 31); $this->year = fgets($file, 5); $this->comm = fgets($file, 29); $this->temp = fgets($file, 2); $this->track = fgets($file, 2); $this->track = hexdec(bin2hex($this->track)); $this->genre = fgets($file, 2); $this->genre = hexdec(bin2hex($this->genre)); $genre_list = array("Blues","ClassicRock","Country","Dance","Disco","Funk","Grunge","HipHop","Jazz", "Metal","NewAge","Oldies","Other","Pop","R&B","Rap","Reggae","Rock","Techno", "Industrial","Alternative","Ska","DeathMetal","Pranks","Soundtrack","Euro-Techno", "Ambient","TripHop","Vocal","Jazz-Funk","Fusion","Trance","Classical","Instrumental", "Acid", "House", "Game", "SoundClip", "Gospel", "Noise", "Alt.Rock", "Bass", "Soul", "Punk", "Space", "Meditative", "InstrumentalPop", "InstrumentalRock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop/Folk", "Eurodance", "Dream", "SouthernRock", "Comedy", "Cult", "GangstaRap", "Top40", "ChristianRap", "Pop/Funk", "Jungle", "NativeAmerican", "Cabaret", "NewWave", "Psychedelic", "Rave", "Showtunes", "Trailer", "Lo-fi", "Tribal", "AcidPunk", "AcidJazz", "Polka", "Retro", "Musical", "Rock'n'Roll", "HardRock", "Folk", "Folk/Rock", "NationalFolk","Swing", "FastFusion", "Bebob", "Latin", "Revival", "Celtic", "BlueGrass", "AvantGarde", "GothicRock", "ProgressiveRock", "PsychedelicRock", "SymphonicRock", "SlowRock", "BigBand", "Chorus", "EasyListening", "Acoustic", "Humour", "Speech", "Chanson", "Opera", "ChamberMusic", "Sonata", "Symphony", "BootyBass", "Primus", "PornGroove", "Satire", "SlowJam", "Club", "Tango", "Samba", "Folklore", "Ballad", "PowerBallad", "RhythmicSoul", "Freestyle", "Duet", "PunkRock", "DrumSolo", "Euro-House", "DanceHall", "Goa", "Drum&Bass", "Club-House", "Hardcore", "Terror", "Indie", "BritPop", "Negerpunk", "PolskPunk", "Beat", "ChristianGangstaRap", "HeavyMetal", "BlackMetal", "Crossover", "ContemporaryChristian", "ChristianRock", "Merengue", "Salsa", "ThrashMetal","Anime","JPop","SynthPop"); $this->genre = @$genre_list[$this->genre]; return true; } else { $this->tag = 'No ID3 tag'; return true; } } fclose($file); } } ?>