Set track number in downloaded tracks

This commit is contained in:
CappielloAntonio 2021-09-02 14:18:10 +02:00
parent 984003ccd4
commit 60adc11848
3 changed files with 18 additions and 3 deletions

View file

@ -15,7 +15,7 @@ import com.cappielloantonio.play.model.Queue;
import com.cappielloantonio.play.model.RecentSearch;
import com.cappielloantonio.play.model.Server;
@Database(entities = {Queue.class, Server.class, RecentSearch.class, Download.class}, version = 16, exportSchema = false)
@Database(entities = {Queue.class, Server.class, RecentSearch.class, Download.class}, version = 17, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
private static final String TAG = "AppDatabase";

View file

@ -31,6 +31,9 @@ public class Download {
@ColumnInfo(name = "artistName")
private String artistName;
@ColumnInfo(name = "trackNumber")
private int trackNumber;
@ColumnInfo(name = "primary")
private String primary;
@ -40,13 +43,14 @@ public class Download {
@ColumnInfo(name = "server")
private String server;
public Download(String songID, String title, String albumId, String albumName, String artistId, String artistName, String primary, long duration, String server) {
public Download(@NonNull String songID, String title, String albumId, String albumName, String artistId, String artistName, int trackNumber, String primary, long duration, String server) {
this.songID = songID;
this.title = title;
this.albumId = albumId;
this.albumName = albumName;
this.artistId = artistId;
this.artistName = artistName;
this.trackNumber = trackNumber;
this.primary = primary;
this.duration = duration;
this.server = server;
@ -59,16 +63,18 @@ public class Download {
this.albumName = song.getAlbumName();
this.artistId = song.getArtistId();
this.artistName = MusicUtil.normalizedArtistName(song.getArtistName());
this.trackNumber = song.getTrackNumber();
this.primary = song.getPrimary();
this.duration = song.getDuration();
this.server = PreferenceUtil.getInstance(App.getInstance()).getServerId();
}
@NonNull
public String getSongID() {
return songID;
}
public void setSongID(String songID) {
public void setSongID(@NonNull String songID) {
this.songID = songID;
}
@ -112,6 +118,14 @@ public class Download {
this.artistName = artistName;
}
public int getTrackNumber() {
return trackNumber;
}
public void setTrackNumber(int trackNumber) {
this.trackNumber = trackNumber;
}
public String getPrimary() {
return primary;
}

View file

@ -89,6 +89,7 @@ public class Song implements Parcelable {
this.albumName = download.getAlbumName();
this.artistId = download.getArtistId();
this.artistName = download.getArtistName();
this.trackNumber = download.getTrackNumber();
this.primary = download.getPrimary();
this.duration = download.getDuration();
}