Merge rPF9c520e71a551: T357: Handle malformed genres gracefully.

This commit is contained in:
Kelvin Zhang 2015-09-10 12:56:33 +01:00
parent a8d7bd1935
commit 416ce7ac6a

View file

@ -208,9 +208,10 @@ class ImportMLPMA extends Command
// Determine the genre.
//==========================================================================================================
$genreName = $parsedTags['genre'];
$genreSlug = Str::slug($genreName);
$this->info('Genre: ' . $genreName);
if ($genreName) {
if ($genreName && $genreSlug !== '') {
$genre = Genre::where('name', '=', $genreName)->first();
if ($genre) {
$genreId = $genre->id;
@ -218,7 +219,7 @@ class ImportMLPMA extends Command
} else {
$genre = new Genre();
$genre->name = $genreName;
$genre->slug = Str::slug($genreName);
$genre->slug = $genreSlug;
$genre->save();
$genreId = $genre->id;
$this->comment('Created a new genre!');