JamesHeinrich / getID3

http://www.getid3.org/
Other
1.15k stars 245 forks source link

WriteTags() return true but tags never written #393

Closed foremtehan closed 2 years ago

foremtehan commented 2 years ago

I want to override some tags in this mp3 file, WriteTags method return true at the end but when you analyze the file the target field never written:

$getID3 = new getID3;

$tagwriter                      = new getid3_writetags;
$tagwriter->filename            = './music.mp3';
$tagwriter->overwrite_tags      = true;
$tagwriter->tag_encoding        = 'UTF-8';
$tagwriter->tagformats          = array('id3v1');

$TagData = array(
    'artist'  => array('My Artist'),
);

$tagwriter->tag_data = $TagData;

if ($tagwriter->WriteTags()){
    return true;
}else{
    throw new \Exception(implode(' : ', $tagwriter->errors));
}
?>

It does not contain "My Artist" when you analyze the file.

(Also) The file already contains id3v1 and id3v2, when you set the tag_encoding to id3v2 it throw this error: Tag format "id3v2" is not allowed on "mp3.mp3" files

foremtehan commented 2 years ago

nvm file was corrupted