Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Zczytywanie tagow z plikow mp3
Forum PHP.pl > Forum > Gotowe rozwiązania > Szukam
krzyzak_p
Czy zna ktos moze jakas biblioteke/skrypt, ktore mozna by uzyc do zczytywania tagow (tytul, wykonawaca, rok, typ itd) z plikow mp3?
Chcialem stworzyc w jakis madry sposob tabelke z mp3, gdzie by byly te dane, a duzo wygodniej jest to zczytywac z tagow niz z tytulow plikow...
revyag
Temat: Klasa FileMagick 130
bim2
  1. <?
  2.  $id3v1_generes = array('Blues', 'Classic Rock', 'Country', 'Dance', 'Disco', 'Funk', 'Grunge',
  3.  'Hip-Hop', 'Jazz', 'Metal', 'New Age', 'Oldies', 'Other', 'Pop', 'R&B',
  4.  'Rap', 'Reggae', 'Rock', 'Techno', 'Industrial', 'Alternative', 'Ska',
  5.  'Death Metal', 'Pranks', 'Soundtrack', 'Euro-Techno', 'Ambient', 'Trip-Hop',
  6.  'Vocal', 'Jazz+Funk', 'Fusion', 'Trance', 'Classical', 'Instrumental',
  7.  'Acid', 'House', 'Game', 'Sound Clip', 'Gospel', 'Noise', 'Alt. Rock',
  8.  'Bass', 'Soul', 'Punk', 'Space', 'Meditative', 'Instrumental Pop',
  9.  'Instrumental Rock', 'Ethnic', 'Gothic', 'Darkwave', 'Techno-Industrial',
  10.  'Electronic', 'Pop-Folk', 'Eurodance', 'Dream', 'Southern Rock', 'Comedy',
  11.  'Cult', 'Gangsta Rap', 'Top 40', 'Christian Rap', 'Pop/Funk', 'Jungle',
  12.  'Native American', 'Cabaret', 'New Wave', 'Psychedelic', 'Rave', 'Showtunes',
  13.  'Trailer', 'Lo-Fi', 'Tribal', 'Acid Punk', 'Acid Jazz', 'Polka', 'Retro',
  14.  'Musical', 'Rock & Roll', 'Hard Rock', 'Folk', 'Folk/Rock', 'National Folk',
  15.  'Swing', 'Fast-Fusion', 'Bebob', 'Latin', 'Revival', 'Celtic', 'Bluegrass',
  16.  'Avantgarde', 'Gothic Rock', 'Progressive Rock', 'Psychedelic Rock',
  17.  'Symphonic Rock', 'Slow Rock', 'Big Band', 'Chorus', 'Easy Listening',
  18.  'Acoustic', 'Humour', 'Speech', 'Chanson', 'Opera', 'Chamber Music', 'Sonata',
  19.  'Symphony', 'Booty Bass', 'Primus', 'Porn Groove', 'Satire', 'Slow Jam',
  20.  'Club', 'Tango', 'Samba', 'Folklore', 'Ballad', 'Power Ballad', 'Rhythmic Soul',
  21.  'Freestyle', 'Duet', 'Punk Rock', 'Drum Solo', 'A Cappella', 'Euro-House',
  22.  'Dance Hall', 'Goa', 'Drum & Bass', 'Club-House', 'Hardcore', 'Terror', 'Indie',
  23.  'BritPop', 'Negerpunk', 'Polsk Punk', 'Beat', 'Christian Gangsta Rap', 'Heavy Metal',
  24.  'Black Metal', 'Crossover', 'Contemporary Christian', 'Christian Rock', 'Merengue',
  25.  'Salsa', 'Trash Metal', 'Anime', 'JPop', 'Synthpop');
  26.  $fd = fopen('Dreamfall.mp3', 'r');
  27. fseek($fd, -128, SEEK_END);
  28. $id3v1tag = fread($fd, 128);
  29.  
  30. if (substr($id3v1tag, 0, 3) == 'TAG')
  31. {
  32. $v1['title']  = trim(substr($id3v1tag, 3, 30));
  33. $v1['artist'] = trim(substr($id3v1tag, 33, 30));
  34. $v1['album']  = trim(substr($id3v1tag, 63, 30));
  35. $v1['year'] = trim(substr($id3v1tag, 93, 4));
  36. $v1['comment'] = substr($id3v1tag, 97, 30);
  37. $v1['genreid'] = intval(ord(substr($id3v1tag, 127, 1)));
  38. if (($id3v1tag{125} === "x00") && ($id3v1tag{126} !== "x00"))
  39. {
  40. $v1['track'] = ord(substr($v1['comment'], 29, 1));
  41. $v1['comment'] = substr($v1['comment'], 0, 28);
  42. }
  43. $v1['comment'] = trim($v1['comment']);
  44. $v1['genre'] = isset($id3v1_generes[$v1['genreid']]) ? $id3v1_generes[$v1['genreid']] : 'Unknown';
  45. }
  46. echo '<pre>';
  47. print_r($v1);
  48. echo '</pre>';
  49. ?>
Wyciągłem to z tamytej klasy tongue.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2024 Invision Power Services, Inc.