Include the original-size cover art when tagging tracks.

Also, use Symfony to run external commands.
This commit is contained in:
Peter Deltchev 2016-01-06 05:52:09 -08:00
parent 0a078adab3
commit 95090fb334
2 changed files with 7 additions and 7 deletions

View file

@ -18,17 +18,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
use Illuminate\Support\Facades\Log; use Symfony\Component\Process\Process;
class External class External
{ {
public static function execute($command) public static function execute($command)
{ {
$output = []; $process = new Process($command);
$error = exec($command, $output); $process->run();
if ($error != null) { if (!$process->isSuccessful()) {
Log::error('"' . $command . '" failed with "' . $error . '"'); Log::error('"' . $command . '" failed with "' . $process->getErrorOutput() . '"');
} }
} }
} }

View file

@ -760,7 +760,7 @@ class Track extends Model
} }
if ($this->cover !== null) { if ($this->cover !== null) {
$command .= '--artwork ' . $this->cover->getFile() . ' '; $command .= '--artwork ' . $this->cover->getFile(Image::ORIGINAL) . ' ';
} }
$command .= '--overWrite'; $command .= '--overWrite';
@ -801,7 +801,7 @@ class Track extends Model
if ($format == 'MP3' && $this->cover_id != null && is_file($this->cover->getFile())) { if ($format == 'MP3' && $this->cover_id != null && is_file($this->cover->getFile())) {
$tagWriter->tag_data['attached_picture'][0] = [ $tagWriter->tag_data['attached_picture'][0] = [
'data' => file_get_contents($this->cover->getFile()), 'data' => file_get_contents($this->cover->getFile(Image::ORIGINAL)),
'picturetypeid' => 2, 'picturetypeid' => 2,
'description' => 'cover', 'description' => 'cover',
'mime' => $this->cover->mime 'mime' => $this->cover->mime