From 983b6062dfec3139f49e773c8260a19d7a78cc62 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 30 Oct 2015 19:19:04 -0700 Subject: [PATCH] Fixed overflowing status bar --- src/Hathor/Command/ScannerCommand.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Hathor/Command/ScannerCommand.php b/src/Hathor/Command/ScannerCommand.php index e98e583..0054063 100644 --- a/src/Hathor/Command/ScannerCommand.php +++ b/src/Hathor/Command/ScannerCommand.php @@ -39,6 +39,7 @@ class ScannerCommand extends BaseCommand $extensionRegex .= sprintf('\.%s|',$extension); } + $extensionRegex[strlen($extensionRegex)-1] = ')'; $extensionRegex .= '\b$/i'; @@ -61,19 +62,21 @@ class ScannerCommand extends BaseCommand $progress->setEmptyBarCharacter('#'); //$progress->setRedrawFrequency(100); - $cols = shell_exec('tput cols'); + $cols = shell_exec('tput cols') - 20; foreach ($finder as $file) { $progress->setMessage(str_repeat('-', $cols - 5)); //$currentDir = explode(DIRECTORY_SEPARATOR, $file->getRelativePath()); //$currentDir = $currentDir[count($currentDir)-1]; //$currentDir = substr($currentDir[count($currentDir)-1],0,60); - $currentFile = substr($file->getFilename(), 0,$cols - 30); - $progress->setMessage("Current File - $currentFile ..."); + $currentFile = str_pad(substr($file->getFilename(), 0, $cols) . ' ...', $cols, ' '); - //$getID3->setFile($file->getRealPath()); + $progress->setMessage("Current File - $currentFile "); + + $getID3->setFile($file->getRealPath()); try { - // $allMusicData[] = $getID3->getFileData (); + + $allMusicData[] = $getID3->getFileData (); } catch(\Exception $e) { $progress->setMessage('Caught RuntimeException'); continue;