From eb76608e7287db4b26d877deccce138daee849da Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 21 May 2023 17:50:51 +0200 Subject: add OnSongFinished backend hook allowing to remove uploaded songs --- upload.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'upload.go') diff --git a/upload.go b/upload.go index d7bbd20..ce11462 100644 --- a/upload.go +++ b/upload.go @@ -74,6 +74,12 @@ func (b *UploadBackend) setupUploadRoute() { http.HandleFunc("/upload", b.upload) } +func (b *UploadBackend) OnSongFinished(song *Song) { + songPath := path.Join(b.uploadDir, song.Uri) + llog.Debug("Removing finished song %s", songPath) + os.Remove(songPath) +} + func (b *UploadBackend) Play(song *Song, player *Player) { player.PlayUri("file://" + path.Join(b.uploadDir, song.Uri)) } -- cgit v1.2.3