From 7c2863b9428f05ff837368a8fd906517650997d9 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Sat, 12 Sep 2015 16:01:53 +0100 Subject: [PATCH] Merge rPF9b9f25dc512d: T357: Gracefully handle missing tags in M4A and OGG files. --- app/Console/Commands/ImportMLPMA.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/ImportMLPMA.php b/app/Console/Commands/ImportMLPMA.php index 63b512f4..1865ffaa 100644 --- a/app/Console/Commands/ImportMLPMA.php +++ b/app/Console/Commands/ImportMLPMA.php @@ -179,7 +179,7 @@ class ImportMLPMA extends Command if ($taggedYear !== null && $modifiedDate->year === $taggedYear) { $releasedAt = $modifiedDate; - } elseif ($taggedYear !== null && Str::length((string) $taggedYear) !== 4) { + } elseif ($taggedYear !== null && Str::length((string)$taggedYear) !== 4) { $this->error('This track\'s tagged year makes no sense! Using the track\'s last modified date...'); $releasedAt = $modifiedDate; } elseif ($taggedYear !== null && $modifiedDate->year !== $taggedYear) { @@ -431,7 +431,11 @@ class ImportMLPMA extends Command */ protected function getAtomTags($rawTags) { - $tags = $rawTags['tags']['quicktime']; + if (array_key_exists('tags', $rawTags) && array_key_exists('quicktime', $rawTags['tags'])) { + $tags = $rawTags['tags']['quicktime']; + } else { + $tags = []; + } $trackNumber = null; if (isset($tags['track_number'])) { @@ -462,7 +466,11 @@ class ImportMLPMA extends Command */ protected function getVorbisTags($rawTags) { - $tags = $rawTags['tags']['vorbiscomment']; + if (array_key_exists('tags', $rawTags) && array_key_exists('vorbiscomment', $rawTags['tags'])) { + $tags = $rawTags['tags']['vorbiscomment']; + } else { + $tags = []; + } $trackNumber = null; if (isset($tags['track_number'])) {