add audio features too add song route

This commit is contained in:
Lukas Weger 2025-08-02 00:24:33 +02:00
parent 892eafdac4
commit 776c693a27
2 changed files with 32 additions and 7 deletions

View file

@ -1,17 +1,31 @@
package com.serena.backend.model;
import java.util.Map;
import java.util.HashMap;
public class Song {
private String id;
private int popularity;
private double tempo;
private Map<String, Double> audioFeatures;
public Song() {}
public Song() {
this.audioFeatures = new HashMap<>();
}
public Song(String id, int popularity) {
this.id = id;
this.popularity = popularity;
this.audioFeatures = new HashMap<>();
}
public Song(String id, int popularity, double tempo, Map<String, Double> audioFeatures) {
this.id = id;
this.popularity = popularity;
this.tempo = tempo;
this.audioFeatures = audioFeatures != null ? audioFeatures : new HashMap<>();
}
// Getters and Setters
public String getId() {
return id;
}
@ -27,4 +41,20 @@ public class Song {
public void setPopularity(int popularity) {
this.popularity = popularity;
}
public double getTempo() {
return tempo;
}
public void setTempo(double tempo) {
this.tempo = tempo;
}
public Map<String, Double> getAudioFeatures() {
return audioFeatures;
}
public void setAudioFeatures(Map<String, Double> audioFeatures) {
this.audioFeatures = audioFeatures;
}
}

View file

@ -38,11 +38,6 @@ public class RadioStationService {
return new ArrayList<>(radioStations.values());
}
public List<RadioStation> getActiveRadioStations() {
return radioStations.values().stream()
.toList();
}
public Optional<RadioStation> updateRadioStation(String stationId, String name, String description) {
RadioStation station = radioStations.get(stationId);
if (station != null) {