mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
Sync libraries, artist, album, genre, song, playlist, playlist song
This commit is contained in:
parent
3a91ee68db
commit
304a5f078a
30 changed files with 716 additions and 1699 deletions
|
|
@ -6,64 +6,66 @@ import android.os.Bundle;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.AlbumRepository;
|
||||
import com.cappielloantonio.play.repository.ArtistRepository;
|
||||
import com.cappielloantonio.play.repository.GenreRepository;
|
||||
import com.cappielloantonio.play.repository.PlaylistRepository;
|
||||
import com.cappielloantonio.play.repository.PlaylistSongRepository;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.play.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.play.subsonic.models.Child;
|
||||
import com.cappielloantonio.play.subsonic.models.Genre;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class SyncViewModel extends AndroidViewModel {
|
||||
private static final String TAG = "SyncViewModel";
|
||||
|
||||
private SongRepository songRepository;
|
||||
|
||||
|
||||
private boolean syncAlbum = false;
|
||||
private boolean syncArtist = false;
|
||||
private boolean syncGenres = false;
|
||||
private boolean syncPlaylist = false;
|
||||
private boolean syncSong = false;
|
||||
private boolean crossSyncSongGenre = false;
|
||||
|
||||
private ArrayList<Album> albumList = new ArrayList<>();
|
||||
private ArrayList<Artist> artistList = new ArrayList<>();
|
||||
private ArrayList<AlbumID3> albumList = new ArrayList<>();
|
||||
private ArrayList<ArtistID3> artistList = new ArrayList<>();
|
||||
private ArrayList<Genre> genreList = new ArrayList<>();
|
||||
private ArrayList<Playlist> playlistList = new ArrayList<>();
|
||||
private ArrayList<Song> songList = new ArrayList<>();
|
||||
private ArrayList<Child> childList = new ArrayList<>();
|
||||
|
||||
private int step = 0;
|
||||
private int progress = 0;
|
||||
private SongRepository songRepository;
|
||||
private AlbumRepository albumRepository;
|
||||
private ArtistRepository artistRepository;
|
||||
private PlaylistRepository playlistRepository;
|
||||
private GenreRepository genreRepository;
|
||||
private PlaylistSongRepository playlistSongRepository;
|
||||
|
||||
public SyncViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
songRepository = new SongRepository(application);
|
||||
albumRepository = new AlbumRepository(application);
|
||||
artistRepository = new ArtistRepository(application);
|
||||
playlistRepository = new PlaylistRepository(application);
|
||||
genreRepository = new GenreRepository(application);
|
||||
playlistSongRepository = new PlaylistSongRepository(application);
|
||||
}
|
||||
|
||||
public void setArguemnts(Bundle bundle) {
|
||||
step = 0;
|
||||
progress = 0;
|
||||
|
||||
syncAlbum = bundle.getBoolean("sync_album", false);
|
||||
syncArtist = bundle.getBoolean("sync_artist", false);
|
||||
syncGenres = bundle.getBoolean("sync_genres", false);
|
||||
syncPlaylist = bundle.getBoolean("sync_playlist", false);
|
||||
syncSong = bundle.getBoolean("sync_song", false);
|
||||
crossSyncSongGenre = bundle.getBoolean("cross_sync_song_genre", false);
|
||||
|
||||
countStep();
|
||||
}
|
||||
|
||||
private void countStep() {
|
||||
if (syncAlbum) step++;
|
||||
if (syncArtist) step++;
|
||||
if (syncGenres) step++;
|
||||
if (syncPlaylist) step++;
|
||||
if (syncSong) step++;
|
||||
}
|
||||
|
||||
public boolean isSyncAlbum() {
|
||||
|
|
@ -86,23 +88,19 @@ public class SyncViewModel extends AndroidViewModel {
|
|||
return syncSong;
|
||||
}
|
||||
|
||||
public boolean isCrossSyncSongGenre() {
|
||||
return crossSyncSongGenre;
|
||||
}
|
||||
|
||||
public ArrayList<Album> getAlbumList() {
|
||||
public ArrayList<AlbumID3> getAlbumList() {
|
||||
return albumList;
|
||||
}
|
||||
|
||||
public void setAlbumList(ArrayList<Album> albumList) {
|
||||
this.albumList = albumList;
|
||||
public void addToAlbumList(List<AlbumID3> albumList) {
|
||||
this.albumList.addAll(albumList);
|
||||
}
|
||||
|
||||
public ArrayList<Artist> getArtistList() {
|
||||
public ArrayList<ArtistID3> getArtistList() {
|
||||
return artistList;
|
||||
}
|
||||
|
||||
public void setArtistList(ArrayList<Artist> artistList) {
|
||||
public void setArtistList(ArrayList<ArtistID3> artistList) {
|
||||
this.artistList = artistList;
|
||||
}
|
||||
|
||||
|
|
@ -130,19 +128,14 @@ public class SyncViewModel extends AndroidViewModel {
|
|||
this.songList = songList;
|
||||
}
|
||||
|
||||
public void increaseProggress() {
|
||||
progress++;
|
||||
public ArrayList<Child> getChildList() {
|
||||
return childList;
|
||||
}
|
||||
|
||||
public int getStep() {
|
||||
return step;
|
||||
public void addToChildList(ArrayList<Child> childList) {
|
||||
this.childList.addAll(childList);
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
|
||||
public Map<Integer, Song> getCatalogue() {
|
||||
Map<Integer, Song> map = new HashMap<>();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue