Total members 11894 |It is currently Fri Nov 22, 2024 2:56 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Read ID3 tags
Code:

 
 
//Reads ID3v1 from a MP3 file and displays it
 
 
     
$mymp3 "mymusic.mp3"//MP3 file to be read
 
                 //make a array of genres
     
$genre_arr = array("Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge",
 
"Hip-Hop","Jazz","Metal","New Age","Oldies","Other","Pop","R&B",
 
"Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska",
 
"Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient",
 
"Trip-Hop","Vocal","Jazz+Funk","Fusion","Trance","Classical",
 
"Instrumental","Acid","House","Game","Sound Clip","Gospel",
 
"Noise","AlternRock","Bass","Soul","Punk","Space","Meditative",
 
"Instrumental Pop","Instrumental Rock","Ethnic","Gothic",
 
"Darkwave","Techno-Industrial","Electronic","Pop-Folk",
 
"Eurodance","Dream","Southern Rock","Comedy","Cult","Gangsta",
 
"Top 40","Christian Rap","Pop/Funk","Jungle","Native American",
 
"Cabaret","New Wave","Psychadelic","Rave","Showtunes","Trailer",
 
"Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro",
 
"Musical","Rock & Roll","Hard Rock","Folk","Folk-Rock",
 
"National Folk","Swing","Fast Fusion","Bebob","Latin","Revival",
 
"Celtic","Bluegrass","Avantgarde","Gothic Rock","Progressive Rock",
 
"Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band",
 
"Chorus","Easy Listening","Acoustic","Humour","Speech","Chanson",
 
"Opera","Chamber Music","Sonata","Symphony","Booty Bass","Primus",
 
"Porn Groove","Satire","Slow Jam","Club","Tango","Samba",
 
"Folklore","Ballad","Power Ballad","Rhythmic Soul","Freestyle",
 
"Duet","Punk Rock","Drum Solo","Acapella","Euro-House","Dance Hall");
     
     
$filesize filesize($mymp3);
     
$myfile fopen("mymusic.mp3""r");
     
fseek($myfile, -128SEEK_END);
     
     
$tag fread($myfile3);
     
     
     if(
$tag == "TAG")
     {
         
$myDataSong["song"] = trim(fread($myfile30));
         
$myDataSong["artist"] = trim(fread($myfile30));
         
$myDataSong["album"] = trim(fread($myfile30));
         
$myDataSong["year"] = trim(fread($myfile4));
         
$myDataSong["comment"] = trim(fread($myfile30));
         
$myDataSong["genre"] = $genre_arr[ord(trim(fread($myfile1)))];
         
     }
     else
         die(
"MP3 file does not have any ID3 tag!");
     
     
fclose($myfile);
     
     while(list(
$key$value) = each($myDataSong))
     {
         print(
"$key: $value<br>\r\n");    
     }
     
 




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Read ID3 tag
 Read csv file     -  
 read from file in C++     -  
 Read the content from directory     -  
 File write read     -  
 read email inbox ASP     -  
 File read by char     -  
 read from command line     -  
 read file in matlab     -  
 javascript read file     -  
 Read stream from URL using Java     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com