mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
Updated
This commit is contained in:
parent
b76789853c
commit
3d9e61389a
2 changed files with 36 additions and 24 deletions
|
@ -67,7 +67,7 @@ if (isset($ffpInfo->streams)) {
|
||||||
$result .= sprintf($lang['BITRATE'], humn_bitrate($stream->bit_rate)) . '<br>';
|
$result .= sprintf($lang['BITRATE'], humn_bitrate($stream->bit_rate)) . '<br>';
|
||||||
}
|
}
|
||||||
if (!empty($stream->sample_rate)) {
|
if (!empty($stream->sample_rate)) {
|
||||||
$result .= sprintf($lang['SAMPLE_RATE'], $stream->sample_rate) . '<br>';
|
$result .= sprintf($lang['SAMPLE_RATE'], humn_sample_rate($stream->sample_rate)) . '<br>';
|
||||||
}
|
}
|
||||||
if (!empty($stream->channels)) {
|
if (!empty($stream->channels)) {
|
||||||
$result .= sprintf($lang['CHANNELS'], $stream->channels) . '<br>';
|
$result .= sprintf($lang['CHANNELS'], $stream->channels) . '<br>';
|
||||||
|
@ -105,4 +105,39 @@ if (isset($ffpInfo->streams)) {
|
||||||
$this->response['ffprobe_data'] = $result;
|
$this->response['ffprobe_data'] = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitrate to human-readable format
|
||||||
|
*
|
||||||
|
* @param int $bitrate
|
||||||
|
* @param string $space
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function humn_bitrate(int $bitrate, string $space = ' '): string
|
||||||
|
{
|
||||||
|
if ($bitrate >= 1000000) {
|
||||||
|
$unit = 'Mbps';
|
||||||
|
$bitrate /= 1000000;
|
||||||
|
} elseif ($bitrate >= 1000) {
|
||||||
|
$unit = 'kbps';
|
||||||
|
$bitrate /= 1000;
|
||||||
|
} else {
|
||||||
|
$unit = 'bps';
|
||||||
|
}
|
||||||
|
|
||||||
|
return commify($bitrate, 2) . $space . $unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sample rate to human-readable format
|
||||||
|
*
|
||||||
|
* @param int $sample_rate
|
||||||
|
* @param string $space
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function humn_sample_rate(int $sample_rate, string $space = ' '): string
|
||||||
|
{
|
||||||
|
$unit = '';
|
||||||
|
return commify($sample_rate, 2) . $space . $unit;
|
||||||
|
}
|
||||||
|
|
||||||
$this->response['file_index'] = $file_index;
|
$this->response['file_index'] = $file_index;
|
||||||
|
|
|
@ -595,29 +595,6 @@ function humn_size($size, $rounder = null, $min = null, $space = ' ')
|
||||||
return round($size, $rounder) . $space . $ext;
|
return round($size, $rounder) . $space . $ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Bitrate to human-readable format
|
|
||||||
*
|
|
||||||
* @param int $bitrate
|
|
||||||
* @param string $space
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function humn_bitrate(int $bitrate, string $space = ' '): string
|
|
||||||
{
|
|
||||||
if ($bitrate >= 1000000) {
|
|
||||||
$unit = 'Mbps';
|
|
||||||
$bitrate /= 1000000;
|
|
||||||
} elseif ($bitrate >= 1000) {
|
|
||||||
$unit = 'kbps';
|
|
||||||
$bitrate /= 1000;
|
|
||||||
} else {
|
|
||||||
$unit = 'bps';
|
|
||||||
}
|
|
||||||
|
|
||||||
$formattedBitrate = number_format($bitrate, 2);
|
|
||||||
return $formattedBitrate . $space . $unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
function bt_show_ip($ip, $port = '')
|
function bt_show_ip($ip, $port = '')
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
global $bb_cfg;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue