ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
getid3_write_id3v1 Class Reference
+ Collaboration diagram for getid3_write_id3v1:

Public Member Functions

 getid3_write_id3v1 ()
 WriteID3v1 ()
 FixID3v1Padding ()
 RemoveID3v1 ()

Data Fields

 $filename
 $tag_data
 $warnings = array()
 $errors = array()

Detailed Description

Definition at line 18 of file write.id3v1.php.

Member Function Documentation

getid3_write_id3v1::FixID3v1Padding ( )

Definition at line 62 of file write.id3v1.php.

References getID3\analyze(), and WriteID3v1().

{
// ID3v1 data is supposed to be padded with NULL characters, but some taggers incorrectly use spaces
// This function rewrites the ID3v1 tag with correct padding
// Initialize getID3 engine
$getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($this->filename);
if (isset($ThisFileInfo['tags']['id3v1'])) {
foreach ($ThisFileInfo['tags']['id3v1'] as $key => $value) {
$id3v1data[$key] = implode(',', $value);
}
$this->tag_data = $id3v1data;
return $this->WriteID3v1();
}
return false;
}

+ Here is the call graph for this function:

getid3_write_id3v1::getid3_write_id3v1 ( )

Definition at line 25 of file write.id3v1.php.

{
return true;
}
getid3_write_id3v1::RemoveID3v1 ( )

Definition at line 79 of file write.id3v1.php.

{
// File MUST be writeable - CHMOD(646) at least
if (is_writeable($this->filename)) {
if ($fp_source = @fopen($this->filename, 'r+b')) {
fseek($fp_source, -128, SEEK_END);
if (fread($fp_source, 3) == 'TAG') {
ftruncate($fp_source, filesize($this->filename) - 128);
} else {
// no ID3v1 tag to begin with - do nothing
}
fclose($fp_source);
return true;
} else {
$this->errors[] = 'Could not open '.$this->filename.' mode "r+b"';
}
} else {
$this->errors[] = $this->filename.' is not writeable';
}
return false;
}
getid3_write_id3v1::WriteID3v1 ( )

Definition at line 29 of file write.id3v1.php.

References getid3_id3v1\GenerateID3v1Tag().

Referenced by FixID3v1Padding().

{
// File MUST be writeable - CHMOD(646) at least
if (is_writeable($this->filename)) {
if ($fp_source = @fopen($this->filename, 'r+b')) {
fseek($fp_source, -128, SEEK_END);
if (fread($fp_source, 3) == 'TAG') {
fseek($fp_source, -128, SEEK_END); // overwrite existing ID3v1 tag
} else {
fseek($fp_source, 0, SEEK_END); // append new ID3v1 tag
}
$new_id3v1_tag_data = getid3_id3v1::GenerateID3v1Tag(
@$this->tag_data['title'],
@$this->tag_data['artist'],
@$this->tag_data['album'],
@$this->tag_data['year'],
@$this->tag_data['genreid'],
@$this->tag_data['comment'],
@$this->tag_data['track']);
fwrite($fp_source, $new_id3v1_tag_data, 128);
fclose($fp_source);
return true;
} else {
$this->errors[] = 'Could not open '.$this->filename.' mode "r+b"';
return false;
}
}
$this->errors[] = 'File is not writeable: '.$this->filename;
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

getid3_write_id3v1::$errors = array()

Definition at line 23 of file write.id3v1.php.

getid3_write_id3v1::$filename

Definition at line 20 of file write.id3v1.php.

getid3_write_id3v1::$tag_data

Definition at line 21 of file write.id3v1.php.

getid3_write_id3v1::$warnings = array()

Definition at line 22 of file write.id3v1.php.


The documentation for this class was generated from the following file: