Suppress check for valid audio on URLs to fix 'File not present' errors when passing URLs to constructor. Fixes https://github.com/wapmorgan/Mp3Info/issues/21

This commit is contained in:
Steve Hannah 2021-11-12 10:12:15 -08:00
parent b53a5e9368
commit 45c8e67e43

@ -213,8 +213,8 @@ class Mp3Info {
self::$_sampleRateTable = require dirname(__FILE__).'/../data/sampleRateTable.php';
$this->_fileName = $filename;
if (strpos($filename, '://') !== false) {
$isLocal = (strpos($filename, '://') === false);
if (!$isLocal) {
$this->_fileSize = static::getUrlContentLength($filename);
} else {
if (!file_exists($filename)) {
@ -223,13 +223,14 @@ class Mp3Info {
$this->_fileSize = filesize($filename);
}
if (!static::isValidAudio($filename)) {
if ($isLocal and !static::isValidAudio($filename)) {
throw new \Exception('File ' . $filename . ' is not mpeg/audio!');
}
$mode = $parseTags ? self::META | self::TAGS : self::META;
$this->audioSize = $this->parseAudio($this->_fileName, $this->_fileSize, $mode);
}
/**
* @return bool|null