| @@ 431-447 (lines=17) @@ | ||
| 428 | } |
|
| 429 | ||
| 430 | ||
| 431 | function BitrateColor($bitrate, $BitrateMaxScale=768) { |
|
| 432 | // $BitrateMaxScale is bitrate of maximum-quality color (bright green) |
|
| 433 | // below this is gradient, above is solid green |
|
| 434 | ||
| 435 | $bitrate *= (256 / $BitrateMaxScale); // scale from 1-[768]kbps to 1-256 |
|
| 436 | $bitrate = round(min(max($bitrate, 1), 256)); |
|
| 437 | $bitrate--; // scale from 1-256kbps to 0-255kbps |
|
| 438 | ||
| 439 | $Rcomponent = max(255 - ($bitrate * 2), 0); |
|
| 440 | $Gcomponent = max(($bitrate * 2) - 255, 0); |
|
| 441 | if ($bitrate > 127) { |
|
| 442 | $Bcomponent = max((255 - $bitrate) * 2, 0); |
|
| 443 | } else { |
|
| 444 | $Bcomponent = max($bitrate * 2, 0); |
|
| 445 | } |
|
| 446 | return str_pad(dechex($Rcomponent), 2, '0', STR_PAD_LEFT).str_pad(dechex($Gcomponent), 2, '0', STR_PAD_LEFT).str_pad(dechex($Bcomponent), 2, '0', STR_PAD_LEFT); |
|
| 447 | } |
|
| 448 | ||
| 449 | function BitrateText($bitrate, $decimals=0, $vbr=false) { |
|
| 450 | return '<span style="color: #'.BitrateColor($bitrate).($vbr ? '; font-weight: bold;' : '').'">'.number_format($bitrate, $decimals).' kbps</span>'; |
|
| @@ 879-896 (lines=18) @@ | ||
| 876 | } |
|
| 877 | ||
| 878 | if (!function_exists('BitrateColor')) { |
|
| 879 | function BitrateColor($bitrate) { |
|
| 880 | $bitrate /= 3; // scale from 1-768kbps to 1-256kbps |
|
| 881 | $bitrate--; // scale from 1-256kbps to 0-255kbps |
|
| 882 | $bitrate = max($bitrate, 0); |
|
| 883 | $bitrate = min($bitrate, 255); |
|
| 884 | //$bitrate = max($bitrate, 32); |
|
| 885 | //$bitrate = min($bitrate, 143); |
|
| 886 | //$bitrate = ($bitrate * 2) - 32; |
|
| 887 | ||
| 888 | $Rcomponent = max(255 - ($bitrate * 2), 0); |
|
| 889 | $Gcomponent = max(($bitrate * 2) - 255, 0); |
|
| 890 | if ($bitrate > 127) { |
|
| 891 | $Bcomponent = max((255 - $bitrate) * 2, 0); |
|
| 892 | } else { |
|
| 893 | $Bcomponent = max($bitrate * 2, 0); |
|
| 894 | } |
|
| 895 | return str_pad(dechex($Rcomponent), 2, '0', STR_PAD_LEFT).str_pad(dechex($Gcomponent), 2, '0', STR_PAD_LEFT).str_pad(dechex($Bcomponent), 2, '0', STR_PAD_LEFT); |
|
| 896 | } |
|
| 897 | } |
|
| 898 | ||
| 899 | if (!function_exists('BitrateText')) { |
|
| @@ 66-82 (lines=17) @@ | ||
| 63 | return strtr(strtr($string, 'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'), array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', '' => 'OE', '' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u')); |
|
| 64 | } |
|
| 65 | ||
| 66 | function BitrateColor($bitrate, $BitrateMaxScale=768) { |
|
| 67 | // $BitrateMaxScale is bitrate of maximum-quality color (bright green) |
|
| 68 | // below this is gradient, above is solid green |
|
| 69 | ||
| 70 | $bitrate *= (256 / $BitrateMaxScale); // scale from 1-[768]kbps to 1-256 |
|
| 71 | $bitrate = round(min(max($bitrate, 1), 256)); |
|
| 72 | $bitrate--; // scale from 1-256kbps to 0-255kbps |
|
| 73 | ||
| 74 | $Rcomponent = max(255 - ($bitrate * 2), 0); |
|
| 75 | $Gcomponent = max(($bitrate * 2) - 255, 0); |
|
| 76 | if ($bitrate > 127) { |
|
| 77 | $Bcomponent = max((255 - $bitrate) * 2, 0); |
|
| 78 | } else { |
|
| 79 | $Bcomponent = max($bitrate * 2, 0); |
|
| 80 | } |
|
| 81 | return str_pad(dechex($Rcomponent), 2, '0', STR_PAD_LEFT).str_pad(dechex($Gcomponent), 2, '0', STR_PAD_LEFT).str_pad(dechex($Bcomponent), 2, '0', STR_PAD_LEFT); |
|
| 82 | } |
|
| 83 | ||
| 84 | function BitrateText($bitrate, $decimals=0) { |
|
| 85 | return '<span style="color: #'.BitrateColor($bitrate).'">'.number_format($bitrate, $decimals).' kbps</span>'; |
|