From bddfd6cae566fc74b3b92eab3161e7e5dd376b34 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Thu, 10 Sep 2015 12:43:19 +0100 Subject: [PATCH] Merge rPF9cb13ee535e4: T357: The importer no longer assumes that a title tag is present. --- app/Console/Commands/ImportMLPMA.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/ImportMLPMA.php b/app/Console/Commands/ImportMLPMA.php index 42ef517c..75356834 100644 --- a/app/Console/Commands/ImportMLPMA.php +++ b/app/Console/Commands/ImportMLPMA.php @@ -196,10 +196,18 @@ class ImportMLPMA extends Command //========================================================================================================== - // Determine the genre + // Fill in the title tag if it's missing. + //========================================================================================================== + if (!$parsedTags['title']) { + $parsedTags['title'] = $file->getBasename($file->getExtension()); + } + + + //========================================================================================================== + // Determine the genre. //========================================================================================================== $genreName = $parsedTags['genre']; - $this->info('Genre: '.$genreName); + $this->info('Genre: ' . $genreName); if ($genreName) { $genre = Genre::where('name', '=', $genreName)->first(); @@ -393,8 +401,8 @@ class ImportMLPMA extends Command return [ [ - 'title' => $tags['title'][0], - 'artist' => $tags['artist'][0], + 'title' => isset($tags['title']) ? $tags['title'][0] : null, + 'artist' => isset($tags['artist']) ? $tags['artist'][0] : null, 'band' => isset($tags['band']) ? $tags['band'][0] : null, 'genre' => isset($tags['genre']) ? $tags['genre'][0] : null, 'track_number' => isset($tags['track_number']) ? $tags['track_number'][0] : null, @@ -423,8 +431,8 @@ class ImportMLPMA extends Command return [ [ - 'title' => $tags['title'][0], - 'artist' => $tags['artist'][0], + 'title' => isset($tags['title']) ? $tags['title'][0] : null, + 'artist' => isset($tags['artist']) ? $tags['artist'][0] : null, 'band' => isset($tags['band']) ? $tags['band'][0] : null, 'album_artist' => isset($tags['album_artist']) ? $tags['album_artist'][0] : null, 'genre' => isset($tags['genre']) ? $tags['genre'][0] : null,