2021-07-27 12:10:28 +02:00
|
|
|
package com.cappielloantonio.play.util;
|
|
|
|
|
|
|
|
|
|
import com.cappielloantonio.play.model.Album;
|
2021-07-27 16:58:38 +02:00
|
|
|
import com.cappielloantonio.play.model.Artist;
|
2021-07-29 14:56:00 +02:00
|
|
|
import com.cappielloantonio.play.model.Playlist;
|
2021-07-28 15:28:32 +02:00
|
|
|
import com.cappielloantonio.play.model.Queue;
|
2021-07-27 12:10:28 +02:00
|
|
|
import com.cappielloantonio.play.model.Song;
|
|
|
|
|
import com.cappielloantonio.play.subsonic.models.AlbumID3;
|
2021-07-27 16:58:38 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.ArtistID3;
|
2021-07-29 14:19:19 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.ArtistWithAlbumsID3;
|
2021-07-27 12:10:28 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.Child;
|
2021-07-29 14:56:00 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.Playlists;
|
2021-07-27 12:10:28 +02:00
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class MappingUtil {
|
|
|
|
|
public static ArrayList<Song> mapSong(List<Child> children) {
|
|
|
|
|
ArrayList<Song> songs = new ArrayList();
|
|
|
|
|
|
|
|
|
|
for(Child child : children){
|
|
|
|
|
songs.add(new Song(child));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return songs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ArrayList<Album> mapAlbum(List<AlbumID3> albumID3List) {
|
|
|
|
|
ArrayList<Album> albums = new ArrayList();
|
|
|
|
|
|
|
|
|
|
for(AlbumID3 albumID3 : albumID3List){
|
|
|
|
|
albums.add(new Album(albumID3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return albums;
|
|
|
|
|
}
|
2021-07-27 16:58:38 +02:00
|
|
|
|
2021-07-29 14:19:19 +02:00
|
|
|
public static ArrayList<Artist> mapArtist(List<ArtistID3> artistID3List) {
|
2021-07-27 16:58:38 +02:00
|
|
|
ArrayList<Artist> artists = new ArrayList();
|
|
|
|
|
|
2021-07-29 14:19:19 +02:00
|
|
|
for(ArtistID3 artistID3 : artistID3List){
|
2021-07-27 16:58:38 +02:00
|
|
|
artists.add(new Artist(artistID3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return artists;
|
|
|
|
|
}
|
2021-07-28 15:28:32 +02:00
|
|
|
|
2021-07-29 14:19:19 +02:00
|
|
|
public static Artist mapArtistWithAlbum(ArtistWithAlbumsID3 artistWithAlbumsID3) {
|
|
|
|
|
return new Artist(artistWithAlbumsID3);
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-28 15:28:32 +02:00
|
|
|
public static ArrayList<Song> mapQueue(List<Queue> queueList) {
|
|
|
|
|
ArrayList<Song> songs = new ArrayList();
|
|
|
|
|
|
|
|
|
|
for(Queue item : queueList){
|
|
|
|
|
songs.add(new Song(item));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return songs;
|
|
|
|
|
}
|
2021-07-29 14:56:00 +02:00
|
|
|
|
|
|
|
|
public static ArrayList<Playlist> mapPlaylist(List<com.cappielloantonio.play.subsonic.models.Playlist> playlists) {
|
|
|
|
|
ArrayList<Playlist> playlist = new ArrayList();
|
|
|
|
|
|
|
|
|
|
for(com.cappielloantonio.play.subsonic.models.Playlist item : playlists){
|
|
|
|
|
playlist.add(new Playlist(item));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return playlist;
|
|
|
|
|
}
|
2021-07-27 12:10:28 +02:00
|
|
|
}
|