added album to scrobble generation in get track scrobbles
This commit is contained in:
parent
e2cd31f242
commit
3f30e5e67e
@ -10,6 +10,7 @@ import org.json.JSONException;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import sarsoo.fmframework.log.Logger;
|
import sarsoo.fmframework.log.Logger;
|
||||||
|
import sarsoo.fmframework.log.entry.ErrorEntry;
|
||||||
import sarsoo.fmframework.log.entry.InfoEntry;
|
import sarsoo.fmframework.log.entry.InfoEntry;
|
||||||
import sarsoo.fmframework.log.entry.LogEntry;
|
import sarsoo.fmframework.log.entry.LogEntry;
|
||||||
import sarsoo.fmframework.music.Album;
|
import sarsoo.fmframework.music.Album;
|
||||||
@ -406,7 +407,17 @@ public class FmUserNetwork extends FmNetwork {
|
|||||||
|
|
||||||
JSONObject scrob = returnedScrobbles.getJSONObject(i);
|
JSONObject scrob = returnedScrobbles.getJSONObject(i);
|
||||||
|
|
||||||
Scrobble scrobble = new Scrobble(scrob.getJSONObject("date").getLong("uts"), track);
|
Album album = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
album = new AlbumBuilder(scrob.getJSONObject("album").getString("#text"), track.getArtist())
|
||||||
|
.build();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Logger.getLog()
|
||||||
|
.logError(new ErrorEntry("getTrackScrobbles").addArg("no album found").addArg(track.getName()).addArg(track.getArtist().getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Scrobble scrobble = new Scrobble(scrob.getJSONObject("date").getLong("uts"), track, album);
|
||||||
|
|
||||||
scrobbles.add(scrobble);
|
scrobbles.add(scrobble);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user