Skip to content

Commit

Permalink
Add rawData to the Song model
Browse files Browse the repository at this point in the history
  • Loading branch information
Migwel authored and Migwel committed Dec 28, 2023
1 parent a62eccc commit ff564a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/main/java/dev/migwel/sts/model/Song.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
package dev.migwel.sts.model;

public record Song(String artist, String title) {}
/**
* Representation of a song playing "somewhere"
*
* @param artist The artist performing that song
* @param title The title of the number
* @param rawData It can happen that parsing the artist and title can be tricky and what we have is
* raw data of what's playing. We may want this raw data either to save it and parse it manually
* later or for debugging reasons
*/
public record Song(String artist, String title, String rawData) {}
2 changes: 1 addition & 1 deletion src/main/java/dev/migwel/sts/radio/RadioSearchService.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ private Optional<Song> convert(@CheckForNull SongInfo songInfo) {
if (songInfo.artist() == null && songInfo.title() == null) {
return Optional.empty();
}
return Optional.of(new Song(songInfo.artist(), songInfo.title()));
return Optional.of(new Song(songInfo.artist(), songInfo.title(), songInfo.rawData()));
}
}

0 comments on commit ff564a0

Please sign in to comment.