Open toto4ds opened 3 years ago
easy way to repeat, the code for writing is the same: 1) write ['id3v1', 'id3v2.4'], 2) write ['id3v2.4']
But if I run the analyze() before WriteTags(), there is no errors
After removing from the laravel, the error is not reproduced. I will investigate further and report the result later.
Continuation of the survey. It's not laravel fault.
The following code has been written which does not work as expected:
require_once('vendor/james-heinrich/getid3/getid3/getid3.php');
require_once('vendor/james-heinrich/getid3/getid3/write.php');
$TagData = ['title' => ['Title me']];
$path = '1second.mp3';
for ($a=1; $a<=6; $a++) {
if ($a%2) {
$TagFormatsToWrite = ['id3v1', 'id3v2.4'];
} else {
$TagFormatsToWrite = ['id3v2.4'];
}
$tagwriter = new \getid3_writetags;
$tagwriter->filename = $path;
$tagwriter->tagformats = $TagFormatsToWrite;
$tagwriter->overwrite_tags = true;
$tagwriter->tag_encoding = 'UTF-8';
$tagwriter->remove_other_tags = true;
$tagwriter->tag_data = $TagData;
if ($tagwriter->WriteTags()) {
if (!empty($tagwriter->warnings)) {
echo 'WriteTags '.$a.' warnings: '.implode($tagwriter->warnings)."\n";
} else {
echo 'Tags '.$a.' update'."\n";
}
} else {
echo 'WriteTags '.$a.' errors: '.implode($tagwriter->errors)."\n";
}
}
result for 1second.mp3
Tags 1 update WriteTags 2 errors: Tag format "id3v2.4" is not allowed on "" files WriteTags 3 errors: Tag format "id3v1" is not allowed on "" files WriteTags 4 errors: Tag format "id3v2.4" is not allowed on "" files WriteTags 5 errors: Tag format "id3v1" is not allowed on "" files WriteTags 6 errors: Tag format "id3v2.4" is not allowed on "" files
result for cbr320mb10.mp3 is no error
"remove_other_tags" set to "false" works without errors
on PHP 7.3.27 same problem on GETID3_VERSION 1.9.20-202104081001 same problem 1second.mp3 at https://drive.google.com/file/d/1T_6GzI0LGppcMjhiL98lhgMD7dxNv2a8/view?usp=sharing
Hello, The problem does not appear when you use only id3v2
PHP 7.4.16 GETID3_VERSION 1.9.20-202006061653
Code: write 'id3v1', 'id3v2.4':
delete ''id3v2':
before delete get analyze:
file cbr320mb10.mp3: analyze result:
dump $OldThisFileInfo in RemoveID3v2() result:
The error is that he does not see the id3v1 tag? Although there is no such problem when analyzing
file 1second.mp3: analyze result:
dump $OldThisFileInfo in RemoveID3v2() result:
and error:
if run a second time, there are no problems and errors, but the id3v1 tag also disappears thx