当前位置: 首页>>代码示例>>PHP>>正文


PHP getID3::setOption方法代码示例

本文整理汇总了PHP中getID3::setOption方法的典型用法代码示例。如果您正苦于以下问题:PHP getID3::setOption方法的具体用法?PHP getID3::setOption怎么用?PHP getID3::setOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在getID3的用法示例。


在下文中一共展示了getID3::setOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: metadata_video

/**
 * Fonction de récupération des métadonnées sur les fichiers vidéo
 * appelée à l'insertion en base dans le plugin medias (inc/renseigner_document)
 *
 * @param string $file
 *    Le chemin du fichier à analyser
 * @return array $metas
 *    Le tableau comprenant les différentes metas à mettre en base
 */
function metadata_video($file)
{
    $meta = array();
    include_spip('lib/getid3/getid3');
    $getID3 = new getID3();
    $getID3->setOption(array('tempdir' => _DIR_TMP));
    // Scan file - should parse correctly if file is not corrupted
    $file_info = $getID3->analyze($file);
    /**
     * Les pistes vidéos
     */
    if (isset($file_info['video'])) {
        $id3['hasvideo'] = 'oui';
        if (isset($file_info['video']['resolution_x'])) {
            $meta['largeur'] = $file_info['video']['resolution_x'];
        }
        if (isset($file_info['video']['resolution_y'])) {
            $meta['hauteur'] = $file_info['video']['resolution_y'];
        }
        if (isset($file_info['video']['frame_rate'])) {
            $meta['framerate'] = $file_info['video']['frame_rate'];
        }
    }
    if (isset($file_info['playtime_seconds'])) {
        $meta['duree'] = round($file_info['playtime_seconds'], 0);
    }
    return $meta;
}
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:37,代码来源:video.php

示例2: tag_mp3

function tag_mp3($filename, $songname, $albumname, $artist, $time)
{
    $TaggingFormat = 'UTF-8';
    // Initialize getID3 engine
    $getID3 = new getID3();
    $getID3->setOption(array('encoding' => $TaggingFormat));
    getid3_lib::IncludeDependency('/var/www/html/getid3/getid3/write.php', __FILE__, true);
    // Initialize getID3 tag-writing module
    $tagwriter = new getid3_writetags();
    $tagwriter->filename = $filename;
    $tagwriter->tagformats = array('id3v1', 'id3v2.3');
    // set various options (optional)
    $tagwriter->overwrite_tags = true;
    $tagwriter->tag_encoding = $TaggingFormat;
    $tagwriter->remove_other_tags = true;
    // populate data array
    $TagData['title'][] = $songname;
    $TagData['artist'][] = $artist;
    $TagData['album'][] = $albumname;
    $tagwriter->tag_data = $TagData;
    // write tags
    if ($tagwriter->WriteTags()) {
        echo 'Successfully wrote tags<br>';
        if (!empty($tagwriter->warnings)) {
            echo 'There were some warnings:<br>' . implode('<br><br>', $tagwriter->warnings);
        }
    } else {
        echo 'Failed to write tags!<br>' . implode('<br><br>', $tagwriter->errors);
    }
}
开发者ID:houndbee,项目名称:phqueue,代码行数:30,代码来源:mp3id3write.php

示例3: array

 function write_tags($file, $data = array())
 {
     App::import('Vendor', 'getid3/getid3/getid3');
     //getid3/getid3/getid3/getid3/getid3 ;)
     $g3 = new getID3();
     $g3->setOption(array('encoding' => 'UTF-8'));
     App::import('Vendor', 'getid3/getid3/write');
     $id3 = new getid3_writetags();
     $id3->filename = $file;
     $id3->tagformats = array('id3v1', 'id3v2.3');
     $id3->overwrite_tags = true;
     $id3->tag_encoding = 'UTF-8';
     $id3->remove_other_tags = false;
     $tags = array();
     foreach ($data as $key => $val) {
         if (is_array($val)) {
             foreach ($val as $v) {
                 $tags[$key][] = $v;
             }
         } else {
             $tags[$key][] = $val;
         }
     }
     $old_tags = $g3->analyze($file);
     getid3_lib::CopyTagsToComments($old_tags);
     $id3->tag_data = am($old_tags['comments'], $tags);
     if ($id3->WriteTags()) {
         if (!empty($id3->warnings)) {
             debug($id3->warnings);
         }
         return true;
     } else {
         debug($id3->errors);
     }
 }
开发者ID:busytoby,项目名称:gitrbug,代码行数:35,代码来源:collection_file.php

示例4: tag

 public static function tag($mp3, $image_name, $type)
 {
     $mp3_handler = new \getID3();
     $mp3_handler->setOption(['encoding' => 'UTF-8']);
     $mp3_writter = new \getid3_writetags();
     $mp3_writter->filename = Config::get('site.mp3_upload_path') . '/' . $mp3->mp3name;
     $mp3_writter->tagformats = array('id3v1', 'id3v2.3');
     $mp3_writter->overwrite_tags = true;
     $mp3_writter->tag_encoding = 'UTF-8';
     $mp3_writter->remove_other_tags = true;
     $mp3_data['title'][] = $mp3->name;
     $mp3_data['artist'][] = Config::get('site.name') . ' ' . Config::get('site.separator') . ' ' . Config::get('site.url');
     //$mp3_artist;
     $mp3_data['album'][] = Config::get('site.name') . ' ' . Config::get('site.separator') . ' ' . Config::get('site.url');
     // $mp3_data['year'][]    = $mp3_year;
     // $mp3_data['genre'][]   = $mp3_genre;
     $mp3_data['comment'][] = Config::get('site.name') . ' ' . Config::get('site.separator') . Config::get('site.url');
     if ($mp3->price == 'paid') {
         $mp3_data['attached_picture'][0]['data'] = file_get_contents(Config::get('site.image_upload_path') . '/thumbs/' . $image_name);
         $mp3_data['attached_picture'][0]['picturetypeid'] = $type;
         $mp3_data['attached_picture'][0]['mime'] = $type;
     } else {
         $mp3_data['attached_picture'][0]['data'] = file_get_contents(Config::get('site.logo'));
         $mp3_data['attached_picture'][0]['picturetypeid'] = "image/jpg";
         $mp3_data['attached_picture'][0]['mime'] = "image/jpg";
     }
     $mp3_data['attached_picture'][0]['description'] = Config::get('site.name') . ' ' . Config::get('site.separator') . ' ' . Config::get('site.description');
     $mp3_writter->tag_data = $mp3_data;
     return $mp3_writter->WriteTags();
 }
开发者ID:jgbneatdesign,项目名称:tikwenpam,代码行数:30,代码来源:TKPM.php

示例5: writeSongData

 public static function writeSongData(ArchiveSong $song)
 {
     $getID3 = new \getID3();
     $getID3->setOption(array('encoding' => 'UTF8'));
     $tagwriter = new \getid3_writetags();
     $tagwriter->filename = $song->file_path;
     $tagwriter->tagformats = array('id3v1', 'id3v2.3');
     $tagwriter->overwrite_tags = true;
     $tagwriter->tag_encoding = 'UTF8';
     $tagwriter->remove_other_tags = true;
     $tag_data = array('title' => array($song->title), 'artist' => array($song->artist), 'album' => array($song->album), 'year' => array($song->year), 'genre' => array($song->genre), 'track' => array($song->track_number));
     $art_path = $song->art_path;
     if ($art_path) {
         if ($fd = fopen($art_path, 'rb')) {
             $APICdata = fread($fd, filesize($art_path));
             fclose($fd);
             list($APIC_width, $APIC_height, $APIC_imageTypeID) = getimagesize($art_path);
             $imagetypes = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
             if (isset($imagetypes[$APIC_imageTypeID])) {
                 $tag_data['attached_picture'][0]['data'] = $APICdata;
                 $tag_data['attached_picture'][0]['picturetypeid'] = $APIC_imageTypeID;
                 $tag_data['attached_picture'][0]['description'] = basename($art_path);
                 $tag_data['attached_picture'][0]['mime'] = 'image/' . $imagetypes[$APIC_imageTypeID];
                 $tag_data['comments']['picture'][0] = $tag_data['attached_picture'][0];
             }
         }
     }
     $tagwriter->tag_data = $tag_data;
     // write tags
     if ($tagwriter->WriteTags()) {
         return true;
     } else {
         throw new \Exception(implode('<br><br>', $tagwriter->errors));
         return false;
     }
 }
开发者ID:Lavoaster,项目名称:PVLive,代码行数:36,代码来源:MusicManager.php

示例6: write_ID3

 /**
  * @param $path
  * @param $tags
  *
  * @return bool
  */
 public function write_ID3($path, $tags)
 {
     if (is_file(DOCPATH . $path)) {
         require_once APPPATH . 'libraries/getid3/getid3.php';
         $getID3 = new getID3();
         $getID3->setOption(array('encoding' => 'UTF-8'));
         getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'write.php', __FILE__, TRUE);
         $tagwriter = new getid3_writetags();
         $tagwriter->filename = $path;
         $tagwriter->tag_encoding = 'UTF-8';
         $tagwriter->tagformats = array('id3v1', 'id3v2.3');
         $tagwriter->overwrite_tags = TRUE;
         $tagwriter->tag_data = $tags;
         $tagwriter->WriteTags();
         if (!empty($tagwriter->warnings)) {
             return FALSE;
         }
         return TRUE;
     }
     return FALSE;
 }
开发者ID:trk,项目名称:ionize,代码行数:27,代码来源:media_model.php

示例7: update_id3_tags

function update_id3_tags($newfile, $filename, $dir_path, $line, $start, $stop)
{
    $TextEncoding = 'UTF-8';
    require_once 'getid3/getid3.php';
    // Initialize getID3 engine
    $getID3 = new getID3();
    $getID3->setOption(array('encoding' => $TextEncoding));
    require_once 'getid3/write.php';
    // Initialize getID3 tag-writing module
    $tagwriter = new getid3_writetags();
    //$tagwriter->filename = '/path/to/file.mp3';
    $tagwriter->filename = $newfile;
    //$tagwriter->tagformats = array('id3v1', 'id3v2.3');
    $tagwriter->tagformats = array('id3v2.3');
    // set various options (optional)
    $tagwriter->overwrite_tags = true;
    // if true will erase existing tag data and write only passed data; if false will merge passed data with existing tag data (experimental)
    $tagwriter->remove_other_tags = true;
    // if true removes other tag formats (e.g. ID3v1, ID3v2, APE, Lyrics3, etc) that may be present in the file and only write the specified tag format(s). If false leaves any unspecified tag formats as-is.
    $tagwriter->tag_encoding = $TextEncoding;
    $tagwriter->remove_other_tags = true;
    // populate data array
    $TagData = array('title' => array($line[0] . ' -D-E- ' . $line[7] . '(' . $line[8] . ')'), 'artist' => array('Japanese Core6k shadowing'), 'album' => array('Japanese Core6k shadowing ' . $start . ' to ' . $stop), 'year' => array('2016'), 'genre' => array('Educational'), 'comment' => array($line[7] . '(' . $line[8] . ')'));
    $tagwriter->tag_data = $TagData;
    // write tags
    if ($tagwriter->WriteTags()) {
        //	echo 'Successfully wrote tags<br>';
        if (!empty($tagwriter->warnings)) {
            echo 'There were some warnings:<br>' . implode('<br><br>', $tagwriter->warnings);
        }
    } else {
        echo 'Failed to write tags!<br>' . implode('<br><br>', $tagwriter->errors);
    }
}
开发者ID:alb404,项目名称:core6K-mp3-processor,代码行数:34,代码来源:iknow-processor.php

示例8: die

<?php

die("This script can be used to update ID3 tags. You must remove this die() statement to run.");
$base = "/var/www/nas/www.example.com/htdocs/streams";
require_once "{$base}/lib/Config.php";
require_once "{$base}/lib/Auth.php";
require_once "{$base}/lib/Streams.php";
require_once "{$base}/lib/getid3/getid3/getid3.php";
foreach (glob("{$base}/lib/getid3/getid3/*.php") as $resource) {
    require_once $resource;
}
$getID3 = new getID3();
$getID3->setOption(array("encoding" => "UTF-8"));
if (isset($_SERVER['argv'][1])) {
    $files[] = $_SERVER['argv'][1];
} else {
    $files = glob("*.mp3");
}
$c = count($files);
foreach ($files as $k => $f) {
    print "[{$k} of {$c}] Processing {$f}\n";
    $id3 = $getID3->analyze($f);
    // Set new ID3 tags
    unset($tagData);
    $tagData['title'] = array($id3['tags']['id3v2']['title'][0]);
    $tagData['artist'] = array($id3['tags']['id3v2']['artist'][0]);
    $tagData['album'] = array($id3['tags']['id3v2']['album'][0]);
    $tagData['genre'] = array($id3['tags']['id3v2']['genre'][0]);
    $tagData['track'] = array($id3['tags']['id3v2']['track_number'][0]);
    $tagData['year'] = array($id3['tags']['id3v2']['year'][0]);
    $tagData['comment'] = array("Ev1l Pr1sm");
开发者ID:MarvinMuuss,项目名称:zoopaz-radio,代码行数:31,代码来源:update_id3.php

示例9: writeID3Tags

 /**
  * Method for to write ID3Tags into file
  *
  * @param array $data ID3 tag items
  * @param string Kind of text encoding, for example UTF-8
  * @return boolean
  */
 public function writeID3Tags($data, $TextEncoding = 'UTF-8')
 {
     $dispatcher = JDispatcher::getInstance();
     require_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'id3' . DIRECTORY_SEPARATOR . 'getid3.php';
     require_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'id3' . DIRECTORY_SEPARATOR . 'write.php';
     // Initialize getID3 engine
     $getID3 = new getID3();
     $getID3->setOption(array('encoding' => $TextEncoding));
     $tagwriter = new getid3_writetags();
     $tagwriter->tagformats = array('id3v2.3');
     // Set various options
     $tagwriter->overwrite_tags = true;
     $tagwriter->tag_encoding = $TextEncoding;
     $tagwriter->remove_other_tags = true;
     $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Writing tags for: ' . $data['pathatlocal'] . '/' . $data['file'], 'priority' => JLog::INFO, 'section' => 'admin')));
     // Data for ID3 Tag
     $tagwriter->filename = $data['pathatlocal'] . '/' . $data['file'];
     // Get name for Genre ID
     if ($data['catid']) {
         $genre_name = self::getGenrename($data['catid'])->title;
     } else {
         $genre_name = null;
     }
     $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Name for Genre id: ' . $data['catid'] . ' is ' . $genre_name, 'priority' => JLog::INFO, 'section' => 'admin')));
     // Create data array for ID3 tag
     $TagData = array('title' => array($data['title']), 'artist' => array($data['artist']), 'album' => array($data['album']), 'year' => array($data['year']), 'genre' => array($genre_name), 'comment' => array('Edited by PlayJoom streaming server'), 'track' => array($data['tracknumber']));
     $tagwriter->tag_data = $TagData;
     // write ID3 tag
     if ($tagwriter->WriteTags()) {
         $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Writting of ID3 Tag successfully.', 'priority' => JLog::INFO, 'section' => 'admin')));
         if (!empty($tagwriter->warnings)) {
             $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Attention! ' . implode('<br>', $tagwriter->warnings), 'priority' => JLog::WARNING, 'section' => 'admin')));
             return false;
         }
     } else {
         $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Failed to write tags! ' . implode('<br>', $tagwriter->errors), 'priority' => JLog::WARNING, 'section' => 'admin')));
         return true;
     }
 }
开发者ID:TFToto,项目名称:playjoom-builds,代码行数:46,代码来源:audiotrack.php

示例10: foreach

     $add->videoid = $data->itemoldid;
 }
 if ($slides) {
     foreach ($unicalsjpg as $k => $v) {
         $name = 'image' . ($k + 1);
         $nameimg = 'img' . ($k + 1);
         if ($mediaboard->presetimages == 1) {
             $add->{$name} = $mediaboard->{$nameimg};
         } else {
             if ($file = mediaboard_getfile($v)) {
                 $add->{$name} = $file->id;
             }
         }
     }
     $getID3 = new getID3();
     $getID3->setOption(array('encoding' => 'UTF-8'));
     foreach ($unicalsmp3 as $k => $v) {
         $name = 'audio' . ($k + 1);
         $nameduration = 'duration' . ($k + 1);
         if ($file = mediaboard_getfile($v)) {
             $add->{$name} = $file->id;
             if ($usevoice[$v]) {
                 $ThisFileInfo = $getID3->analyze($file->fullpatch);
                 $add->{$nameduration} = @round((double) $ThisFileInfo['playtime_seconds'] * 1000);
             } else {
                 $add->{$nameduration} = 4000;
             }
         }
     }
 }
 $add->time = time();
开发者ID:e-rasvet,项目名称:mediaboard,代码行数:31,代码来源:edit.php

示例11: home

    public function home()
    {
        global $core;
        error_reporting(0);
        $v = $this->__(w('v'));
        if (!$v['v']) {
            $sql = 'SELECT media_id
				FROM _bio_media
				WHERE media_type = ?
					AND media_mp3 = ?
				LIMIT 1';
            $v['v'] = _field(sql_filter($sql, 1, 0), 'media_id', 0);
        }
        $tag_format = 'UTF-8';
        $relative_path = '/data/artists/%s/media/';
        $absolute_path = '/var/www/vhosts/rockrepublik.net/www' . $relative_path;
        $sql = 'SELECT m.*, b.bio_id, b.bio_name
			FROM _bio_media m
			LEFT JOIN _bio b ON m.media_bio = b.bio_id
			WHERE m.media_id = ?';
        //$spaths = '/data/artists/' . $songd['ub'] . '/media/';
        //$spath = '/var/www/vhosts/rockrepublik.net/httpdocs' . $spaths;
        if ($media = _fieldrow(sql_filter($sql, $v['v']))) {
            $row_relative = sprintf($relative_path, $media['bio_id']);
            $row_absolute = $absolute_path . $row_relative;
            $row_wma = $row_absolute . $media['media_id'] . '.wma';
            $row_mp3 = $row_absolute . $media['media_id'] . '.mp3';
            $rel_wma = '.' . $row_relative . $media['media_id'] . '.wma';
            $rel_mp3 = '.' . $row_relative . $media['media_id'] . '.mp3';
            if (@file_exists($rel_wma) && !@file_exists($rel_mp3) && !$media['media_mp3']) {
                exec('ffmpeg -i ' . $row_wma . ' -vn -ar 44100 -ac 2 -ab 64kb -f mp3 ' . $row_mp3);
                include_once XFS . XCOR . 'getid3/getid3.php';
                $getID3 = new getID3();
                $getID3->setOption(array('encoding' => $tag_format));
                getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'write.php', __FILE__, true);
                $tagwriter = new getid3_writetags();
                $tagwriter->filename = getid3_lib::SafeStripSlashes($row_mp3);
                $tagwriter->tagformats = array('id3v1');
                $tagwriter->overwrite_tags = true;
                $tagwriter->tag_encoding = $tag_format;
                $tagwriter->remove_other_tags = true;
                $tag_comment = 'Visita www.rockrepublik.net';
                $media['album'] = !empty($media['media_album']) ? $media['media_album'] : 'Single';
                $media['genre'] = !empty($media['media_genre']) ? $media['media_genre'] : 'Rock';
                $media_f = array('title', 'name', 'album', 'genre');
                foreach ($media_f as $mr) {
                    $media['media_' . $mr] = getid3_lib::SafeStripSlashes(utf8_encode(html_entity_decode($media['media_' . $mr])));
                }
                $tagwriter->tag_data = array('title' => array($media['media_title']), 'artist' => array($media['media_name']), 'album' => array($media['media_album']), 'year' => array(getid3_lib::SafeStripSlashes($media['media_year'])), 'genre' => array($media['media_genre']), 'comment' => array(getid3_lib::SafeStripSlashes($tag_comment)), 'tracknumber' => array(''));
                $tagwriter->WriteTags();
                $sql = 'UPDATE _bio_media SET media_mp3 = ?
					WHERE media_id = ?';
                _sql(sql_filter($sql, 1, $media['media_id']));
                $fp = @fopen('./conv.txt', 'a+');
                fwrite($fp, $row_mp3 . "\n");
                fclose($fp);
            }
            if (!@file_exists($rel_wma)) {
                $sql = 'UPDATE _bio_media SET media_mp3 = ?
					WHERE media_id = ?';
                _sql(sql_filter($sql, 2, $media['media_id']));
            }
        }
        $sql = 'SELECT media_id
			FROM _bio_media
			WHERE media_type = ?
				AND media_mp3 = ?
			LIMIT 1';
        if ($v_next = _field(sql_filter($sql, 1, 0), 'media_id', 0)) {
            sleep(1);
            _redirect(_link($this->m(), array('v' => $v_next)));
        } else {
            $this->e('no_next');
        }
        return $this->e('.');
    }
开发者ID:nopticon,项目名称:mag,代码行数:76,代码来源:_cvm.php

示例12: getID3

 public function getID3()
 {
     $getID3 = new getID3();
     $pageEncoding = 'UTF-8';
     $getID3->setOption(array("encoding" => $pageEncoding));
     return $getID3;
 }
开发者ID:MarvinMuuss,项目名称:zoopaz-radio,代码行数:7,代码来源:StreamsSearchIndexer.php

示例13: manageFileUpload

 private function manageFileUpload($object)
 {
     $directory = $object->getDirectory();
     $directory = preg_replace("/\\/\$/", '', $directory);
     if (!is_dir('/var/lib/mpd/music' . $directory)) {
         mkdir('/var/lib/mpd/music' . $directory, 0755);
     }
     if ($object->getUrl()) {
         $filename = $object->getUrl();
         $filename = explode("/", $filename);
         if (file_exists('/var/lib/mpd/' . $object->getUrl())) {
             rename('/var/lib/mpd/' . $object->getUrl(), '/var/lib/mpd/music' . $directory . '/' . end($filename));
             $object->setUrl('music' . $directory . '/' . end($filename));
         }
     }
     if ($object->getFile()) {
         $object->file->move('/var/lib/mpd/music' . $directory, $object->file->getClientOriginalName());
         $object->setUrl('music' . $directory . '/' . $object->file->getClientOriginalName());
     }
     /*
             if (null === $this->getFile()) {
                 return;
             }elseif(isset($this->temp) && null === $this->getFile()){
     			$this->getFile()->move('/var/lib/mpd/'.$this->temp, '/var/lib/mpd/'.$this->path);
     		}
     
             // check if we have an old image
             if (isset($this->temp)) {
                 // delete the old image
                 unlink('/var/lib/mpd/'.$this->temp);
                 // clear the temp image path
                 $this->temp = null;
             }
             $this->file = null;
     */
     if ($object->getUrl()) {
         if ($object->getTitle() || $object->getArtist() || $object->getAlbum() || $object->getGenre()) {
             $TextEncoding = 'UTF-8';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/libs/getid3/getid3.php';
             // Initialize getID3 engine
             $getID3 = new \getID3();
             $getID3->setOption(array('encoding' => $TextEncoding));
             require_once $_SERVER['DOCUMENT_ROOT'] . '/libs/getid3/write.php';
             // Initialize getID3 tag-writing module
             $tagwriter = new \getid3_writetags();
             //$tagwriter->filename = '/path/to/file.mp3';
             $tagwriter->filename = '/var/lib/mpd/' . $object->getUrl();
             //$tagwriter->tagformats = array('id3v1', 'id3v2.3');
             $tagwriter->tagformats = array('id3v2.3');
             // set various options (optional)
             //$tagwriter->overwrite_tags = true;
             //$tagwriter->overwrite_tags = false;
             $tagwriter->tag_encoding = $TextEncoding;
             $tagwriter->remove_other_tags = true;
             // populate data array
             $TagData = array('title' => array($object->getTitle()), 'artist' => array($object->getArtist()), 'album' => array($object->getAlbum()), 'genre' => array($object->getGenre()));
             $tagwriter->tag_data = $TagData;
             // write tags
             if (!$tagwriter->WriteTags()) {
                 die('Failed to write tags!<br>' . implode('<br><br>', $tagwriter->errors));
             }
         } else {
             $TextEncoding = 'UTF-8';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/libs/getid3/getid3.php';
             // Initialize getID3 engine
             $getID3 = new \getID3();
             $ThisFileInfo = $getID3->analyze('/var/lib/mpd/' . $object->getUrl());
             if (isset($ThisFileInfo['tags']['id3v2']['title'][0])) {
                 $object->setTitle($ThisFileInfo['tags']['id3v2']['title'][0]);
             }
             if (isset($ThisFileInfo['tags']['id3v2']['artist'][0])) {
                 $object->setArtist($ThisFileInfo['tags']['id3v2']['artist'][0]);
             }
             if (isset($ThisFileInfo['tags']['id3v2']['album'][0])) {
                 $object->setAlbum($ThisFileInfo['tags']['id3v2']['album'][0]);
             }
             if (isset($ThisFileInfo['tags']['id3v2']['genre'][0])) {
                 $object->setGenre($ThisFileInfo['tags']['id3v2']['genre'][0]);
             }
         }
     }
 }
开发者ID:Gribanovskiy,项目名称:symfony_radio,代码行数:82,代码来源:SongsAdmin.php

示例14: RemoveAccents

    ob_end_clean();
    die('Could not connect to MySQL host: <blockquote style="background-color: #FF9933; padding: 10px;">' . mysql_error() . '</blockquote>');
}
if (!mysql_select_db(GETID3_DB_DB)) {
    $errormessage = ob_get_contents();
    ob_end_clean();
    die('Could not select database: <blockquote style="background-color: #FF9933; padding: 10px;">' . mysql_error() . '</blockquote>');
}
ob_end_clean();
$getid3PHP_filename = realpath('../getid3/getid3.php');
if (!file_exists($getid3PHP_filename) || !(include_once $getid3PHP_filename)) {
    die('Cannot open ' . $getid3PHP_filename);
}
// Initialize getID3 engine
$getID3 = new getID3();
$getID3->setOption(array('option_md5_data' => $getid3_demo_mysql_md5_data, 'encoding' => $getid3_demo_mysql_encoding));
function RemoveAccents($string)
{
    // Revised version by markstewardØhotmail*com
    return strtr(strtr($string, 'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'), array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u'));
}
function BitrateColor($bitrate, $BitrateMaxScale = 768)
{
    // $BitrateMaxScale is bitrate of maximum-quality color (bright green)
    // below this is gradient, above is solid green
    $bitrate *= 256 / $BitrateMaxScale;
    // scale from 1-[768]kbps to 1-256
    $bitrate = round(min(max($bitrate, 1), 256));
    $bitrate--;
    // scale from 1-256kbps to 0-255kbps
    $Rcomponent = max(255 - $bitrate * 2, 0);
开发者ID:kaibosh,项目名称:nZEDb,代码行数:31,代码来源:demo.mysql.php

示例15: getmicrotime

/////////////////////////////////////////////////////////////////
if (!function_exists('getmicrotime')) {
    function getmicrotime()
    {
        list($usec, $sec) = explode(' ', microtime());
        return (double) $usec + (double) $sec;
    }
}
///////////////////////////////////////////////////////////////////////////////
$writescriptfilename = 'demo.write.php';
require_once '../getid3/getid3.php';
// Needed for windows only
define('GETID3_HELPERAPPSDIR', 'C:/helperapps/');
// Initialize getID3 engine
$getID3 = new getID3();
$getID3->setOption(array('encoding' => 'UTF-8'));
$getID3checkColor_Head = 'CCCCDD';
$getID3checkColor_DirectoryLight = 'FFCCCC';
$getID3checkColor_DirectoryDark = 'EEBBBB';
$getID3checkColor_FileLight = 'EEEEEE';
$getID3checkColor_FileDark = 'DDDDDD';
$getID3checkColor_UnknownLight = 'CCCCFF';
$getID3checkColor_UnknownDark = 'BBBBDD';
///////////////////////////////////////////////////////////////////////////////
header('Content-Type: text/html; charset=UTF-8');
ob_start();
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
echo '<html><head>';
echo '<title>getID3() - /demo/demo.browse.php (sample script)</title>';
echo '<link rel="stylesheet" href="getid3.css" type="text/css">';
echo '</head><body>';
开发者ID:busytoby,项目名称:gitrbug,代码行数:31,代码来源:demo.browse.php


注:本文中的getID3::setOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。