userRepository->getDefaultAdminUser(); $path = Song::getPathFromS3BucketAndKey($bucket, $key); $artist = Artist::getOrCreate($artistName); $albumArtist = $albumArtistName && $albumArtistName !== $artistName ? Artist::getOrCreate($albumArtistName) : $artist; $album = Album::getOrCreate($albumArtist, $albumName); if ($cover) { $this->mediaMetadataService->writeAlbumCover( $album, base64_decode($cover['data'], true), $cover['extension'] ); } /** @var Song $song */ $song = Song::query()->updateOrCreate(['path' => $path], [ 'album_id' => $album->id, 'artist_id' => $artist->id, 'title' => $title, 'length' => $duration, 'track' => $track, 'lyrics' => $lyrics, 'mtime' => time(), 'owner_id' => $user->id, 'is_public' => true, 'storage' => SongStorageTypes::S3_LAMBDA, ]); event(new LibraryChanged()); return $song; } public function deleteSongEntry(string $bucket, string $key): void { $path = Song::getPathFromS3BucketAndKey($bucket, $key); $song = $this->songRepository->findOneByPath($path); throw_unless((bool) $song, SongPathNotFoundException::create($path)); $song->delete(); event(new LibraryChanged()); } public function supported(): bool { return SongStorageTypes::supported(SongStorageTypes::S3_LAMBDA); } public function delete(Song $song, bool $backup = false): void { throw new MethodNotImplementedException('Lambda storage does not support deleting from filesystem.'); } }