librivox-catalog
librivox-catalog copied to clipboard
Improve handling of incorrect paths in validator
If a path is incorrect in the validator, this is not handled gracefully, and instead we get a whole bunch of errors because the following code in application/libraries/Librivox_mp3gain.php
that parses the mp3gain
output does not have a second line to work with:
$this->flag = ' -o ';
$command = $this->mp3gain . ' ' . $this->flag . $dir. $file_name;
exec($command, $output);
$parts = explode("\t", $output[1]);
Here's a screenshot of an incorrect validator path (notice the period at the end of the first file):
And here are the PHP errors we get:
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: libraries/Librivox_mp3gain.php
Line Number: 73
A PHP Error was encountered
Severity: Notice
Message: Undefined index: playtime_string
Filename: libraries/Librivox_id3tag.php
Line Number: 171
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 2
Filename: libraries/Librivox_id3tag.php
Line Number: 172
A PHP Error was encountered
Severity: Notice
Message: Undefined index: audio
Filename: libraries/Librivox_id3tag.php
Line Number: 173
A PHP Error was encountered
Severity: Notice
Message: Undefined index: audio
Filename: libraries/Librivox_id3tag.php
Line Number: 177
A PHP Error was encountered
Severity: Notice
Message: Undefined index: audio
Filename: libraries/Librivox_id3tag.php
Line Number: 179
This is happening frequently; a timely fix would be very helpful!
I also have this issue, the first two files are the guilty ones. I added them separately, the original two were renamed with the date, but now I can't edit the ID tags for the new ones (or for all in general) because of this error: All files must be linked to sections before you can edit the tags https://librivox.org/validator/16345 Also, when I try to delete any file, all buttons freeze and I can't click anything, only after I refresh.
A PHP Error was encountered Severity: Notice Message: Undefined offset: 1 Filename: libraries/Librivox_mp3gain.php Line Number: 71
A PHP Error was encountered Severity: Notice Message: Undefined index: playtime_string Filename: libraries/Librivox_id3tag.php Line Number: 171
A PHP Error was encountered Severity: Notice Message: Undefined offset: 2 Filename: libraries/Librivox_id3tag.php Line Number: 172
A PHP Error was encountered Severity: Notice Message: Undefined index: audio Filename: libraries/Librivox_id3tag.php Line Number: 173
A PHP Error was encountered Severity: Notice Message: Undefined index: audio Filename: libraries/Librivox_id3tag.php Line Number: 177
A PHP Error was encountered Severity: Notice Message: Undefined index: audio Filename: libraries/Librivox_id3tag.php Line Number: 179
A PHP Error was encountered Severity: Notice Message: Undefined offset: 1 Filename: libraries/Librivox_mp3gain.php Line Number: 71
A PHP Error was encountered Severity: Notice Message: Undefined index: playtime_string Filename: libraries/Librivox_id3tag.php Line Number: 171
A PHP Error was encountered Severity: Notice Message: Undefined offset: 2 Filename: libraries/Librivox_id3tag.php Line Number: 172
A PHP Error was encountered Severity: Notice Message: Undefined index: audio Filename: libraries/Librivox_id3tag.php Line Number: 173
A PHP Error was encountered Severity: Notice Message: Undefined index: audio Filename: libraries/Librivox_id3tag.php Line Number: 177
A PHP Error was encountered Severity: Notice Message: Undefined index: audio Filename: libraries/Librivox_id3tag.php Line Number: 179
The change from the PR is on the server. @twinkietoes-on does it make sense? I'm basically just skipping any file that mp3gain cannot process for whatever reason.
Alright, I think the commit above (7f63d1c) should prevent broken files form reaching the validator. Is that the only problem though? What about the filenames with the period at the end? How do they end up happening?