From 92d8a270ddbe7bbbfdddecc5bbc258056bd9c154 Mon Sep 17 00:00:00 2001 From: Gianlu Date: Mon, 12 Nov 2018 21:25:34 +0100 Subject: [PATCH] Minor refactoring --- src/main/java/org/librespot/spotify/player/Player.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/librespot/spotify/player/Player.java b/src/main/java/org/librespot/spotify/player/Player.java index a7d10d02..bff9b45f 100644 --- a/src/main/java/org/librespot/spotify/player/Player.java +++ b/src/main/java/org/librespot/spotify/player/Player.java @@ -222,7 +222,8 @@ private void loadTrack(boolean play, int pos) throws IOException, MercuryClient. Metadata.Track track = session.mercury().requestSync(MercuryRequests.getTrack(new TrackId(ref))); track = pickAlternativeIfNecessary(track); if (track == null) { - LOGGER.fatal("Couldn't find playable track: " + ref.getGid()); + LOGGER.fatal("Couldn't find playable track: " + Utils.bytesToHex(ref.getGid())); + state.setStatus(Spirc.PlayStatus.kPlayStatusStop); return; } @@ -257,12 +258,12 @@ private void loadTrack(boolean play, int pos) throws IOException, MercuryClient. playerRunner = new PlayerRunner(audioStreaming, normalizationData, spirc.deviceState(), conf, this, track.getDuration()); new Thread(playerRunner).start(); + playerRunner.seek(pos); + if (play) { state.setStatus(Spirc.PlayStatus.kPlayStatusLoading); - playerRunner.seek(pos); playerRunner.play(); } else { - playerRunner.seek(pos); state.setStatus(Spirc.PlayStatus.kPlayStatusPause); } } catch (PlayerRunner.PlayerException ex) {