Garbage string in the comment field encoded with itunes

The place for "I can't figure out how to..." questions.
Post Reply
bestgetid3
User
Posts: 2
Joined: Mon Sep 02, 2013 2:35 pm
Are you a spambot?: no

Garbage string in the comment field encoded with itunes

Post by bestgetid3 » Mon Sep 02, 2013 2:53 pm

Hello

I am trying to read the comment tag but I am getting some unknown characters as shown in the below arrays. How I can fix this issue. I have thousands of files that I cannot update manually so I just need to a way to get the human readable comments from the comments field. As the index of human readable comment is not same so I cannot always use that index. Please help me.

Thanks

Code: Select all

Array
(
    [0] => 0  
    [1] => 00003A46 000031EF 0000F322 0000C1B1 00000F68 0002A953 00007FFF 00007FFF 00001C29 000017FA 
    [2] => 00000000 00000210 000008E8 00000000008A4C08 00000000 007D59CC 00000000 00000000 00000000 00000000 00000000 00000000 
    [3] => 9E09010C+173088+12+150+12990+25146+39007+52189+67861+80939+95374+110788+123860+141410+156203 
    [4] => 8 
    [5] => Master and Pub Shelly Bay (obo Neil Nathan) male vox, beach boys, surfer rock, harmonica, guitar, stop playing games act your age 
)

Code: Select all

Array
(
    [0] => 0  
    [1] => 0000119F 0000155F 00007D10 00008114 00011524 00011524 00008C91 0000872C 0001F87D 00015CE0 
    [2] => 00000000 00000210 00000B40 000000000076E630 00000000 006BC3C2 00000000 00000000 00000000 00000000 00000000 00000000 
    [3] => C309720E+181514+14+150+1304+15971+29223+44566+58433+70626+87597+105852+116690+129659+140246+159369+178068 
    [4] => 3 
    [5] => Master and Pub Shelly Bay (obo Tamar) female vox, quirky, love, one for me, up beat, banjo, brass, piano, male vox chorus, kazoo,  
)

Code: Select all

Array
(
    [0] => 0  
    [1] => 0000016B 000001FD 00001F4A 00001606 000207C0 000207C0 000065E7 00005650 00010620 00023AD8 
    [2] => 00000000 00000210 000008DA 000000000085F496 00000000 006F8C40 00000000 00000000 00000000 00000000 00000000 00000000 
    [3] => Master and Pub Shelly Bay (obo Tamar) folk, singer songwriter, instrumental, quirky, americana 
)

example mp3 download link https://app.box.com/s/21oeb7j18eba4jykin6v

James Heinrich
getID3() v1 developer
Posts: 1432
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Garbage string in the comment field encoded with itunes

Post by James Heinrich » Mon Sep 02, 2013 3:36 pm

Thanks for the sample file. iTunes is adding a number of comment (ID3v2.2:COM) tags, each tagged with a different description. This is legal, but it would have been much more useful if iTunes had used user-defined text frames (TXX) instead of comment (COM) frames for the non-human-readable data.

Using your first example, it makes more sense when you see the comment description:

Code: Select all

Array
(
    [iTunPGAP] => 0  
    [iTunNORM] => 00003A46 000031EF 0000F322 0000C1B1 00000F68 0002A953 00007FFF 00007FFF 00001C29 000017FA 
    [iTunSMPB] => 00000000 00000210 000008E8 00000000008A4C08 00000000 007D59CC 00000000 00000000 00000000 00000000 00000000 00000000 
    [iTunes_CDDB_1] => 9E09010C+173088+12+150+12990+25146+39007+52189+67861+80939+95374+110788+123860+141410+156203 
    [iTunes_CDDB_TrackNumber] => 8 
    [5] => Master and Pub Shelly Bay (obo Neil Nathan) male vox, beach boys, surfer rock, harmonica, guitar, stop playing games act your age 
)
I have made some changes:
https://github.com/JamesHeinrich/getID3 ... 472f35ad89

TXX[X] and COM[M] frames are now returned with the frame description as the array key, if present, or a numeric key if no description is provided. Generally this means that human-readable comments will have a numeric array key.

Will be included in v1.10.0
Attachments
module.tag.id3v2.php
(135.36 KiB) Downloaded 662 times
getid3.lib.php
(43.79 KiB) Downloaded 656 times
getid3.php
(63.59 KiB) Downloaded 671 times

bestgetid3
User
Posts: 2
Joined: Mon Sep 02, 2013 2:35 pm
Are you a spambot?: no

Re: Garbage string in the comment field encoded with itunes

Post by bestgetid3 » Tue Sep 03, 2013 4:08 pm

Thanks James Heinrich,
It works well on my local system but on live server where I am running 100s of other website I am getting "getID3() requires PHP v5.3.0 or higher - you are running v5.2.17.". I cannot update php version as it will affect other websites. Please help.

Thanks again :)

James Heinrich
getID3() v1 developer
Posts: 1432
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Garbage string in the comment field encoded with itunes

Post by James Heinrich » Tue Sep 03, 2013 7:48 pm

I don't remember offhand what, if anything, now (getID3 v1.10.0+) requires PHP 5.3.0+

You could try bypassing the PHP verison check (getid3.php line 117 -- change $required_php_version = '5.3.0'; to match your version or just comment out the version check section, but be aware that future features may actually require v5.3+

Alternately you could back-port the above patch to v1.9.7

Post Reply