diff --git a/src/Sikofitt/HathorBundle/Command/ScannerCommand.php b/src/Sikofitt/HathorBundle/Command/ScannerCommand.php index 419f661..09e13cd 100644 --- a/src/Sikofitt/HathorBundle/Command/ScannerCommand.php +++ b/src/Sikofitt/HathorBundle/Command/ScannerCommand.php @@ -5,7 +5,6 @@ namespace Sikofitt\HathorBundle\Command; -use Symfony\Component\Config\Definition\Exception\Exception; use Symfony\Component\Finder\Finder; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -55,8 +54,25 @@ class ScannerCommand extends BaseCommand ->ignoreUnreadableDirs(true) ->name($extensionRegex); $progress = new ProgressBar($output, $finder->count()); - $progress->setBarWidth(50); - $progress->setFormat(" %message%\n %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%"); + $cols = shell_exec('tput cols'); + $progress->setBarWidth($cols - 2); + $format = [ + 'barCharacter' => '#', + 'progressCharacter' => '#', + 'emptyBarCharacter' => '#', + 'message' => '%message%', + 'current' => '%current%', + 'currentMaxSep' => '/', + 'max' => '%max%', + 'percent' => '%percent:3s%%', + 'elapsed' => '%elapsed:6s%', + 'estimated' => '%estimated:-6s%', + 'elapsedEstimatedSep' => '/', + 'memory' => '%memory:6s%', + 'bar' => '[%bar%]', + ]; + $format = (object)$format; + $progress->setFormat(""); $progress->clear(); $progress->start(); $getID3 = new ID3; @@ -65,8 +81,6 @@ class ScannerCommand extends BaseCommand $progress->setEmptyBarCharacter('#'); //$progress->setRedrawFrequency(100); - $cols = shell_exec('tput cols'); - foreach ($finder as $file) { $fileLength = mb_strlen($file->getFilename()); diff --git a/src/Sikofitt/HathorBundle/SikofittHathorBundle.php b/src/Sikofitt/HathorBundle/SikofittHathorBundle.php index 09f5349..49d89ae 100644 --- a/src/Sikofitt/HathorBundle/SikofittHathorBundle.php +++ b/src/Sikofitt/HathorBundle/SikofittHathorBundle.php @@ -6,4 +6,5 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; class SikofittHathorBundle extends Bundle { + }