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


PHP getid3_id3v1::GenerateID3v1Tag方法代码示例

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


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

示例1: WriteID3v1

 function WriteID3v1()
 {
     if (filesize($this->filename) >= pow(2, 31) - 128 || filesize($this->filename) < 0) {
         $this->errors[] = 'Unable to write ID3v1 because file is larger than 2GB';
         return false;
     }
     // File MUST be writeable - CHMOD(646) at least
     if (is_writeable($this->filename)) {
         ob_start();
         if ($fp_source = fopen($this->filename, 'r+b')) {
             ob_end_clean();
             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
             }
             $this->tag_data['track'] = isset($this->tag_data['track']) ? $this->tag_data['track'] : (isset($this->tag_data['track_number']) ? $this->tag_data['track_number'] : (isset($this->tag_data['tracknumber']) ? $this->tag_data['tracknumber'] : ''));
             $new_id3v1_tag_data = getid3_id3v1::GenerateID3v1Tag(isset($this->tag_data['title']) ? $this->tag_data['title'] : '', isset($this->tag_data['artist']) ? $this->tag_data['artist'] : '', isset($this->tag_data['album']) ? $this->tag_data['album'] : '', isset($this->tag_data['year']) ? $this->tag_data['year'] : '', isset($this->tag_data['genreid']) ? $this->tag_data['genreid'] : '', isset($this->tag_data['comment']) ? $this->tag_data['comment'] : '', isset($this->tag_data['track']) ? $this->tag_data['track'] : '');
             fwrite($fp_source, $new_id3v1_tag_data, 128);
             fclose($fp_source);
             return true;
         } else {
             $errormessage = ob_get_contents();
             ob_end_clean();
             $this->errors[] = 'Could not open ' . $this->filename . ' mode "r+b"';
             return false;
         }
     }
     $this->errors[] = 'File is not writeable: ' . $this->filename;
     return false;
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:34,代码来源:write.id3v1.php

示例2: WriteID3v1

 function WriteID3v1()
 {
     // File MUST be writeable - CHMOD(646) at least
     if (!empty($this->filename) && is_readable($this->filename) && is_writable($this->filename) && is_file($this->filename)) {
         $this->setRealFileSize();
         if ($this->filesize <= 0 || !getid3_lib::intValueSupported($this->filesize)) {
             $this->errors[] = 'Unable to WriteID3v1(' . $this->filename . ') because filesize (' . $this->filesize . ') is larger than ' . round(PHP_INT_MAX / 1073741824) . 'GB';
             return false;
         }
         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
             }
             $this->tag_data['track'] = isset($this->tag_data['track']) ? $this->tag_data['track'] : (isset($this->tag_data['track_number']) ? $this->tag_data['track_number'] : (isset($this->tag_data['tracknumber']) ? $this->tag_data['tracknumber'] : ''));
             $new_id3v1_tag_data = getid3_id3v1::GenerateID3v1Tag(isset($this->tag_data['title']) ? $this->tag_data['title'] : '', isset($this->tag_data['artist']) ? $this->tag_data['artist'] : '', isset($this->tag_data['album']) ? $this->tag_data['album'] : '', isset($this->tag_data['year']) ? $this->tag_data['year'] : '', isset($this->tag_data['genreid']) ? $this->tag_data['genreid'] : '', isset($this->tag_data['comment']) ? $this->tag_data['comment'] : '', isset($this->tag_data['track']) ? $this->tag_data['track'] : '');
             fwrite($fp_source, $new_id3v1_tag_data, 128);
             fclose($fp_source);
             return true;
         } else {
             $this->errors[] = 'Could not fopen(' . $this->filename . ', "r+b")';
             return false;
         }
     }
     $this->errors[] = 'File is not writeable: ' . $this->filename;
     return false;
 }
开发者ID:ricofreak,项目名称:omekaArchiveProject,代码行数:31,代码来源:write.id3v1.php

示例3: WriteID3v1

 function WriteID3v1()
 {
     // 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;
 }
开发者ID:artistafrustrado,项目名称:debaser-diaadiaeducacao,代码行数:25,代码来源:write.id3v1.php


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