download getid3.ogginfo.php
Language: PHP
LOC: 57
Project Info
Tunez
Server: SourceForge
Type: cvs
...tunez\tunez\tunez\html\id3\
   getid3.aac.php
   getid3.ape.php
   getid3.asf.php
   getid3.au.php
   getid3.avr.php
   getid3.bmp.php
   getid3.bonk.php
   getid3.check.php
   getid3.exe.php
   getid3.flac.php
   getid3.frames.php
   getid3.functions.php
   getid3.getimagesize.php
   getid3.gif.php
   getid3.id3v1.php
   getid3.id3v2.php
   getid3.iso.php
   getid3.jpg.php
   getid3.la.php
   getid3.lookup.php
   getid3.lpac.php
   getid3.lyrics3.php
   getid3.matroska.php
   getid3.midi.php
   getid3.mod.php
   getid3.monkey.php
   getid3.mp3.php
   getid3.mpc.php
   getid3.mpeg.php
   getid3.nsv.php
   getid3.ogg.php
   getid3.ogginfo.php
   getid3.optimfrog.php
   getid3.php
   getid3.png.php
   getid3.putid3.php
   getid3.quicktime.php
   getid3.rar.php
   getid3.real.php
   getid3.rgad.php
   getid3.riff.php
   getid3.shorten.php
   getid3.swf.php
   getid3.thumbnail.php
   getid3.voc.php
   getid3.vqf.php
   getid3.write.php
   getid3.zip.php

<?php
/////////////////////////////////////////////////////////////////
/// getID3() by James Heinrich <info@getid3.org>               //
//  available at http://getid3.sourceforge.net                ///
//            or http://www.getid3.org                        ///
/////////////////////////////////////////////////////////////////
//                                                             //
// getid3.ogginfo.php - part of getID3()                       //
// See getid3.readme.txt for more details                      //
//                                                             //
/////////////////////////////////////////////////////////////////

function OggWrite($filename, $comments) {

	// Uses vorbiscomment(.exe) to write comments, if available.

	if ((bool) ini_get('safe_mode')) {

		echo 'Failed making system call to vorbiscomment.exe - cannot write comments - error returned: PHP running in Safe Mode (backtick operator not available)';
		return false;

	} else {

		// Prevent user from aborting script
		$old_abort = ignore_user_abort(true);

		// Create file with new comments
		$commentsfilename = tempnam('/tmp', 'getID3');
		if ($fpcomments = fopen($commentsfilename, 'wb')) {

			foreach ($comments as $key => $value) {
				if (!is_array($value)) {
					$comments[$key] = array($value);
				}
			}
			foreach ($comments as $key => $value) {
				foreach ($value as $valuekey => $valuevalue) {
					str_replace("\r", "\n", $valuevalue);
					if (strstr($valuevalue, "\n")) {
						unset($comments[$key][$valuekey]);
						$multilineexploded = explode("\n", $valuevalue);
						foreach ($multilineexploded as $newcomment) {
							if (strlen(trim($newcomment)) > 0) {
								$comments[$key][] = $newcomment;
							}
						}
					}
				}
			}
			foreach ($comments as $key => $value) {
				foreach ($value as $commentdata) {
					fwrite($fpcomments, CleanOggCommentName($key).'='.$commentdata."\n");
				}
			}
			fclose($fpcomments);
		}

		if (substr(php_uname(), 0, 7) == 'Windows') {

			if (file_exists(GETID3_INCLUDEPATH.'vorbiscomment.exe')) {

				$VorbisCommentError = `vorbiscomment.exe -w -c "$commentsfilename" "$filename"`;

			} else {

				$VorbisCommentError = 'vorbiscomment.exe not found in '.GETID3_INCLUDEPATH;

			}

		} else {

			$VorbisCommentError = `vorbiscomment -w -c "$commentsfilename" "$filename" 2>&1`;

		}

		if (!empty($VorbisCommentError)) {

			echo 'Failed making system call to vorbiscomment(.exe) - cannot write comments. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError;
			return false;

		}

		// Remove temporary comments file
		unlink($commentsfilename);

		// Reset abort setting
		ignore_user_abort($old_abort);

		return true;
	}
}


function CleanOggCommentName($originalcommentname) {
	// A case-insensitive field name that may consist of ASCII 0x20 through 0x7D, 0x3D ('=') excluded.
	// ASCII 0x41 through 0x5A inclusive (A-Z) is to be considered equivalent to ASCII 0x61 through
	// 0x7A inclusive (a-z).

	// replace invalid chars with a space, return uppercase text
	// Thanks Chris Bolt <chris-getid3@bolt.cx> for improving this function
	return strtoupper(ereg_replace('[^ -<>-}]', ' ', $originalcommentname));

}

?>

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us