mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-29 08:07:59 +01:00
T357: Handle malformed genres gracefully.
This commit is contained in:
parent
c0e619aacd
commit
9c520e71a5
1 changed files with 3 additions and 2 deletions
|
@ -200,9 +200,10 @@ class ImportMLPMA extends Command {
|
||||||
// Determine the genre.
|
// Determine the genre.
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
$genreName = $parsedTags['genre'];
|
$genreName = $parsedTags['genre'];
|
||||||
|
$genreSlug = Str::slug($genreName);
|
||||||
$this->info('Genre: '.$genreName);
|
$this->info('Genre: '.$genreName);
|
||||||
|
|
||||||
if ($genreName) {
|
if ($genreName && $genreSlug !== '') {
|
||||||
$genre = Genre::where('name', '=', $genreName)->first();
|
$genre = Genre::where('name', '=', $genreName)->first();
|
||||||
if ($genre) {
|
if ($genre) {
|
||||||
$genreId = $genre->id;
|
$genreId = $genre->id;
|
||||||
|
@ -210,7 +211,7 @@ class ImportMLPMA extends Command {
|
||||||
} else {
|
} else {
|
||||||
$genre = new Genre();
|
$genre = new Genre();
|
||||||
$genre->name = $genreName;
|
$genre->name = $genreName;
|
||||||
$genre->slug = Str::slug($genreName);
|
$genre->slug = $genreSlug;
|
||||||
$genre->save();
|
$genre->save();
|
||||||
$genreId = $genre->id;
|
$genreId = $genre->id;
|
||||||
$this->comment('Created a new genre!');
|
$this->comment('Created a new genre!');
|
||||||
|
|
Loading…
Reference in a new issue