Finally fixed the music queue and swap logic

This commit is contained in:
CappielloAntonio 2021-12-30 18:13:50 +01:00
parent fc271e8b44
commit 60b741bc11
10 changed files with 134 additions and 140 deletions

View file

@ -100,15 +100,15 @@ public class MappingUtil {
return songs;
}
public static Queue mapSongToQueue(Song song) {
return new Queue(song.getId(), song.getTitle(), song.getAlbumId(), song.getAlbumName(), song.getArtistId(), song.getArtistName(), song.getPrimary(), song.getDuration(), 0);
public static Queue mapSongToQueue(Song song, int trackOrder) {
return new Queue(trackOrder, song.getId(), song.getTitle(), song.getAlbumId(), song.getAlbumName(), song.getArtistId(), song.getArtistName(), song.getPrimary(), song.getDuration(), 0);
}
public static List<Queue> mapSongsToQueue(List<Song> songs) {
List<Queue> queue = new ArrayList<>();
for (Song song : songs) {
queue.add(mapSongToQueue(song));
for (int counter = 0; counter < songs.size(); counter++) {
queue.add(mapSongToQueue(songs.get(counter), counter));
}
return queue;