Created better way of displaying progress
This commit is contained in:
parent
845035339f
commit
8224c23e92
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
namespace Sikofitt\HathorBundle\Command;
|
namespace Sikofitt\HathorBundle\Command;
|
||||||
|
|
||||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
@ -55,8 +54,25 @@ class ScannerCommand extends BaseCommand
|
||||||
->ignoreUnreadableDirs(true)
|
->ignoreUnreadableDirs(true)
|
||||||
->name($extensionRegex);
|
->name($extensionRegex);
|
||||||
$progress = new ProgressBar($output, $finder->count());
|
$progress = new ProgressBar($output, $finder->count());
|
||||||
$progress->setBarWidth(50);
|
$cols = shell_exec('tput cols');
|
||||||
$progress->setFormat(" <fg=white;options=bold>%message%</>\n <fg=cyan>%current%</><fg=black;options=bold>/</><fg=cyan;options=bold>%max%</> <fg=cyan>[</>%bar%<fg=cyan>]</> %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%");
|
$progress->setBarWidth($cols - 2);
|
||||||
|
$format = [
|
||||||
|
'barCharacter' => '<fg=cyan;options=bold>#</>',
|
||||||
|
'progressCharacter' => '<fg=cyan>#</>',
|
||||||
|
'emptyBarCharacter' => '<fg=cyan>#</>',
|
||||||
|
'message' => '<fg=white;options=bold>%message%</>',
|
||||||
|
'current' => '<fg=cyan>%current%</>',
|
||||||
|
'currentMaxSep' => '<fg=black;options=bold>/</>',
|
||||||
|
'max' => '<fg=cyan;options=bold>%max%</>',
|
||||||
|
'percent' => '%percent:3s%%',
|
||||||
|
'elapsed' => '%elapsed:6s%',
|
||||||
|
'estimated' => '%estimated:-6s%',
|
||||||
|
'elapsedEstimatedSep' => '/',
|
||||||
|
'memory' => '%memory:6s%',
|
||||||
|
'bar' => '<fg=cyan>[</>%bar%<fg=cyan>]</>',
|
||||||
|
];
|
||||||
|
$format = (object)$format;
|
||||||
|
$progress->setFormat("");
|
||||||
$progress->clear();
|
$progress->clear();
|
||||||
$progress->start();
|
$progress->start();
|
||||||
$getID3 = new ID3;
|
$getID3 = new ID3;
|
||||||
|
@ -65,8 +81,6 @@ class ScannerCommand extends BaseCommand
|
||||||
$progress->setEmptyBarCharacter('<fg=cyan>#</>');
|
$progress->setEmptyBarCharacter('<fg=cyan>#</>');
|
||||||
//$progress->setRedrawFrequency(100);
|
//$progress->setRedrawFrequency(100);
|
||||||
|
|
||||||
$cols = shell_exec('tput cols');
|
|
||||||
|
|
||||||
foreach ($finder as $file) {
|
foreach ($finder as $file) {
|
||||||
|
|
||||||
$fileLength = mb_strlen($file->getFilename());
|
$fileLength = mb_strlen($file->getFilename());
|
||||||
|
|
|
@ -6,4 +6,5 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
class SikofittHathorBundle extends Bundle
|
class SikofittHathorBundle extends Bundle
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue