echo number_format(mysql_num_rows($result)) . ' files with errors or warnings:<br>'; echo '(<a href="' . htmlentities($_SERVER['PHP_SELF'] . '?errorswarnings=1&m3u=.m3u') . '">.m3u version</a>)<br>'; echo '<table border="1" cellspacing="0" cellpadding="4">'; echo '<tr><th>Filename</th><th>Error</th><th>Warning</th></tr>'; while ($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td><a href="' . htmlentities('demo.browse.php?filename=' . rawurlencode($row['filename']), ENT_QUOTES) . '">' . htmlentities($row['filename']) . '</a></td>'; echo '<td>' . (!empty($row['error']) ? '<li>' . str_replace("\t", '<li>', htmlentities($row['error'])) . '</li>' : ' ') . '</td>'; echo '<td>' . (!empty($row['warning']) ? '<li>' . str_replace("\t", '<li>', htmlentities($row['warning'])) . '</li>' : ' ') . '</td>'; echo '</tr>'; } } echo '</table><hr>'; } elseif (!empty($_REQUEST['fixid3v1padding'])) { getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'write.id3v1.php', __FILE__, true); $id3v1_writer = new getid3_write_id3v1(); $SQLquery = 'SELECT `filename`, `error`, `warning`'; $SQLquery .= ' FROM `' . mysql_real_escape_string(GETID3_DB_TABLE) . '`'; $SQLquery .= ' WHERE (`fileformat` = "mp3")'; $SQLquery .= ' AND (`warning` <> "")'; $SQLquery .= ' ORDER BY `filename` ASC'; $result = mysql_query_safe($SQLquery); $totaltofix = mysql_num_rows($result); $rowcounter = 0; while ($row = mysql_fetch_array($result)) { set_time_limit(30); if (strpos($row['warning'], 'Some ID3v1 fields do not use NULL characters for padding') !== false) { set_time_limit(30); $id3v1_writer->filename = $row['filename']; echo $id3v1_writer->FixID3v1Padding() ? '<span style="color: #009900;">fixed - ' : '<span style="color: #FF0000;">error - '; } else {
function DeleteTags($TagFormatsToDelete) { foreach ($TagFormatsToDelete as $DeleteTagFormat) { $success = false; // overridden if tag deletion is successful switch ($DeleteTagFormat) { case 'id3v1': $id3v1_writer = new getid3_write_id3v1(); $id3v1_writer->filename = $this->filename; if (($success = $id3v1_writer->RemoveID3v1()) === false) { $this->errors[] = 'RemoveID3v1() failed with message(s):<PRE><UL><LI>' . trim(implode('</LI><LI>', $id3v1_writer->errors)) . '</LI></UL></PRE>'; } break; case 'id3v2': $id3v2_writer = new getid3_write_id3v2(); $id3v2_writer->filename = $this->filename; if (($success = $id3v2_writer->RemoveID3v2()) === false) { $this->errors[] = 'RemoveID3v2() failed with message(s):<PRE><UL><LI>' . trim(implode('</LI><LI>', $id3v2_writer->errors)) . '</LI></UL></PRE>'; } break; case 'ape': $ape_writer = new getid3_write_apetag(); $ape_writer->filename = $this->filename; if (($success = $ape_writer->DeleteAPEtag()) === false) { $this->errors[] = 'DeleteAPEtag() failed with message(s):<PRE><UL><LI>' . trim(implode('</LI><LI>', $ape_writer->errors)) . '</LI></UL></PRE>'; } break; case 'vorbiscomment': $vorbiscomment_writer = new getid3_write_vorbiscomment(); $vorbiscomment_writer->filename = $this->filename; if (($success = $vorbiscomment_writer->DeleteVorbisComment()) === false) { $this->errors[] = 'DeleteVorbisComment() failed with message(s):<PRE><UL><LI>' . trim(implode('</LI><LI>', $vorbiscomment_writer->errors)) . '</LI></UL></PRE>'; } break; case 'metaflac': $metaflac_writer = new getid3_write_metaflac(); $metaflac_writer->filename = $this->filename; if (($success = $metaflac_writer->DeleteMetaFLAC()) === false) { $this->errors[] = 'DeleteMetaFLAC() failed with message(s):<PRE><UL><LI>' . trim(implode('</LI><LI>', $metaflac_writer->errors)) . '</LI></UL></PRE>'; } break; case 'lyrics3': $lyrics3_writer = new getid3_write_lyrics3(); $lyrics3_writer->filename = $this->filename; if (($success = $lyrics3_writer->DeleteLyrics3()) === false) { $this->errors[] = 'DeleteLyrics3() failed with message(s):<PRE><UL><LI>' . trim(implode('</LI><LI>', $lyrics3_writer->errors)) . '</LI></UL></PRE>'; } break; case 'real': $real_writer = new getid3_write_real(); $real_writer->filename = $this->filename; if (($success = $real_writer->RemoveReal()) === false) { $this->errors[] = 'RemoveReal() failed with message(s):<PRE><UL><LI>' . trim(implode('</LI><LI>', $real_writer->errors)) . '</LI></UL></PRE>'; } break; default: $this->errors[] = 'Invalid tag format to delete: "' . $tagformat . '"'; return false; break; } if (!$success) { return false; } } return true; }
// | Authors: James Heinrich <infoØgetid3*org> | // | Allan Hansen <ahØartemis*dk> | // +----------------------------------------------------------------------+ // | demo.write.id3v1.php | // | getID3() demo file - showing how to write ID3v1 tags with getID3(). | // +----------------------------------------------------------------------+ // // $Id: demo.write.id3v1.php,v 1.4 2006/11/16 22:11:59 ah Exp $ // Enter your filename here $filename = '/data/getid3/test.mp3'; // Include getID3() library (can be in a different directory if full path is specified) require_once '../getid3/getid3.php'; // Include desired writer module require_once '../getid3/write.id3v1.php'; // Instantiate desired tag class $tw = new getid3_write_id3v1($filename); // Attempt to read current tag if ($tw->read()) { print 'File contains tag already; artist is "' . $tw->artist . '"<br>'; } // Attempt to write new tag -- NOTE: all values must be in ISO-8859-1 try { $tw->title = 'title'; $tw->artist = 'artist'; $tw->album = 'album'; $tw->year = 2005; $tw->genre = 'Techno'; unset($tw->genre_id); $tw->comment = 'comment'; $tw->track = 11; $tw->write();