本文整理匯總了PHP中getid3_lib::PlaytimeString方法的典型用法代碼示例。如果您正苦於以下問題:PHP getid3_lib::PlaytimeString方法的具體用法?PHP getid3_lib::PlaytimeString怎麽用?PHP getid3_lib::PlaytimeString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類getid3_lib
的用法示例。
在下文中一共展示了getid3_lib::PlaytimeString方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ChannelsBitratePlaytimeCalculations
function ChannelsBitratePlaytimeCalculations()
{
// set channelmode on audio
if (@$this->info['audio']['channels'] == '1') {
$this->info['audio']['channelmode'] = 'mono';
} elseif (@$this->info['audio']['channels'] == '2') {
$this->info['audio']['channelmode'] = 'stereo';
}
// Calculate combined bitrate - audio + video
$CombinedBitrate = 0;
$CombinedBitrate += isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0;
$CombinedBitrate += isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0;
if ($CombinedBitrate > 0 && empty($this->info['bitrate'])) {
$this->info['bitrate'] = $CombinedBitrate;
}
//if ((isset($this->info['video']) && !isset($this->info['video']['bitrate'])) || (isset($this->info['audio']) && !isset($this->info['audio']['bitrate']))) {
// // for example, VBR MPEG video files cannot determine video bitrate:
// // should not set overall bitrate and playtime from audio bitrate only
// unset($this->info['bitrate']);
//}
if (!isset($this->info['playtime_seconds']) && !empty($this->info['bitrate'])) {
$this->info['playtime_seconds'] = ($this->info['avdataend'] - $this->info['avdataoffset']) * 8 / $this->info['bitrate'];
}
// Set playtime string
if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) {
$this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']);
}
}
示例2: ChannelsBitratePlaytimeCalculations
public function ChannelsBitratePlaytimeCalculations()
{
// set channelmode on audio
if (!empty($this->info['audio']['channelmode']) || !isset($this->info['audio']['channels'])) {
// ignore
} elseif ($this->info['audio']['channels'] == 1) {
$this->info['audio']['channelmode'] = 'mono';
} elseif ($this->info['audio']['channels'] == 2) {
$this->info['audio']['channelmode'] = 'stereo';
}
// Calculate combined bitrate - audio + video
$CombinedBitrate = 0;
$CombinedBitrate += isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0;
$CombinedBitrate += isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0;
if ($CombinedBitrate > 0 && empty($this->info['bitrate'])) {
$this->info['bitrate'] = $CombinedBitrate;
}
//if ((isset($this->info['video']) && !isset($this->info['video']['bitrate'])) || (isset($this->info['audio']) && !isset($this->info['audio']['bitrate']))) {
// // for example, VBR MPEG video files cannot determine video bitrate:
// // should not set overall bitrate and playtime from audio bitrate only
// unset($this->info['bitrate']);
//}
// video bitrate undetermined, but calculable
if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || $this->info['video']['bitrate'] == 0)) {
// if video bitrate not set
if (isset($this->info['audio']['bitrate']) && $this->info['audio']['bitrate'] > 0 && $this->info['audio']['bitrate'] == $this->info['bitrate']) {
// AND if audio bitrate is set to same as overall bitrate
if (isset($this->info['playtime_seconds']) && $this->info['playtime_seconds'] > 0) {
// AND if playtime is set
if (isset($this->info['avdataend']) && isset($this->info['avdataoffset'])) {
// AND if AV data offset start/end is known
// THEN we can calculate the video bitrate
$this->info['bitrate'] = round(($this->info['avdataend'] - $this->info['avdataoffset']) * 8 / $this->info['playtime_seconds']);
$this->info['video']['bitrate'] = $this->info['bitrate'] - $this->info['audio']['bitrate'];
}
}
}
}
if ((!isset($this->info['playtime_seconds']) || $this->info['playtime_seconds'] <= 0) && !empty($this->info['bitrate'])) {
$this->info['playtime_seconds'] = ($this->info['avdataend'] - $this->info['avdataoffset']) * 8 / $this->info['bitrate'];
}
if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) {
$this->info['bitrate'] = ($this->info['avdataend'] - $this->info['avdataoffset']) * 8 / $this->info['playtime_seconds'];
}
if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) {
if (isset($this->info['audio']['dataformat']) && empty($this->info['video']['resolution_x'])) {
// audio only
$this->info['audio']['bitrate'] = $this->info['bitrate'];
} elseif (isset($this->info['video']['resolution_x']) && empty($this->info['audio']['dataformat'])) {
// video only
$this->info['video']['bitrate'] = $this->info['bitrate'];
}
}
// Set playtime string
if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) {
$this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']);
}
}
示例3: htmlentities
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?titlefeat=1') . '">"feat." in Title field</a></li>';
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?emptygenres=1') . '">Blank genres</a></li>';
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?trackzero=1') . '">Track "zero"</a></li>';
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?nonemptycomments=1') . '">non-empty comments</a></li>';
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?unsynchronizedtags=2A1') . '">Tags that are not synchronized</a> (<a href="' . $_SERVER['PHP_SELF'] . '?unsynchronizedtags=2A1&autofix=1">autofix</a>)</li>';
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?filenamepattern=' . urlencode('[N] A - T {R}')) . '">Filenames that don\'t match pattern</a> (<a href="?filenamepattern=' . urlencode('[N] A - T {R}') . '&autofix=1">auto-fix</a>)</li>';
//echo '<li><a href="'.htmlentities($_SERVER['PHP_SELF'].'?filenamepattern='.urlencode('A - T')).'">Filenames that don\'t match pattern</a></li>';
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?correctcase=1') . '">Correct filename case (Win/DOS)</a></li>';
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?fixid3v1padding=1') . '">Fix ID3v1 invalid padding</a></li>';
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?errorswarnings=1') . '">Files with Errors and/or Warnings</a></li>';
echo '<li><a href="' . htmlentities($_SERVER['PHP_SELF'] . '?rescanerrors=1') . '">Re-scan only files with Errors and/or Warnings</a></li>';
echo '</ul>';
$SQLquery = 'SELECT COUNT(*) AS `TotalFiles`, SUM(`playtime_seconds`) AS `TotalPlaytime`, SUM(`filesize`) AS `TotalFilesize`, AVG(`playtime_seconds`) AS `AvgPlaytime`, AVG(`filesize`) AS `AvgFilesize`, AVG(`audio_bitrate` + `video_bitrate`) AS `AvgBitrate`';
$SQLquery .= ' FROM `' . mysql_real_escape_string(GETID3_DB_TABLE) . '`';
$result = mysql_query_safe($SQLquery);
if ($row = mysql_fetch_array($result)) {
echo '<hr size="1">';
echo '<div style="float: right;">';
echo 'Spent ' . number_format(mysql_query_safe(null), 3) . ' seconds querying the database<br>';
echo '</div>';
echo '<b>Currently in the database:</b><TABLE>';
echo '<tr><th align="left">Total Files</th><td>' . number_format($row['TotalFiles']) . '</td></tr>';
echo '<tr><th align="left">Total Filesize</th><td>' . number_format($row['TotalFilesize'] / 1048576) . ' MB</td></tr>';
echo '<tr><th align="left">Total Playtime</th><td>' . number_format($row['TotalPlaytime'] / 3600, 1) . ' hours</td></tr>';
echo '<tr><th align="left">Average Filesize</th><td>' . number_format($row['AvgFilesize'] / 1048576, 1) . ' MB</td></tr>';
echo '<tr><th align="left">Average Playtime</th><td>' . getid3_lib::PlaytimeString($row['AvgPlaytime']) . '</td></tr>';
echo '<tr><th align="left">Average Bitrate</th><td>' . BitrateText($row['AvgBitrate'] / 1000, 1) . '</td></tr>';
echo '</table>';
echo '<br clear="all">';
}
echo '</body></html>';
示例4: number_format
echo '</tr>';
}
}
echo '<tr bgcolor="#' . $getID3checkColor_Head . '">';
echo '<td><b>Average:</b></td>';
echo '<td align="right">' . number_format($TotalScannedFilesize / max($TotalScannedKnownFiles, 1)) . '</td>';
echo '<td> </td>';
echo '<td align="right">' . getid3_lib::PlaytimeString($TotalScannedPlaytime / max($TotalScannedPlaytimeFiles, 1)) . '</td>';
echo '<td align="right">' . BitrateText(round($TotalScannedBitrate / 1000 / max($TotalScannedBitrateFiles, 1))) . '</td>';
echo '<td rowspan="2" colspan="' . ($columnsintable - 5) . '"><table class="table" border="0" cellspacing="0" cellpadding="2"><tr><th align="right">Identified Files:</th><td align="right">' . number_format($TotalScannedKnownFiles) . '</td><td> </td><th align="right">Errors:</th><td align="right">' . number_format($FilesWithErrors) . '</td></tr><tr><th align="right">Unknown Files:</th><td align="right">' . number_format($TotalScannedUnknownFiles) . '</td><td> </td><th align="right">Warnings:</th><td align="right">' . number_format($FilesWithWarnings) . '</td></tr></table>';
echo '</tr>';
echo '<tr bgcolor="#' . $getID3checkColor_Head . '">';
echo '<td><b>Total:</b></td>';
echo '<td align="right">' . number_format($TotalScannedFilesize) . '</td>';
echo '<td> </td>';
echo '<td align="right">' . getid3_lib::PlaytimeString($TotalScannedPlaytime) . '</td>';
echo '<td> </td>';
echo '</tr>';
}
echo '</table>';
} else {
echo '<b>ERROR: Could not open directory: <u>' . $currentfulldir . '</u></b><br>';
}
}
echo PoweredBygetID3();
echo 'Running on PHP v' . phpversion();
echo '</body></html>';
ob_end_flush();
/////////////////////////////////////////////////////////////////
function RemoveAccents($string)
{
示例5: urlencode
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?encodedbydistribution=' . urlencode('%') . '">Encoded By (ID3v2) Distribution</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?trackinalbum=1">Track number in Album field</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?tracknoalbum=1">Track number, but no Album</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?titlefeat=1">"feat." in Title field</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?emptygenres=1">Blank genres</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?trackzero=1">Track "zero"</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?nonemptycomments=1">non-empty comments</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?unsynchronizedtags=2A1">Tags that are not synchronized</a> (<a href="' . $_SERVER['SCRIPT_NAME'] . '?unsynchronizedtags=2A1&autofix=1">autofix</a>)</li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?filenamepattern=' . urlencode('[N] A - T {R}') . '">Filenames that don\'t match pattern</a> (<a href="?filenamepattern=' . urlencode('[N] A - T {R}') . '&autofix=1">auto-fix</a>)</li>';
//echo '<li><a href="'.$_SERVER['SCRIPT_NAME'].'?filenamepattern='.urlencode('A - T').'">Filenames that don\'t match pattern</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?correctcase=1">Correct filename case (Win/DOS)</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?fixid3v1padding=1">Fix ID3v1 invalid padding</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?errorswarnings=1">Files with Errors and/or Warnings</a></li>';
echo '<li><a href="' . $_SERVER['SCRIPT_NAME'] . '?rescanerrors=1">Re-scan only files with Errors and/or Warnings</a></li>';
echo '</ul>';
$SQLquery = 'SELECT COUNT(*) AS `TotalFiles`, SUM(`playtime_seconds`) AS `TotalPlaytime`, SUM(`filesize`) AS `TotalFilesize`, AVG(`playtime_seconds`) AS `AvgPlaytime`, AVG(`filesize`) AS `AvgFilesize`, AVG(`audio_bitrate` + `video_bitrate`) AS `AvgBitrate`';
$SQLquery .= ' FROM `' . GETID3_DB_TABLE . '`';
$result = mysql_query($SQLquery);
if ($row = mysql_fetch_array($result)) {
echo '<hr><b>Currently in the database:</b><TABLE>';
echo '<tr><TH ALIGN="LEFT">Total Files</th><td>' . number_format($row['TotalFiles']) . '</td></tr>';
echo '<tr><TH ALIGN="LEFT">Total Filesize</th><td>' . number_format($row['TotalFilesize'] / 1048576) . ' MB</td></tr>';
echo '<tr><TH ALIGN="LEFT">Total Playtime</th><td>' . number_format($row['TotalPlaytime'] / 3600, 1) . ' hours</td></tr>';
echo '<tr><TH ALIGN="LEFT">Average Filesize</th><td>' . number_format($row['AvgFilesize'] / 1048576, 1) . ' MB</td></tr>';
echo '<tr><TH ALIGN="LEFT">Average Playtime</th><td>' . getid3_lib::PlaytimeString($row['AvgPlaytime']) . '</td></tr>';
echo '<tr><TH ALIGN="LEFT">Average Bitrate</th><td>' . BitrateText($row['AvgBitrate'] / 1000, 1) . '</td></tr>';
echo '</table>';
}
?>
</BODY>
</HTML>
示例6: process_notification
function process_notification($notification)
{
do_action('waz_before_process_notification', $notification);
$ids = $this->get_site_and_post_id_from_job_id($notification->job->id);
$post_id = $ids['post'];
$site_id = $ids['site'];
$switched = false;
if (0 != $site_id) {
switch_to_blog($site_id);
$switched = true;
}
// If you're encoding to multiple outputs and only care when all of the outputs are finished
// you can check if the entire job is finished.
if (0 !== $ids['post'] && $notification->job->state == "finished") {
$output = $notification->job->outputs['web'];
// Get the Attachment
$meta = $_meta = wp_get_attachment_metadata($post_id);
require_once ABSPATH . '/wp-includes/ID3/getid3.lib.php';
require_once ABSPATH . '/wp-includes/ID3/getid3.php';
require_once ABSPATH . '/wp-includes/ID3/module.audio-video.quicktime.php';
// Let's start modifying the metadata
// TODO figure out a viable way to use built in WP ID3
$meta['filesize'] = $output->file_size_in_bytes;
$meta['mime_type'] = 'video/mp4';
$meta['length'] = ceil($output->duration_in_ms * 0.001);
$meta['length_formatted'] = getid3_lib::PlaytimeString($meta['length']);
$meta['width'] = $output->width;
$meta['height'] = $output->height;
$meta['fileformat'] = 'mp4';
$meta['dataformat'] = $output->format;
$meta['codec'] = $output->video_codec;
// TODO this needs to take into consideration other file formats
// other than quicktime
$id3 = new getID3();
$qt = new getid3_quicktime($id3);
$meta['audio'] = array('dataformat' => $output->audio_codec, 'codec' => $qt->QuicktimeAudioCodecLookup($output->audio_codec), 'sample_rate' => $output->audio_sample_rate, 'channels' => $output->channels, 'lossless' => false, 'channelmode' => 'stereo');
// Update the Metadata
wp_update_attachment_metadata($post_id, $meta);
// Video has been encoded, here's the meta data
do_action('waz_video_encoded', $post_id, $meta);
// Let's update the S3 information
$s3info = $_s3info = get_post_meta($post_id, 'amazonS3_info', true);
$parsed = parse_url($output->url);
$host = explode('.', $parsed['host']);
$key = ltrim($parsed['path'], '/');
$s3info['bucket'] = $host[0];
$s3info['key'] = $key;
// Update S3 to point to new file
update_post_meta($post_id, 'amazonS3_info', $s3info);
// Save original file for later
update_post_meta($post_id, 'waz_original', $_s3info);
// And we're done!
update_post_meta($post_id, 'waz_encode_status', 'finished');
// Clean up after ourselves
delete_site_option('waz_job_' . $notification->job->id . '_blog_id');
// Delete the original file
$this->delete_attachment($post_id);
foreach ($ids as $key => $id) {
echo ucfirst($key) . ': ' . $id . "\n";
}
} else {
update_post_meta($post_id, 'waz_encode_status', 'failed');
update_post_meta($post_id, 'waz_notification_response', $notification);
}
echo 'Received!';
if ($switched) {
restore_current_blog();
}
do_action('waz_after_process_notification', $notification);
die(0);
}