added album to scrobble

This commit is contained in:
aj 2019-05-09 18:42:04 +01:00
parent 6b465e25fe
commit e2cd31f242

View File

@ -8,12 +8,19 @@ public class Scrobble {
private LocalDateTime dateTime; private LocalDateTime dateTime;
private Track track; private Track track;
private Album album;
public Scrobble(long uts, Track track) { public Scrobble(long uts, Track track) {
this.track = track; this.track = track;
this.dateTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(uts), ZoneId.systemDefault()); this.dateTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(uts), ZoneId.systemDefault());
} }
public Scrobble(long uts, Track track, Album album) {
this.track = track;
this.album = album;
this.dateTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(uts), ZoneId.systemDefault());
}
public LocalDateTime getDateTime() { public LocalDateTime getDateTime() {
return dateTime; return dateTime;
} }
@ -22,8 +29,25 @@ public class Scrobble {
return track; return track;
} }
public Album getAlbum() {
return album;
}
public Artist getArtist() {
return track.getArtist();
}
public String toString() { public String toString() {
return dateTime + " " + track.toString();
String string = "Scrobble: " + dateTime + " " + track.getName();
if(album != null) {
string += " " + album.getName();
}
string += " " + track.getArtist().getName();
return string;
} }
} }