summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-11-14 07:32:51 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-11-14 07:32:51 +0000
commit777d880a0aebfeab027c34260d6ab76a37f5c781 (patch)
tree33ab0dabbe1e58a9ae265e2e3d7ea03abf4e174d /lib
parentfa9bef64d8ab842d65cd1da7f9024a157f4d279f (diff)
downloadampache-777d880a0aebfeab027c34260d6ab76a37f5c781.tar.gz
ampache-777d880a0aebfeab027c34260d6ab76a37f5c781.tar.bz2
ampache-777d880a0aebfeab027c34260d6ab76a37f5c781.zip
sync from trunk
Diffstat (limited to 'lib')
-rw-r--r--lib/class/vainfo.class.php41
1 files changed, 37 insertions, 4 deletions
diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php
index 488c2f80..09c767a5 100644
--- a/lib/class/vainfo.class.php
+++ b/lib/class/vainfo.class.php
@@ -48,6 +48,7 @@ class vainfo {
/* Internal Private */
private $_binary_parse = array();
private $_pathinfo;
+ private $_broken=false;
/**
* Constructor
@@ -102,8 +103,10 @@ class vainfo {
$this->_raw2 = $this->_getID3->analyze($file);
}
catch (Exception $error) {
- debug_event('getid3',$error->message,'1');
- }
+ debug_event('Getid3()',"Broken file detected $file - " . $error->message,'1');
+ $this->_broken = true;
+ return false;
+ }
if(function_exists('mb_detect_encoding')) {
$this->encoding_id3v1 = array();
@@ -160,6 +163,13 @@ class vainfo {
*/
public function get_info() {
+ // If this is broken, don't waste time figuring it out a second time, just return
+ // their rotting carcass of a media file back on the pile
+ if ($this->_broken) {
+ $this->tags = $this->set_broken();
+ return true;
+ }
+
// If we've got a green light try out the binary
// if ($this->_binary_parse[$this->_pathinfo['extension']]) {
// $this->run_binary_parse();
@@ -172,7 +182,7 @@ class vainfo {
$this->_raw = $this->_getID3->analyze($this->filename);
}
catch (Exception $error) {
- debug_event('getid3',$error->message,'1');
+ debug_event('Getid3()',"Unable to catalog file:" . $error->message,'1');
}
/* Figure out what type of file we are dealing with */
@@ -403,7 +413,7 @@ class vainfo {
$type = $this->_clean_type($type);
return $type;
}
-
+
return false;
} // _get_type
@@ -1108,5 +1118,28 @@ class vainfo {
} // mp3_binary_parse
+ /**
+ * set_broken
+ * This fills all tag types with Unknown (Broken)
+ */
+ public function set_broken() {
+
+ /* Pull In the config option */
+ $order = Config::get('tag_order');
+
+ if (!is_array($order)) {
+ $order = array($order);
+ }
+
+ $key = array_shift($order);
+
+ $broken[$key]['title'] = '**BROKEN** ' . $this->filename;
+ $broken[$key]['album'] = 'Unknown (Broken)';
+ $broken[$key]['artist'] = 'Unknown (Broken)';
+
+ return $broken;
+
+ } // set_broken
+
} // end class vainfo
?>