Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
java-version: '8'
distribution: 'adopt'
- name: Import GPG secrets
if: ${{ !startsWith(github.ref, 'refs/pull') }}
run: |
echo $GPG_SECRET_KEYS | base64 --decode > gpg-private-key.txt
gpg --pinentry-mode loopback --import --batch gpg-private-key.txt
Expand All @@ -40,6 +41,7 @@ jobs:
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: mvn clean test -Pdebug -B -U -Dgpg.skip -Dmaven.javadoc.skip=true
- name: Deploy with Maven to OSSRH
if: ${{ !startsWith(github.ref, 'refs/pull') }}
run: mvn deploy --settings .maven.xml -B -U -Possrh
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
Expand Down
5 changes: 5 additions & 0 deletions player/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
<version>${lmax-disruptor.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>

<!-- TOML configuration -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import com.electronwill.nightconfig.toml.TomlParser;
import com.spotify.connectstate.Connect;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.gianlu.librespot.ZeroconfServer;
Expand All @@ -37,7 +37,7 @@
* @author devgianlu
*/
public final class FileConfiguration {
private static final Logger LOGGER = LogManager.getLogger(FileConfiguration.class);
private static final Logger LOGGER = LoggerFactory.getLogger(FileConfiguration.class);

static {
FormatDetector.registerExtension("properties", new PropertiesFormat());
Expand Down
40 changes: 20 additions & 20 deletions player/src/main/java/xyz/gianlu/librespot/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Range;
Expand Down Expand Up @@ -44,7 +44,7 @@
*/
public class Player implements Closeable {
public static final int VOLUME_MAX = 65536;
private static final Logger LOGGER = LogManager.getLogger(Player.class);
private static final Logger LOGGER = LoggerFactory.getLogger(Player.class);
private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new NameThreadFactory((r) -> "release-line-scheduler-" + r.hashCode()));
private final Session session;
private final PlayerConfiguration conf;
Expand All @@ -61,7 +61,7 @@ public Player(@NotNull PlayerConfiguration conf, @NotNull Session session) {
this.session = session;
this.events = new EventsDispatcher(conf);
this.sink = new AudioSink(conf, ex -> {
LOGGER.fatal("Sink error!", ex);
LOGGER.error("Sink error!", ex);
panicState(PlaybackMetrics.Reason.TRACK_ERROR);
});

Expand Down Expand Up @@ -242,10 +242,10 @@ public void load(@NotNull String uri, boolean play, boolean shuffle) {

loadSession(sessionId, play, true);
} catch (IOException | MercuryClient.MercuryException ex) {
LOGGER.fatal("Failed loading context!", ex);
LOGGER.error("Failed loading context!", ex);
panicState(null);
} catch (AbsSpotifyContext.UnsupportedContextException ex) {
LOGGER.fatal("Cannot play local tracks!", ex);
LOGGER.error("Cannot play local tracks!", ex);
panicState(null);
}
}
Expand Down Expand Up @@ -362,17 +362,17 @@ public void loadingError(@NotNull Exception ex) {
if (ex instanceof PlayableContentFeeder.ContentRestrictedException) {
LOGGER.error("Can't load track (content restricted).", ex);
} else {
LOGGER.fatal("Failed loading track.", ex);
LOGGER.error("Failed loading track.", ex);
panicState(PlaybackMetrics.Reason.TRACK_ERROR);
}
}

@Override
public void playbackError(@NotNull Exception ex) {
if (ex instanceof AbsChunkedInputStream.ChunkException)
LOGGER.fatal("Failed retrieving chunk, playback failed!", ex);
LOGGER.error("Failed retrieving chunk, playback failed!", ex);
else
LOGGER.fatal("Playback error!", ex);
LOGGER.error("Playback error!", ex);

panicState(PlaybackMetrics.Reason.TRACK_ERROR);
}
Expand Down Expand Up @@ -435,7 +435,7 @@ public void playbackResumedFromHalt(int chunk, long diff) {

return state.getCurrentPlayableOrThrow();
} else {
LOGGER.fatal("Failed loading next song: " + next);
LOGGER.error("Failed loading next song: " + next);
panicState(PlaybackMetrics.Reason.END_PLAY);
return null;
}
Expand Down Expand Up @@ -501,10 +501,10 @@ private void handlePlay(@NotNull JsonObject obj) {
if (paused == null) paused = false;
loadSession(sessionId, !paused, PlayCommandHelper.willSkipToSomething(obj));
} catch (IOException | MercuryClient.MercuryException ex) {
LOGGER.fatal("Failed loading context!", ex);
LOGGER.error("Failed loading context!", ex);
panicState(null);
} catch (AbsSpotifyContext.UnsupportedContextException ex) {
LOGGER.fatal("Cannot play local tracks!", ex);
LOGGER.error("Cannot play local tracks!", ex);
panicState(null);
}
}
Expand All @@ -517,10 +517,10 @@ private void handleTransferState(@NotNull TransferStateOuterClass.TransferState
events.contextChanged();
loadSession(sessionId, !cmd.getPlayback().getIsPaused(), true);
} catch (IOException | MercuryClient.MercuryException ex) {
LOGGER.fatal("Failed loading context!", ex);
LOGGER.error("Failed loading context!", ex);
panicState(null);
} catch (AbsSpotifyContext.UnsupportedContextException ex) {
LOGGER.fatal("Cannot play local tracks!", ex);
LOGGER.error("Cannot play local tracks!", ex);
panicState(null);
}
}
Expand Down Expand Up @@ -616,7 +616,7 @@ private void handleSkipNext(@Nullable JsonObject obj, @NotNull TransitionInfo tr
state.setPosition(0);
loadTrack(next == NextPlayable.OK_PLAY || next == NextPlayable.OK_REPEAT, trans);
} else {
LOGGER.fatal("Failed loading next song: " + next);
LOGGER.error("Failed loading next song: " + next);
panicState(PlaybackMetrics.Reason.END_PLAY);
}
}
Expand All @@ -628,7 +628,7 @@ private void handleSkipPrev() {
state.setPosition(0);
loadTrack(true, TransitionInfo.skippedPrev(state));
} else {
LOGGER.fatal("Failed loading previous song: " + prev);
LOGGER.error("Failed loading previous song: " + prev);
panicState(null);
}
} else {
Expand All @@ -644,7 +644,7 @@ private void handleSkipPrev() {
private void loadAutoplay() {
String context = state.getContextUri();
if (context == null) {
LOGGER.fatal("Cannot load autoplay with null context!");
LOGGER.error("Cannot load autoplay with null context!");
panicState(null);
return;
}
Expand Down Expand Up @@ -673,7 +673,7 @@ private void loadAutoplay() {

LOGGER.debug("Loading context for autoplay (using radio-apollo), uri: {}", state.getContextUri());
} else {
LOGGER.fatal("Failed retrieving autoplay context, code: " + resp.statusCode);
LOGGER.error("Failed retrieving autoplay context, code: " + resp.statusCode);

state.setPosition(0);
state.setState(true, false, false);
Expand All @@ -687,11 +687,11 @@ private void loadAutoplay() {
state.setState(true, true, false);
state.updated();
} else {
LOGGER.fatal("Failed loading autoplay station!", ex);
LOGGER.error("Failed loading autoplay station!", ex);
panicState(null);
}
} catch (AbsSpotifyContext.UnsupportedContextException ex) {
LOGGER.fatal("Cannot play local tracks!", ex);
LOGGER.error("Cannot play local tracks!", ex);
panicState(null);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import com.spotify.transfer.SessionOuterClass;
import com.spotify.transfer.TransferStateOuterClass;
import okhttp3.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.gianlu.librespot.common.FisherYatesShuffle;
Expand All @@ -46,7 +46,7 @@
* @author Gianlu
*/
public class StateWrapper implements DeviceStateHandler.Listener, DealerClient.MessageListener, Closeable {
private static final Logger LOGGER = LogManager.getLogger(StateWrapper.class);
private static final Logger LOGGER = LoggerFactory.getLogger(StateWrapper.class);

static {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xyz.gianlu.librespot.player.codecs;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.gianlu.librespot.audio.AbsChunkedInputStream;
Expand All @@ -19,7 +19,7 @@
*/
public abstract class Codec implements Closeable {
public static final int BUFFER_SIZE = 2048;
private static final Logger LOGGER = LogManager.getLogger(Codec.class);
private static final Logger LOGGER = LoggerFactory.getLogger(Codec.class);
protected final AbsChunkedInputStream audioIn;
protected final float normalizationFactor;
protected final int duration;
Expand Down Expand Up @@ -70,7 +70,7 @@ public void seek(int positionMs) {
throw new IOException(String.format("Failed seeking, skip: %d, skipped: %d", skip, skipped));
}
} catch (IOException ex) {
LOGGER.fatal("Failed seeking!", ex);
LOGGER.error("Failed seeking!", ex);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package xyz.gianlu.librespot.player.codecs;

import com.spotify.metadata.Metadata;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.gianlu.librespot.audio.format.AudioQualityPicker;
Expand All @@ -15,7 +15,7 @@
* @author Gianlu
*/
public final class VorbisOnlyAudioQuality implements AudioQualityPicker {
private static final Logger LOGGER = LogManager.getLogger(VorbisOnlyAudioQuality.class);
private static final Logger LOGGER = LoggerFactory.getLogger(VorbisOnlyAudioQuality.class);
private final AudioQuality preferred;

public VorbisOnlyAudioQuality(@NotNull AudioQuality preferred) {
Expand All @@ -41,7 +41,7 @@ public static Metadata.AudioFile getVorbisFile(@NotNull List<Metadata.AudioFile>
if (vorbis != null)
LOGGER.warn("Using {} because preferred {} couldn't be found.", vorbis.getFormat(), preferred);
else
LOGGER.fatal("Couldn't find any Vorbis file, available: {}", Utils.formatsToString(files));
LOGGER.error("Couldn't find any Vorbis file, available: {}", Utils.formatsToString(files));
}

return vorbis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.gianlu.librespot.metadata.PlayableId;
Expand All @@ -15,7 +15,7 @@
import java.util.Map;

public class CrossfadeController {
private static final Logger LOGGER = LogManager.getLogger(CrossfadeController.class);
private static final Logger LOGGER = LoggerFactory.getLogger(CrossfadeController.class);
private final String playbackId;
private final int trackDuration;
private final Map<Reason, FadeInterval> fadeOutMap = new HashMap<>(8);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xyz.gianlu.librespot.player.events;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Range;
Expand Down Expand Up @@ -32,7 +32,7 @@ public final class EventsMetadataPipe implements Player.EventsListener, Closeabl
private static final String CODE_PRGR = "70726772";
private static final String CODE_PICT = "50494354";
private static final String CODE_PFLS = "70666C73";
private static final Logger LOGGER = LogManager.getLogger(EventsMetadataPipe.class);
private static final Logger LOGGER = LoggerFactory.getLogger(EventsMetadataPipe.class);
private final File file;
private FileOutputStream out;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xyz.gianlu.librespot.player.events;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Range;
Expand All @@ -16,7 +16,7 @@
* @author devgianlu
*/
public final class EventsShell implements Player.EventsListener, Session.@NotNull ReconnectionListener {
private static final Logger LOGGER = LogManager.getLogger(EventsShell.class);
private static final Logger LOGGER = LoggerFactory.getLogger(EventsShell.class);
private final Configuration conf;
private final Runtime runtime;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xyz.gianlu.librespot.player.metrics;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.gianlu.librespot.core.Session;
Expand All @@ -17,7 +17,7 @@
* @author devgianlu
*/
public class PlaybackMetrics {
private static final Logger LOGGER = LogManager.getLogger(PlaybackMetrics.class);
private static final Logger LOGGER = LoggerFactory.getLogger(PlaybackMetrics.class);
public final PlayableId id;
final String playbackId;
final String featureVersion;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xyz.gianlu.librespot.player.mixing;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.gianlu.librespot.player.codecs.Codec;
Expand All @@ -14,7 +14,7 @@
* @author Gianlu
*/
public final class MixingLine extends InputStream {
private static final Logger LOGGER = LogManager.getLogger(MixingLine.class);
private static final Logger LOGGER = LoggerFactory.getLogger(MixingLine.class);
boolean switchFormat = false;
private GainAwareCircularBuffer fcb;
private GainAwareCircularBuffer scb;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xyz.gianlu.librespot.player.playback;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -17,7 +17,7 @@
* @author devgianlu
*/
final class PlayerQueue implements Closeable {
private static final Logger LOGGER = LogManager.getLogger(PlayerQueue.class);
private static final Logger LOGGER = LoggerFactory.getLogger(PlayerQueue.class);
private final ExecutorService executorService = Executors.newCachedThreadPool(new NameThreadFactory((r) -> "player-queue-" + r.hashCode()));
private PlayerQueueEntry head = null;

Expand Down
Loading