[ LoveTrackOnLastfm::class, ], SongStartedPlaying::class => [ UpdateLastfmNowPlaying::class, ], LibraryChanged::class => [ TidyLibrary::class, ClearMediaCache::class, ], AlbumInformationFetched::class => [ DownloadAlbumCover::class, ], ArtistInformationFetched::class => [ DownloadArtistImage::class, ], ]; /** * Register any other events for your application. */ public function boot() { parent::boot(); // Generate a unique hash for a song from its path to be the ID Song::creating(function ($song) { $song->id = File::getHash($song->path); }); // Remove the cover file if the album is deleted Album::deleted(function ($album) { if ($album->hasCover) { try { unlink(app()->publicPath()."/public/img/covers/{$album->cover}"); } catch (Exception $e) { } } }); } }