本文整理汇总了PHP中getid3_id3v1类的典型用法代码示例。如果您正苦于以下问题:PHP getid3_id3v1类的具体用法?PHP getid3_id3v1怎么用?PHP getid3_id3v1使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了getid3_id3v1类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: 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
示例3: 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
示例4: write
public function write()
{
// remove existing apetag
$this->remove();
$engine = new getid3();
$engine->filename = $this->filename;
$engine->fp = fopen($this->filename, 'rb');
$engine->include_module('tag.id3v1');
$engine->include_module('tag.lyrics3');
$tag = new getid3_id3v1($engine);
$tag->Analyze();
$tag = new getid3_lyrics3($engine);
$tag->Analyze();
$apetag = $this->generate_tag();
if (!($fp = @fopen($this->filename, 'a+b'))) {
throw new getid3_exception('Could not open a+b: ' . $this->filename);
}
// init: audio ends at eof
$post_audio_offset = filesize($this->filename);
// lyrics3 tag present
if (@$engine->info['lyrics3']['tag_offset_start']) {
// audio ends before lyrics3 tag
$post_audio_offset = @$engine->info['lyrics3']['tag_offset_start'];
} elseif (@$engine->info['id3v1']['tag_offset_start']) {
// audio ends before id3v1 tag
$post_audio_offset = $engine->info['id3v1']['tag_offset_start'];
}
// seek to end of audio data
fseek($fp, $post_audio_offset, SEEK_SET);
// save data after audio data
$post_audio_data = '';
if (filesize($this->filename) > $post_audio_offset) {
$post_audio_data = fread($fp, filesize($this->filename) - $post_audio_offset);
}
// truncate file before start of new apetag
fseek($fp, $post_audio_offset, SEEK_SET);
ftruncate($fp, ftell($fp));
// write new apetag
fwrite($fp, $apetag, strlen($apetag));
// rewrite data after audio
if (!empty($post_audio_data)) {
fwrite($fp, $post_audio_data, strlen($post_audio_data));
}
fclose($fp);
clearstatcache();
return true;
}
开发者ID:JPisaBrony,项目名称:SonicFlow,代码行数:47,代码来源:write.apetag.php
示例5: FormatDataForID3v1
function FormatDataForID3v1()
{
$tag_data_id3v1['genreid'] = 255;
if (!empty($this->tag_data['GENRE'])) {
foreach ($this->tag_data['GENRE'] as $key => $value) {
if (getid3_id3v1::LookupGenreID($value) !== false) {
$tag_data_id3v1['genreid'] = getid3_id3v1::LookupGenreID($value);
break;
}
}
}
$tag_data_id3v1['title'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['TITLE']));
$tag_data_id3v1['artist'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['ARTIST']));
$tag_data_id3v1['album'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['ALBUM']));
$tag_data_id3v1['year'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['YEAR']));
$tag_data_id3v1['comment'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['COMMENT']));
$tag_data_id3v1['track'] = intval(getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['TRACKNUMBER'])));
if ($tag_data_id3v1['track'] <= 0) {
$tag_data_id3v1['track'] = '';
}
$this->MergeExistingTagData('id3v1', $tag_data_id3v1);
return $tag_data_id3v1;
}
开发者ID:ookwudili,项目名称:chisimba,代码行数:23,代码来源:write.php
示例6: WindowsShareSlashTranslate
echo WindowsShareSlashTranslate($row['filename']) . "\n";
}
exit;
} else {
if ($_REQUEST['genredistribution'] == '%') {
$SQLquery = 'SELECT COUNT(*) AS `num`, `genre`';
$SQLquery .= ' FROM `' . mysql_real_escape_string(GETID3_DB_TABLE) . '`';
$SQLquery .= ' WHERE (`fileformat` NOT LIKE "' . implode('") AND (`fileformat` NOT LIKE "', $IgnoreNoTagFormats) . '")';
$SQLquery .= ' GROUP BY `genre`';
$SQLquery .= ' ORDER BY `num` DESC';
$result = mysql_query_safe($SQLquery);
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'module.tag.id3v1.php', __FILE__, true);
echo '<table border="1" cellspacing="0" cellpadding="4">';
echo '<tr><th>Count</th><th>Genre</th><th>m3u</th></tr>';
while ($row = mysql_fetch_array($result)) {
$GenreID = getid3_id3v1::LookupGenreID($row['genre']);
if (is_numeric($GenreID)) {
echo '<tr bgcolor="#00FF00;">';
} else {
echo '<tr bgcolor="#FF9999;">';
}
echo '<td><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?genredistribution=' . urlencode($row['genre'])) . '">' . number_format($row['num']) . '</a></td>';
echo '<td nowrap>' . str_replace("\t", '<br>', $row['genre']) . '</td>';
echo '<td><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?m3u=.m3u&genredistribution=' . urlencode($row['genre'])) . '">.m3u</a></td>';
echo '</tr>';
}
echo '</table><hr>';
} else {
$SQLquery = 'SELECT `filename`, `genre`';
$SQLquery .= ' FROM `' . mysql_real_escape_string(GETID3_DB_TABLE) . '`';
$SQLquery .= ' WHERE (`genre` LIKE "' . mysql_real_escape_string($_REQUEST['genredistribution']) . '")';
开发者ID:kaibosh,项目名称:nZEDb,代码行数:31,代码来源:demo.mysql.php
示例7: ParseID3v2GenreString
function ParseID3v2GenreString($genrestring)
{
// Parse genres into arrays of genreName and genreID
// ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)'
// ID3v2.4.x: '21' $00 'Eurodisco' $00
$clean_genres = array();
if (strpos($genrestring, "") === false) {
$genrestring = preg_replace('#\\(([0-9]{1,3})\\)#', '$1' . "", $genrestring);
}
$genre_elements = explode("", $genrestring);
foreach ($genre_elements as $element) {
$element = trim($element);
if ($element) {
if (preg_match('#^[0-9]{1,3}#', $element)) {
$clean_genres[] = getid3_id3v1::LookupGenreName($element);
} else {
$clean_genres[] = str_replace('((', '(', $element);
}
}
}
return $clean_genres;
}
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:22,代码来源:module.tag.id3v2.php
示例8: QuicktimeParseAtom
//.........这里部分代码省略.........
$atomoffset += $boxsize;
switch ($boxtype) {
case 'mean':
case 'name':
$atom_structure[$boxtype] = substr($boxdata, 4);
break;
case 'data':
$atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1));
$atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3));
switch ($atom_structure['flags_raw']) {
case 0:
// data flag
// data flag
case 21:
// tmpo/cpil flag
switch ($atomname) {
case 'cpil':
case 'pcst':
case 'pgap':
$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
break;
case 'tmpo':
$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 2));
break;
case 'disk':
case 'trkn':
$num = getid3_lib::BigEndian2Int(substr($boxdata, 10, 2));
$num_total = getid3_lib::BigEndian2Int(substr($boxdata, 12, 2));
$atom_structure['data'] = empty($num) ? '' : $num;
$atom_structure['data'] .= empty($num_total) ? '' : '/' . $num_total;
break;
case 'gnre':
$GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
$atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1);
break;
case 'rtng':
$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
$atom_structure['data'] = $this->QuicktimeContentRatingLookup($atom_structure[$atomname]);
break;
case 'stik':
$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
$atom_structure['data'] = $this->QuicktimeSTIKLookup($atom_structure[$atomname]);
break;
case 'sfID':
$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
$atom_structure['data'] = $this->QuicktimeStoreFrontCodeLookup($atom_structure[$atomname]);
break;
case 'egid':
case 'purl':
$atom_structure['data'] = substr($boxdata, 8);
break;
default:
$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
}
break;
case 1:
// text flag
// text flag
case 13:
// image flag
// image flag
default:
$atom_structure['data'] = substr($boxdata, 8);
if ($atomname == 'covr') {
// not a foolproof check, but better than nothing
if (preg_match('#^\\xFF\\xD8\\xFF#', $atom_structure['data'])) {
开发者ID:rauldobrota,项目名称:zenphoto,代码行数:67,代码来源:module.audio-video.quicktime.php
示例9: ParseID3v2GenreString
public static function ParseID3v2GenreString($genre_string)
{
// Parse genres into arrays of genreName and genreID
// ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)'
// ID3v2.4.x: '21' $00 'Eurodisco' $00
$genre_string = trim($genre_string);
$return_array = array();
if (strpos($genre_string, "") !== false) {
$unprocessed = trim($genre_string);
// trailing nulls will cause an infinite loop.
$genre_string = '';
while (strpos($unprocessed, "") !== false) {
// convert null-seperated v2.4-format into v2.3 ()-seperated format
$end_pos = strpos($unprocessed, "");
$genre_string .= '(' . substr($unprocessed, 0, $end_pos) . ')';
$unprocessed = substr($unprocessed, $end_pos + 1);
}
unset($unprocessed);
} elseif (preg_match('/^([0-9]+|CR|RX)$/i', $genre_string)) {
// some tagging program (including some that use TagLib) fail to include null byte after numeric genre
$genre_string = '(' . $genre_string . ')';
}
if (getid3_id3v1::LookupGenreID($genre_string)) {
$return_array['genre'][] = $genre_string;
} else {
while (strpos($genre_string, '(') !== false) {
$start_pos = strpos($genre_string, '(');
$end_pos = strpos($genre_string, ')');
if (substr($genre_string, $start_pos + 1, 1) == '(') {
$genre_string = substr($genre_string, 0, $start_pos) . substr($genre_string, $start_pos + 1);
$end_pos--;
}
$element = substr($genre_string, $start_pos + 1, $end_pos - ($start_pos + 1));
$genre_string = substr($genre_string, 0, $start_pos) . substr($genre_string, $end_pos + 1);
if (getid3_id3v1::LookupGenreName($element)) {
// $element is a valid genre id/abbreviation
if (empty($return_array['genre']) || !in_array(getid3_id3v1::LookupGenreName($element), $return_array['genre'])) {
// avoid duplicate entires
$return_array['genre'][] = getid3_id3v1::LookupGenreName($element);
}
} else {
if (empty($return_array['genre']) || !in_array($element, $return_array['genre'])) {
// avoid duplicate entires
$return_array['genre'][] = $element;
}
}
}
}
if ($genre_string) {
if (empty($return_array['genre']) || !in_array($genre_string, $return_array['genre'])) {
// avoid duplicate entires
$return_array['genre'][] = $genre_string;
}
}
return $return_array;
}
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:56,代码来源:module.tag.id3v2.php
示例10: elseif
} elseif (!empty($OldThisFileInfo['comments']['track']) && is_array($OldThisFileInfo['comments']['track'])) {
$RawTrackNumberArray = $OldThisFileInfo['comments']['track'];
} else {
$RawTrackNumberArray = array();
}
foreach ($RawTrackNumberArray as $key => $value) {
if (strlen($value) > strlen($TrackNumber)) {
// ID3v1 may store track as "3" but ID3v2/APE would store as "03/16"
$TrackNumber = $value;
}
}
if (strstr($TrackNumber, '/')) {
list($TrackNumber, $TracksTotal) = explode('/', $TrackNumber);
}
echo '<tr><td align="right"><b>Track</b></td><td><input type="text" size="2" name="Track" value="' . htmlentities($TrackNumber, ENT_QUOTES) . '"> of <input type="text" size="2" name="TracksTotal" value="' . htmlentities($TracksTotal, ENT_QUOTES) . '"></TD></TR>';
$ArrayOfGenresTemp = getid3_id3v1::ArrayOfGenres();
// get the array of genres
foreach ($ArrayOfGenresTemp as $key => $value) {
// change keys to match displayed value
$ArrayOfGenres[$value] = $value;
}
unset($ArrayOfGenresTemp);
// remove temporary array
unset($ArrayOfGenres['Cover']);
// take off these special cases
unset($ArrayOfGenres['Remix']);
unset($ArrayOfGenres['Unknown']);
$ArrayOfGenres[''] = '- Unknown -';
// Add special cases back in with renamed key/value
$ArrayOfGenres['Cover'] = '-Cover-';
$ArrayOfGenres['Remix'] = '-Remix-';
开发者ID:mayoalexander,项目名称:fl-two,代码行数:31,代码来源:demo.write.php
示例11: ParseID3v2GenreString
public function ParseID3v2GenreString($genrestring)
{
// Parse genres into arrays of genreName and genreID
// ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)'
// ID3v2.4.x: '21' $00 'Eurodisco' $00
$clean_genres = array();
if (strpos($genrestring, "") === false) {
$genrestring = preg_replace('#\\(([0-9]{1,3})\\)#', '$1' . "", $genrestring);
}
// note: MusicBrainz Picard incorrectly stores plaintext genres separated by "/" when writing in ID3v2.3 mode, hack-fix here:
// replace / with NULL, then replace back the two ID3v1 genres that legitimately have "/" as part of the single genre name
$genrestring = str_replace('/', "", $genrestring);
$genrestring = str_replace('Pop' . "" . 'Funk', 'Pop/Funk', $genrestring);
$genrestring = str_replace('Rock' . "" . 'Rock', 'Folk/Rock', $genrestring);
// some other taggers separate multiple genres with semicolon, e.g. "Heavy Metal;Thrash Metal;Metal"
$genrestring = str_replace(';', "", $genrestring);
$genre_elements = explode("", $genrestring);
foreach ($genre_elements as $element) {
$element = trim($element);
if ($element) {
if (preg_match('#^[0-9]{1,3}#', $element)) {
$clean_genres[] = getid3_id3v1::LookupGenreName($element);
} else {
$clean_genres[] = str_replace('((', '(', $element);
}
}
}
return $clean_genres;
}
开发者ID:Jax24135,项目名称:d740ftp,代码行数:29,代码来源:module.tag.id3v2.php
示例12: generate_tag
protected function generate_tag()
{
$result = 'TAG';
$result .= str_pad(trim(substr($this->title, 0, 30)), 30, "", STR_PAD_RIGHT);
$result .= str_pad(trim(substr($this->artist, 0, 30)), 30, "", STR_PAD_RIGHT);
$result .= str_pad(trim(substr($this->album, 0, 30)), 30, "", STR_PAD_RIGHT);
$result .= str_pad(trim(substr($this->year, 0, 4)), 4, "", STR_PAD_LEFT);
if (!empty($this->track) && $this->track > 0 && $this->track <= 255) {
$result .= str_pad(trim(substr($this->comment, 0, 28)), 28, "", STR_PAD_RIGHT);
$result .= "";
$result .= chr($this->track);
} else {
$result .= str_pad(trim(substr($comment, 0, 30)), 30, "", STR_PAD_RIGHT);
}
// both genre and genre_id set
if ($this->genre && $this->genre_id) {
if ($this->genre != getid3_id3v1::LookupGenreName($this->genre_id)) {
throw new getid3_exception('Genre and genre_id does not match. Unset one and the other will be determined automatically.');
}
} elseif ($this->genre) {
$this->genre_id = getid3_id3v1::LookupGenreID($this->genre);
} else {
if ($this->genre_id < 0 || $this->genre_id > 147) {
$this->genre_id = 255;
// 'unknown' genre
}
$this->genre = getid3_id3v1::LookupGenreName($this->genre_id);
}
$result .= chr(intval($this->genre_id));
return $result;
}
开发者ID:peterlindkvist,项目名称:apache-player,代码行数:31,代码来源:write.id3v1.php
示例13: QuicktimeParseAtom
//.........这里部分代码省略.........
$boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8);
switch ($boxtype) {
case 'mean':
case 'name':
$atom_structure[$boxtype] = substr($boxdata, 4);
break;
case 'data':
$atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1));
$atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3));
switch ($atom_structure['flags_raw']) {
case 0:
// data flag
// data flag
case 21:
// tmpo/cpil flag
switch ($atomname) {
case 'cpil':
case 'pcst':
case 'pgap':
$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
break;
case 'tmpo':
$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 2));
break;
case 'disk':
case 'trkn':
$num = getid3_lib::BigEndian2Int(substr($boxdata, 10, 2));
$num_total = getid3_lib::BigEndian2Int(substr($boxdata, 12, 2));
$atom_structure['data'] = empty($num) ? '' : $num;
$atom_structure['data'] .= empty($num_total) ? '' : '/' . $num_total;
break;
case 'gnre':
$GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
$atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1);
break;
case 'rtng':
$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
$atom_structure['data'] = $this->QuicktimeContentRatingLookup($atom_structure[$atomname]);
break;
case 'stik':
$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
$atom_structure['data'] = $this->QuicktimeSTIKLookup($atom_structure[$atomname]);
break;
case 'sfID':
$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
$atom_structure['data'] = $this->QuicktimeStoreFrontCodeLookup($atom_structure[$atomname]);
break;
case 'egid':
case 'purl':
$atom_structure['data'] = substr($boxdata, 8);
break;
default:
$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
}
break;
case 1:
// text flag
// text flag
case 13:
// image flag
// image flag
default:
$atom_structure['data'] = substr($boxdata, 8);
break;
}
break;
开发者ID:sahartak,项目名称:newsroyal,代码行数:67,代码来源:module.audio-video.quicktime.php
示例14: ParseID3v2GenreString
function ParseID3v2GenreString($genrestring)
{
// Parse genres into arrays of genreName and genreID
// ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)'
// ID3v2.4.x: '21' $00 'Eurodisco' $00
$genrestring = trim($genrestring);
$returnarray = array();
if (strpos($genrestring, "") !== false) {
$unprocessed = trim($genrestring);
// trailing nulls will cause an infinite loop.
$genrestring = '';
while (strpos($unprocessed, "") !== false) {
// convert null-seperated v2.4-format into v2.3 ()-seperated format
$endpos = strpos($unprocessed, "");
$genrestring .= '(' . substr($unprocessed, 0, $endpos) . ')';
$unprocessed = substr($unprocessed, $endpos + 1);
}
unset($unprocessed);
}
if (getid3_id3v1::LookupGenreID($genrestring)) {
$returnarray['genre'][] = $genrestring;
} else {
while (strpos($genrestring, '(') !== false) {
$startpos = strpos($genrestring, '(');
$endpos = strpos($genrestring, ')');
if (substr($genrestring, $startpos + 1, 1) == '(') {
$genrestring = substr($genrestring, 0, $startpos) . substr($genrestring, $startpos + 1);
$endpos--;
}
$element = substr($genrestring, $startpos + 1, $endpos - ($startpos + 1));
$genrestring = substr($genrestring, 0, $startpos) . substr($genrestring, $endpos + 1);
if (getid3_id3v1::LookupGenreName($element)) {
// $element is a valid genre id/abbreviation
if (empty($returnarray['genre']) || !in_array(getid3_id3v1::LookupGenreName($element), $returnarray['genre'])) {
// avoid duplicate entires
$returnarray['genre'][] = getid3_id3v1::LookupGenreName($element);
}
} else {
if (empty($returnarray['genre']) || !in_array($element, $returnarray['genre'])) {
// avoid duplicate entires
$returnarray['genre'][] = $element;
}
}
}
}
if ($genrestring) {
if (empty($returnarray['genre']) || !in_array($genrestring, $returnarray['genre'])) {
// avoid duplicate entires
$returnarray['genre'][] = $genrestring;
}
}
return $returnarray;
}
开发者ID:scottatron,项目名称:opentape,代码行数:53,代码来源:module.tag.id3v2.php
示例15: LookupGenreID
public static function LookupGenreID($genre, $allow_SCMPX_extended = false)
{
$lookup = getid3_id3v1::ArrayOfGenres($allow_SCMPX_extended);
$lower_case_no_space_search_term = strtolower(str_replace(' ', '', $genre));
foreach ($lookup as $key => $value) {
foreach ($lookup as $key => $value) {
if (strtolower(str_replace(' ', '', $value)) == $lower_case_no_space_search_term) {
return $key;
}
}
return false;
}
return isset($lookup[$genre_id]) ? $lookup[$genre_id] : false;
}
开发者ID:ryumaru,项目名称:ryuzinewriter,代码行数:14,代码来源:module.tag.id3v1.php
示例16: StandardiseID3v1GenreName
function StandardiseID3v1GenreName($OriginalGenre)
{
if (($GenreID = getid3_id3v1::LookupGenreID($OriginalGenre)) !== false) {
return getid3_id3v1::LookupGenreName($GenreID);
}
return $OriginalGenre;
}
开发者ID:nan0desu,项目名称:xyntach,代码行数:7,代码来源:module.tag.id3v1.php
示例17: getid3_asf
//.........这里部分代码省略.........
// BOOL
$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = (bool) getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
break;
case 0x3:
// DWORD
// DWORD
case 0x4:
// QWORD
// QWORD
case 0x5:
// WORD
$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
break;
default:
$ThisFileInfo['warning'][] = 'extended_content_description.content_descriptors.' . $ExtendedContentDescriptorsCounter . '.value_type is invalid (' . $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'] . ')';
//return false;
break;
}
switch ($this->TrimConvert(strtolower($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']))) {
case 'wm/albumartist':
case 'artist':
$thisfile_asf_comments['artist'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
break;
case 'wm/albumtitle':
case 'album':
$thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
break;
case 'wm/genre':
case 'genre':
$genre = $this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
// id3v1 module might not be loaded
$GETID3_ERRORARRAY =& $ThisFileInfo['warning'];
if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'module.tag.id3v1.php', __FILE__, false)) {
$CleanedGenre = getid3_id3v1::StandardiseID3v1GenreName($genre);
// convert to standard GenreID and back to standard spelling/capitalization
if ($CleanedGenre != $genre) {
$genre = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', $CleanedGenre);
}
}
$thisfile_asf_comments['genre'] = array($genre);
break;
case 'wm/tracknumber':
case 'tracknumber':
$thisfile_asf_comments['track'] = array(intval($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])));
break;
case 'wm/track':
if (empty($thisfile_asf_comments['track'])) {
$thisfile_asf_comments['track'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
}
break;
case 'wm/year':
case 'year':
case 'date':
$thisfile_asf_comments['year'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
break;
case 'isvbr':
if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']) {
$thisfile_audio['bitrate_mode'] = 'vbr';
$thisfile_video['bitrate_mode'] = 'vbr';
}
break;
case 'id3':
// id3v2 module might not be loaded
if (class_exists('getid3_id3v2')) {
if ($tempfilehandle = tmpfile()) {
$tempThisfileInfo = array('encoding' => $ThisFileInfo['encoding']);
开发者ID:ericaustinlee,项目名称:ribcage,代码行数:67,代码来源:module.audio-video.asf.php
示例18: testShouldWriteAndReadGenre
/**
* @covers \GravityMedia\Metadata\Tag\Id3v1::getGenre
*/
public function testShouldWriteAndReadGenre()
{
$availableGenres = array_values(Id3v1Processor::ArrayOfGenres());
$expected = $availableGenres[array_rand($availableGenres)];
$this->file->getMetadata()->getId3v1Tag()->setGenre($expected)->save();
$this->assertEquals($expected, $this->file->getMetadata()->getId3v1Tag()->getGenre());
}
开发者ID:gravitymedia,项目名称:metadata,代码行数:10,代码来源:Id3v1Test.php
注:本文中的getid3_id3v1类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论