track scrobble viewing implemented

This commit is contained in:
aj 2019-05-10 06:58:30 +01:00
parent 3f30e5e67e
commit e3309746fd
2 changed files with 17 additions and 7 deletions

View File

@ -6,6 +6,7 @@ import java.util.Locale;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.chart.AreaChart; import javafx.scene.chart.AreaChart;
import javafx.scene.chart.XYChart;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.SplitPane; import javafx.scene.control.SplitPane;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
@ -37,20 +38,25 @@ public class ScrobblesViewPaneController {
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.UK); NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.UK);
// gridPane.getChildren().clear();
int counter; int counter;
for (counter = 0; counter < scrobbles.size(); counter++) { for (counter = 0; counter < scrobbles.size(); counter++) {
Scrobble scrobble = scrobbles.get(counter); Scrobble scrobble = scrobbles.get(counter);
Label trackName = new Label(scrobble.getTrack().getName().toLowerCase()); Label trackName = new Label(scrobble.getTrack().getName().toLowerCase());
Label albumName = new Label(scrobble.getTrack().getAlbum().getName().toLowerCase());
Label artistName = new Label(scrobble.getTrack().getArtist().getName().toLowerCase()); Label artistName = new Label(scrobble.getTrack().getArtist().getName().toLowerCase());
Label date = new Label(scrobble.getDateTime().toString().toLowerCase()); Label date = new Label(scrobble.getDateTime().toString().toLowerCase());
gridPane.add(trackName, 0, counter); gridPane.add(trackName, 0, counter);
gridPane.add(albumName, 1, counter);
gridPane.add(artistName, 2, counter); gridPane.add(artistName, 2, counter);
gridPane.add(date, 2, counter); gridPane.add(date, 3, counter);
if(scrobble.getAlbum() != null) {
Label albumName = new Label(scrobble.getAlbum().getName().toLowerCase());
gridPane.add(albumName, 1, counter);
}
} }
} }

View File

@ -74,7 +74,7 @@ public class TrackBorderPaneController extends FMObjBorderPaneController {
FmFramework.getController().addTab(new ArtistTab(track.getArtist())); FmFramework.getController().addTab(new ArtistTab(track.getArtist()));
} catch (IOException e1) { } catch (IOException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }//
} }
}); });
}else { }else {
@ -132,13 +132,17 @@ public class TrackBorderPaneController extends FMObjBorderPaneController {
@Override @Override
protected Void call() throws Exception { protected Void call() throws Exception {
track = new FmUserNetwork(Key.getKey(), Reference.getUserName()).refresh(track); FmUserNetwork net = new FmUserNetwork(Key.getKey(), Reference.getUserName());
track = net.refresh(track);
track.setScrobbles(net.getTrackScrobbles(track));
Platform.runLater(new Runnable() { Platform.runLater(new Runnable() {
@Override @Override
public void run() { public void run() {
infoPaneController.refresh(track); infoPaneController.refresh(track);
scrobblePaneController.populate(track);
} }
}); });