PATH:
home
/
lab2454c
/
keebchat.com
/
core
/
libs
/
getID3
/
getid3
<?php ///////////////////////////////////////////////////////////////// /// getID3() by James Heinrich <info@getid3.org> // // available at https://github.com/JamesHeinrich/getID3 // // or https://www.getid3.org // // or http://getid3.sourceforge.net // ///////////////////////////////////////////////////////////////// // see readme.txt for more details // ///////////////////////////////////////////////////////////////// // // // write.vorbiscomment.php // // module for writing VorbisComment tags // // dependencies: /helperapps/vorbiscomment.exe // // /// ///////////////////////////////////////////////////////////////// class getid3_write_vorbiscomment { /** * @var string */ public $filename; /** * @var array */ public $tag_data; /** * Any non-critical errors will be stored here. * * @var array */ public $warnings = array(); /** * Any critical errors will be stored here. * * @var array */ public $errors = array(); public function __construct() { } /** * @return bool */ public function WriteVorbisComment() { if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call vorbiscomment, tags not written'; return false; } // Create file with new comments $tempcommentsfilename = tempnam(GETID3_TEMP_DIR, 'getID3'); if (getID3::is_writable($tempcommentsfilename) && is_file($tempcommentsfilename) && ($fpcomments = fopen($tempcommentsfilename, 'wb'))) { foreach ($this->tag_data as $key => $value) { foreach ($value as $commentdata) { fwrite($fpcomments, $this->CleanVorbisCommentName($key).'='.$commentdata."\n"); } } fclose($fpcomments); } else { $this->errors[] = 'failed to open temporary tags file "'.$tempcommentsfilename.'", tags not written'; return false; } $oldignoreuserabort = ignore_user_abort(true); if (GETID3_OS_ISWINDOWS) { if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) { //$commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w --raw -c "'.$tempcommentsfilename.'" "'.str_replace('/', '\\', $this->filename).'"'; // vorbiscomment works fine if you copy-paste the above commandline into a command prompt, // but refuses to work with `backtick` if there are "doublequotes" present around BOTH // the metaflac pathname and the target filename. For whatever reason...?? // The solution is simply ensure that the metaflac pathname has no spaces, // and therefore does not need to be quoted // On top of that, if error messages are not always captured properly under Windows // To at least see if there was a problem, compare file modification timestamps before and after writing clearstatcache(); $timestampbeforewriting = filemtime($this->filename); $commandline = GETID3_HELPERAPPSDIR.'vorbiscomment.exe -w --raw -c "'.$tempcommentsfilename.'" "'.$this->filename.'" 2>&1'; $VorbiscommentError = `$commandline`; if (empty($VorbiscommentError)) { clearstatcache(); if ($timestampbeforewriting == filemtime($this->filename)) { $VorbiscommentError = 'File modification timestamp has not changed - it looks like the tags were not written'; } } } else { $VorbiscommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR; } } else { $commandline = 'vorbiscomment -w --raw -c "'.$tempcommentsfilename.'" "'.$this->filename.'" 2>&1'; $VorbiscommentError = `$commandline`; } // Remove temporary comments file unlink($tempcommentsfilename); ignore_user_abort($oldignoreuserabort); if (!empty($VorbiscommentError)) { $this->errors[] = 'system call to vorbiscomment failed with message: '."\n\n".$VorbiscommentError; return false; } return true; } /** * @return bool */ public function DeleteVorbisComment() { $this->tag_data = array(array()); return $this->WriteVorbisComment(); } /** * @param string $originalcommentname * * @return string */ public function CleanVorbisCommentName($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 // note: *reg_replace() replaces nulls with empty string (not space) return strtoupper(preg_replace('#[^ -<>-}]#', ' ', str_replace("\x00", ' ', $originalcommentname))); } }
[-] module.audio-video.ivf.php
[edit]
[-] write.id3v2.php
[edit]
[-] write.metaflac.php
[edit]
[-] module.audio.midi.php
[edit]
[-] module.audio.avr.php
[edit]
[-] extension.cache.dbm.php
[edit]
[-] module.graphic.pcd.php
[edit]
[-] module.misc.pdf.php
[edit]
[-] module.audio.dss.php
[edit]
[-] module.archive.gzip.php
[edit]
[-] module.audio.au.php
[edit]
[-] extension.cache.mysql.php
[edit]
[-] module.audio-video.wtv.php
[edit]
[-] module.audio-video.swf.php
[edit]
[-] module.audio.la.php
[edit]
[+]
..
[-] module.archive.xz.php
[edit]
[-] module.audio.shorten.php
[edit]
[-] module.graphic.efax.php
[edit]
[-] module.misc.par2.php
[edit]
[-] module.archive.rar.php
[edit]
[-] module.audio.optimfrog.php
[edit]
[-] module.audio.dsdiff.php
[edit]
[-] module.tag.xmp.php
[edit]
[-] module.audio.tak.php
[edit]
[-] module.audio-video.real.php
[edit]
[-] module.audio.vqf.php
[edit]
[-] module.audio.lpac.php
[edit]
[-] module.misc.iso.php
[edit]
[-] module.audio.ac3.php
[edit]
[-] module.audio.rkau.php
[edit]
[-] module.audio-video.bink.php
[edit]
[-] module.misc.exe.php
[edit]
[-] module.graphic.tiff.php
[edit]
[-] module.graphic.jpg.php
[edit]
[-] module.audio.mod.php
[edit]
[-] module.tag.lyrics3.php
[edit]
[-] module.graphic.svg.php
[edit]
[-] module.audio-video.matroska.php
[edit]
[-] getid3.lib.php
[edit]
[-] module.archive.tar.php
[edit]
[-] getid3.php
[edit]
[-] module.audio.monkey.php
[edit]
[-] module.misc.msoffice.php
[edit]
[-] module.audio.ogg.php
[edit]
[-] extension.cache.mysqli.php
[edit]
[-] module.audio.dsf.php
[edit]
[-] write.lyrics3.php
[edit]
[-] module.audio-video.nsv.php
[edit]
[-] module.graphic.png.php
[edit]
[-] module.audio-video.mpeg.php
[edit]
[-] module.audio-video.quicktime.php
[edit]
[-] module.audio.mpc.php
[edit]
[-] write.id3v1.php
[edit]
[-] module.audio-video.riff.php
[edit]
[-] module.graphic.bmp.php
[edit]
[-] module.graphic.gif.php
[edit]
[-] module.audio.wavpack.php
[edit]
[-] module.audio.dts.php
[edit]
[-] write.vorbiscomment.php
[edit]
[-] module.misc.cue.php
[edit]
[-] module.tag.id3v2.php
[edit]
[-] module.tag.apetag.php
[edit]
[-] module.archive.zip.php
[edit]
[-] module.tag.id3v1.php
[edit]
[-] module.audio.bonk.php
[edit]
[-] module.audio.mp3.php
[edit]
[-] write.apetag.php
[edit]
[-] extension.cache.sqlite3.php
[edit]
[-] module.audio.tta.php
[edit]
[-] write.real.php
[edit]
[-] module.audio.aa.php
[edit]
[-] module.archive.szip.php
[edit]
[-] module.audio.flac.php
[edit]
[-] write.php
[edit]
[-] module.misc.torrent.php
[edit]
[-] module.audio.aac.php
[edit]
[-] module.audio-video.asf.php
[edit]
[-] module.archive.hpk.php
[edit]
[-] module.audio-video.flv.php
[edit]
[-] module.audio.amr.php
[edit]
[-] module.audio.voc.php
[edit]
[-] module.audio-video.ts.php
[edit]