From 95090fb334d71849b6b70a6a12b439f19b29ddb4 Mon Sep 17 00:00:00 2001 From: Peter Deltchev Date: Wed, 6 Jan 2016 05:52:09 -0800 Subject: [PATCH] Include the original-size cover art when tagging tracks. Also, use Symfony to run external commands. --- app/Library/External.php | 10 +++++----- app/Models/Track.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Library/External.php b/app/Library/External.php index a866f31c..25aaeea6 100644 --- a/app/Library/External.php +++ b/app/Library/External.php @@ -18,17 +18,17 @@ * along with this program. If not, see . */ -use Illuminate\Support\Facades\Log; +use Symfony\Component\Process\Process; class External { public static function execute($command) { - $output = []; - $error = exec($command, $output); + $process = new Process($command); + $process->run(); - if ($error != null) { - Log::error('"' . $command . '" failed with "' . $error . '"'); + if (!$process->isSuccessful()) { + Log::error('"' . $command . '" failed with "' . $process->getErrorOutput() . '"'); } } } diff --git a/app/Models/Track.php b/app/Models/Track.php index 5c7bd285..7ebf8751 100644 --- a/app/Models/Track.php +++ b/app/Models/Track.php @@ -760,7 +760,7 @@ class Track extends Model } if ($this->cover !== null) { - $command .= '--artwork ' . $this->cover->getFile() . ' '; + $command .= '--artwork ' . $this->cover->getFile(Image::ORIGINAL) . ' '; } $command .= '--overWrite'; @@ -801,7 +801,7 @@ class Track extends Model if ($format == 'MP3' && $this->cover_id != null && is_file($this->cover->getFile())) { $tagWriter->tag_data['attached_picture'][0] = [ - 'data' => file_get_contents($this->cover->getFile()), + 'data' => file_get_contents($this->cover->getFile(Image::ORIGINAL)), 'picturetypeid' => 2, 'description' => 'cover', 'mime' => $this->cover->mime