Fixed overflowing status bar

This commit is contained in:
Eric 2015-10-30 19:19:04 -07:00
parent 0c8297c3a8
commit 983b6062df
1 changed files with 8 additions and 5 deletions

View File

@ -39,6 +39,7 @@ class ScannerCommand extends BaseCommand
$extensionRegex .= sprintf('\.%s|',$extension); $extensionRegex .= sprintf('\.%s|',$extension);
} }
$extensionRegex[strlen($extensionRegex)-1] = ')'; $extensionRegex[strlen($extensionRegex)-1] = ')';
$extensionRegex .= '\b$/i'; $extensionRegex .= '\b$/i';
@ -61,19 +62,21 @@ class ScannerCommand extends BaseCommand
$progress->setEmptyBarCharacter('<fg=cyan>#</>'); $progress->setEmptyBarCharacter('<fg=cyan>#</>');
//$progress->setRedrawFrequency(100); //$progress->setRedrawFrequency(100);
$cols = shell_exec('tput cols'); $cols = shell_exec('tput cols') - 20;
foreach ($finder as $file) { foreach ($finder as $file) {
$progress->setMessage(str_repeat('-', $cols - 5)); $progress->setMessage(str_repeat('-', $cols - 5));
//$currentDir = explode(DIRECTORY_SEPARATOR, $file->getRelativePath()); //$currentDir = explode(DIRECTORY_SEPARATOR, $file->getRelativePath());
//$currentDir = $currentDir[count($currentDir)-1]; //$currentDir = $currentDir[count($currentDir)-1];
//$currentDir = substr($currentDir[count($currentDir)-1],0,60); //$currentDir = substr($currentDir[count($currentDir)-1],0,60);
$currentFile = substr($file->getFilename(), 0,$cols - 30);
$progress->setMessage("<fg=white;options=bold>Current File - $currentFile ...</>"); $currentFile = str_pad(substr($file->getFilename(), 0, $cols) . ' ...', $cols, ' ');
//$getID3->setFile($file->getRealPath()); $progress->setMessage("<fg=white;options=bold>Current File - $currentFile </>");
$getID3->setFile($file->getRealPath());
try { try {
// $allMusicData[] = $getID3->getFileData ();
$allMusicData[] = $getID3->getFileData ();
} catch(\Exception $e) { } catch(\Exception $e) {
$progress->setMessage('<warning>Caught RuntimeException</warning>'); $progress->setMessage('<warning>Caught RuntimeException</warning>');
continue; continue;