aboutsummaryrefslogtreecommitdiff
path: root/upload.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-05-21 17:50:51 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-05-21 17:50:51 +0200
commiteb76608e7287db4b26d877deccce138daee849da (patch)
tree9117519023cf91b48cbcb28e69be90e0f16b345b /upload.go
parent0db007609efb842f43d837988eff15b31765f615 (diff)
downloadWRMS-eb76608e7287db4b26d877deccce138daee849da.tar.gz
WRMS-eb76608e7287db4b26d877deccce138daee849da.zip
add OnSongFinished backend hook allowing to remove uploaded songs
Diffstat (limited to 'upload.go')
-rw-r--r--upload.go6
1 files changed, 6 insertions, 0 deletions
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))
}