The simplest solution that I could come up with for this: make a member variable, $getid3, of getid3_writetags, which may be set manually before invoking getid3_writetags::WriteTags() (if the user wishes to do so).
Here is a patch which adds such functionality:
Code: Select all
--- write.php.original 2006-03-22 18:11:06.000000000 -0500
+++ write.php 2006-03-22 18:11:01.000000000 -0500
@@ -60,6 +60,8 @@
var $warnings = array(); // any non-critical errors will be stored here
var $errors = array(); // any critical errors will be stored here
+ var $getID3 = null; // instance of getID3 class used to read the original tags
+
// private
var $ThisFileInfo; // analysis of file before writing
@@ -92,10 +94,28 @@
} else {
- $getID3 = new getID3;
- $getID3->encoding = $this->tag_encoding;
+ $getID3 = $this->getID3;
+ if ($getID3 == null) {
+
+ $getID3 = new getID3;
+ $this->tag_encoding = $getID3->encoding;
+ }
+ else if (!is_a($getID3, 'getID3')) {
+
+ $this->errors[] = 'getID3 property is not an instance of the getID3 class';
+ return false;
+ }
+
$this->ThisFileInfo = $getID3->analyze($this->filename);
+ // if errors occurred while analyzing the file, we should not
+ // attempt to write tags.
+ if (!empty($this->ThisFileInfo['error'])) {
+
+ $this->errors = $this->ThisFileInfo['error'];
+ return false;
+ }
+
// check for what file types are allowed on this fileformat
switch (@$this->ThisFileInfo['fileformat']) {
case 'mp3':
(Note: I modified the patch posted above, on 2006-05-07, as there was a small mistake.)