Check ID3 version?
-
- User
- Posts:22
- Joined:Fri Dec 19, 2008 5:20 am
Is it possible to check the ID3 versions so that I can write tags for v1 if that is the kind that is found? Is this possible?
-
- getID3() v1 developer
- Posts:1477
- Joined:Fri May 04, 2001 4:00 pm
- Are you a spambot?:no
- Location:Northern Ontario, Canada
- Contact:
Re: Check ID3 version?
...?
If ['id3v1'] is present, then it's v1.x (if ['id3v1']['track'] exists, it's v1.1, otherwise it's v1.0)
If ['id3v2'] is present, check ['id3v2']['majorversion'] (one of "2" or "3" or "4") and ['id3v2']['minorversion'] (should be "0"), which would be ID3v2.2 or ID3v2.3 or ID3v2.4
If ['id3v1'] is present, then it's v1.x (if ['id3v1']['track'] exists, it's v1.1, otherwise it's v1.0)
If ['id3v2'] is present, check ['id3v2']['majorversion'] (one of "2" or "3" or "4") and ['id3v2']['minorversion'] (should be "0"), which would be ID3v2.2 or ID3v2.3 or ID3v2.4
-
- User
- Posts:22
- Joined:Fri Dec 19, 2008 5:20 am
Re: Check ID3 version?
Ok, I have a working solution, but it still poses a problem:
So, I am checking to see if $id3->info['tags']['id3v2']; returns true, and if it does, I use the id3v2 tags, if not, I use id2v1. But the strange thing is, when I am getting the info on id3v1 tags, it will work correctly, but I still get Undefined index: id3v2 error, which is strange. Why would it be returning that error when working with a id3v1 file?
Code: Select all
$versionCheck = $id3->info['tags']['id3v2'];
if ($versionCheck) {
if (isset($id3->info['tags']['id3v2']['title'][0])) {
return $id3->info['tags']['id3v2']['title'][0];
}
} else {
if (isset($id3->info['tags']['id3v1']['title'][0])) {
return $id3->info['tags']['id3v1']['title'][0];
}
}//end else
-
- User
- Posts:22
- Joined:Fri Dec 19, 2008 5:20 am
Re: Check ID3 version?
Ok, I changed my var to:
To check if it is set, and my error is gone!
Code: Select all
$versionCheck = isset($id3->info['tags']['id3v2']);