[nycphp-talk] Reading/writing id3v2 tags from MP3 files in PHP?
David Roth
davidalanroth at gmail.com
Thu Jul 28 08:19:16 EDT 2011
Hi Nick.
Thanks for the reply. It turns out for writing tags, those PHP
routines don't support v2 which I needed.
Now for the gory details. :-)
However, I did find a solution that worked. There is a command line
Linux utility called id3v2 which I installed on CentOS.
I ended up writing a PHP program which wrote a shell script to handle
the passing of the data needed for the parameters to id3v2. Then I ran
the shell script.
I did want to get the program length of each MP3 to write this to a
MySQL database, so I did use PHP's shell_exec with command line
mp3info to get the program runtime.
The other thing I learned about this is that iTunes uses a later
version of id3v2 (id3v2.2), so you can't write all the tags it uses
with the id3v2 software although it can read it.
And to convert them to podcast files which remember the position and
to skip during shuffle, that actually had to be done in iTunes itself.
Apparently that is a function of iTunes and likely stored in its own
XML file. Luckily, the user can select multiple MP3 files after they
have been imported to iTunes and globally change them to do this.
All this helped make an archive of old radio shows much more enjoyable
to use.
David Roth
> Hi David,
>
> PHP has ID3 functions. Here's where you can find it in the reference
> manual: http://php.net/id3
>
> Cheers!
>
> Nick
More information about the talk
mailing list