From b000e8a448ca150abe2f1593c62fe6326cb0a819 Mon Sep 17 00:00:00 2001 From: momo-i Date: Thu, 4 Sep 2008 22:20:49 +0000 Subject: Fixed #300 (Thx abs0) and Fixed didn't catch exception first analyze. --- lib/class/vainfo.class.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lib/class') diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php index 206a146c..fb668078 100644 --- a/lib/class/vainfo.class.php +++ b/lib/class/vainfo.class.php @@ -68,7 +68,13 @@ class vainfo { $this->_getID3 = new getID3(); // get id3tag encodings - $this->_raw2 = $this->_getID3->analyze($file); + try { + $this->_raw2 = $this->_getID3->analyze($file); + } + catch (Exception $error) { + debug_event('getid3',$error->message,'1'); + } + if(function_exists('mb_detect_encoding')) { $this->encoding_id3v1 = array(); $this->encoding_id3v1[] = mb_detect_encoding($this->_raw2['tags']['id3v1']['artist']['0']); @@ -566,12 +572,16 @@ class vainfo { // If we've got iconv then go ahead and clear her up if ($this->_iconv) { /* Guess that it's UTF-8 */ + /* Try GNU iconv //TRANSLIT extension first */ if (!$encoding) { $encoding = $this->_getID3->encoding; } $charset = $this->encoding . '//TRANSLIT'; - $tag = iconv($encoding,$charset,$tag); + $enc_tag = iconv($encoding,$charset,$tag); + if(strcmp($enc_tag, "") == 0) { + $enc_tag = iconv($encoding,$this->encoding,$tag); + } } - return $tag; + return $enc_tag; } // _clean_tag -- cgit