Skip to content

Commit

Permalink
Suppress check for valid audio on URLs to fix 'File not present' erro…
Browse files Browse the repository at this point in the history
…rs when passing URLs to constructor. Fixes #21
  • Loading branch information
shannah committed Nov 12, 2021
1 parent b53a5e9 commit 45c8e67
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Mp3Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ public function __construct($filename, $parseTags = false) {
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)) {
Expand All @@ -223,13 +223,14 @@ public function __construct($filename, $parseTags = false) {
$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
Expand Down

0 comments on commit 45c8e67

Please sign in to comment.