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 17:12:55 +02:00
|
|
|
import com.cappielloantonio.play.model.Download;
|
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-08-02 18:27:45 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.AlbumInfo;
|
2021-07-31 16:37:41 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.AlbumWithSongsID3;
|
2021-07-27 16:58:38 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.ArtistID3;
|
2021-07-30 14:09:50 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.ArtistInfo2;
|
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-31 18:43:40 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.Genre;
|
2021-08-02 09:15:04 +02:00
|
|
|
import com.cappielloantonio.play.subsonic.models.SimilarArtistID3;
|
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();
|
|
|
|
|
|
2021-07-31 16:37:41 +02:00
|
|
|
for (Child child : children) {
|
2021-07-27 12:10:28 +02:00
|
|
|
songs.add(new Song(child));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return songs;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-13 17:29:37 +02:00
|
|
|
public static Song mapSong(Child child) {
|
|
|
|
|
return new Song(child);
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-27 12:10:28 +02:00
|
|
|
public static ArrayList<Album> mapAlbum(List<AlbumID3> albumID3List) {
|
|
|
|
|
ArrayList<Album> albums = new ArrayList();
|
|
|
|
|
|
2021-07-31 16:37:41 +02:00
|
|
|
for (AlbumID3 albumID3 : albumID3List) {
|
2021-07-27 12:10:28 +02:00
|
|
|
albums.add(new Album(albumID3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return albums;
|
|
|
|
|
}
|
2021-07-27 16:58:38 +02:00
|
|
|
|
2021-07-31 16:37:41 +02:00
|
|
|
public static Album mapAlbum(AlbumWithSongsID3 albumWithSongsID3) {
|
|
|
|
|
return new Album(albumWithSongsID3);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-02 18:27:45 +02:00
|
|
|
public static Album mapAlbum(AlbumInfo albumInfo) {
|
|
|
|
|
return new Album(albumInfo);
|
|
|
|
|
}
|
|
|
|
|
|
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-31 16:37:41 +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-30 14:09:50 +02:00
|
|
|
public static Artist mapArtist(ArtistInfo2 artistInfo2) {
|
|
|
|
|
return new Artist(artistInfo2);
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-31 16:37:41 +02:00
|
|
|
public static Artist mapArtist(ArtistWithAlbumsID3 artistWithAlbumsID3) {
|
|
|
|
|
return new Artist(artistWithAlbumsID3);
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-29 14:19:19 +02:00
|
|
|
public static Artist mapArtistWithAlbum(ArtistWithAlbumsID3 artistWithAlbumsID3) {
|
|
|
|
|
return new Artist(artistWithAlbumsID3);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-02 09:15:04 +02:00
|
|
|
public static ArrayList<Artist> mapSimilarArtist(List<SimilarArtistID3> similarArtistID3s) {
|
|
|
|
|
ArrayList<Artist> artists = new ArrayList();
|
|
|
|
|
|
|
|
|
|
for (SimilarArtistID3 similarArtistID3 : similarArtistID3s) {
|
|
|
|
|
artists.add(new Artist(similarArtistID3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return artists;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-28 15:28:32 +02:00
|
|
|
public static ArrayList<Song> mapQueue(List<Queue> queueList) {
|
|
|
|
|
ArrayList<Song> songs = new ArrayList();
|
|
|
|
|
|
2021-07-31 16:37:41 +02:00
|
|
|
for (Queue item : queueList) {
|
2021-07-28 15:28:32 +02:00
|
|
|
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();
|
|
|
|
|
|
2021-07-31 16:37:41 +02:00
|
|
|
for (com.cappielloantonio.play.subsonic.models.Playlist item : playlists) {
|
2021-07-29 14:56:00 +02:00
|
|
|
playlist.add(new Playlist(item));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return playlist;
|
|
|
|
|
}
|
2021-07-29 17:12:55 +02:00
|
|
|
|
|
|
|
|
public static ArrayList<Song> mapDownload(List<Download> downloads) {
|
|
|
|
|
ArrayList<Song> songs = new ArrayList();
|
|
|
|
|
|
2021-07-31 16:37:41 +02:00
|
|
|
for (Download download : downloads) {
|
2021-07-29 17:12:55 +02:00
|
|
|
songs.add(new Song(download));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return songs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ArrayList<Download> mapToDownload(List<Song> songs) {
|
|
|
|
|
ArrayList<Download> downloads = new ArrayList();
|
|
|
|
|
|
2021-07-31 16:37:41 +02:00
|
|
|
for (Song song : songs) {
|
2021-07-29 17:12:55 +02:00
|
|
|
downloads.add(new Download(song));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return downloads;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Download mapToDownload(Song song) {
|
|
|
|
|
return new Download(song);
|
|
|
|
|
}
|
2021-07-31 18:43:40 +02:00
|
|
|
|
|
|
|
|
public static ArrayList<com.cappielloantonio.play.model.Genre> mapGenre(List<Genre> genreList) {
|
|
|
|
|
ArrayList<com.cappielloantonio.play.model.Genre> genres = new ArrayList();
|
|
|
|
|
|
|
|
|
|
for (Genre genre : genreList) {
|
|
|
|
|
genres.add(new com.cappielloantonio.play.model.Genre(genre));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return genres;
|
|
|
|
|
}
|
2021-07-27 12:10:28 +02:00
|
|
|
}
|