From afd75f113451c89a934789564fb2a3a49e15dcf3 Mon Sep 17 00:00:00 2001 From: velocity37 Date: Sun, 23 Sep 2012 19:57:50 -0700 Subject: [PATCH] getID3: Boolean to force MP3 check Apparently MP3 encoders can muck up an MP3 file pretty bad. getID3 can read these files, but it takes extra work and thus is only done if the file carries a relevant extension. Shimmie's files don't have an extension, so a boolean was added to analyze() in order to force this check. --- lib/getid3/THIS_HAS_BEEN_MODIFIED.txt | 5 +++++ lib/getid3/getid3/getid3.php | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 lib/getid3/THIS_HAS_BEEN_MODIFIED.txt diff --git a/lib/getid3/THIS_HAS_BEEN_MODIFIED.txt b/lib/getid3/THIS_HAS_BEEN_MODIFIED.txt new file mode 100644 index 00000000..e2105a17 --- /dev/null +++ b/lib/getid3/THIS_HAS_BEEN_MODIFIED.txt @@ -0,0 +1,5 @@ +In compliance with GPL, this message is to notify you that getID3 has been modified. + +getid3.php was modified September 23, 2012 to add a boolean to force MP3 checking. + +It carries the same license as its original. \ No newline at end of file diff --git a/lib/getid3/getid3/getid3.php b/lib/getid3/getid3/getid3.php index e8a3f7e2..ca351bcd 100644 --- a/lib/getid3/getid3/getid3.php +++ b/lib/getid3/getid3/getid3.php @@ -1,4 +1,7 @@ // // available at http://getid3.sourceforge.net // @@ -343,7 +346,7 @@ class getID3 } // public: analyze file - function analyze($filename) { + function analyze($filename, $forcemp3 = FALSE) { try { if (!$this->openfile($filename)) { return $this->info; @@ -390,7 +393,7 @@ class getID3 $formattest = fread($this->fp, 32774); // determine format - $determined_format = $this->GetFileFormat($formattest, $filename); + $determined_format = $this->GetFileFormat($formattest, $filename, $forcemp3); // unable to determine file format if (!$determined_format) { @@ -1102,7 +1105,7 @@ class getID3 - function GetFileFormat(&$filedata, $filename='') { + function GetFileFormat(&$filedata, $filename='', $forcemp3) { // this function will determine the format of a file based on usually // the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG, // and in the case of ISO CD image, 6 bytes offset 32kb from the start @@ -1119,7 +1122,7 @@ class getID3 } - if (preg_match('#\.mp[123a]$#i', $filename)) { + if (preg_match('#\.mp[123a]$#i', $filename) || $forcemp3 == TRUE) { // Too many mp3 encoders on the market put gabage in front of mpeg files // use assume format on these if format detection failed $GetFileFormatArray = $this->GetFileFormatArray();