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: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>org.example</groupId>
<artifactId>SpotifyLink</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public String getURL() {
public synchronized JSONObject getCurrentTrackInfo() throws IOException, SpotifyWebApiException, ParseException {
if (requestTime == null) {
requestTime = Instant.now();
} else if (Duration.between(requestTime, Instant.now()).getSeconds() >= 2) {
} else if (Duration.between(requestTime, Instant.now()).getSeconds() >= 1) {
try {

CurrentlyPlaying currentlyPlaying = spotifyApi.getUsersCurrentlyPlayingTrack().build().execute();
Expand Down
2 changes: 1 addition & 1 deletion src/main/de.bytephil/handlers/SpotifyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public int getDurationtoSong(String url) {
public synchronized List<SongObject> getQueueAsSongObjects() {
if (requestTime == null) {
requestTime = Instant.now();
} else if (Duration.between(requestTime, Instant.now()).getSeconds() >= 3) {
} else if (Duration.between(requestTime, Instant.now()).getSeconds() >= 1) {
List<IPlaylistItem> userQueue = spotifyAPI.getUsersQueue();
List<SongObject> songObjects = new ArrayList<>();

Expand Down
8 changes: 2 additions & 6 deletions src/main/de.bytephil/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,8 @@ public static void startApp() throws IOException {
} else {
JSONObject songInfo = new JSONObject();
songInfo.put("Not-playing", true);
String username = spotifyConnector.getUserName();
if (username != null) {
songInfo.put("user", username);
} else {
songInfo.put("user", "Unbekannt");
}
songInfo.put("user", "Unbekannt");

songInfo.put("sessionCode", sessionCode);
ctx.send(songInfo.toString());
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/WebPages/assets/script/mainpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ function setupWebSocket() {
if (queueLength == -1) {
document.getElementById("song-added").innerHTML =
"Lied spielt als nächstes.";
songAdded = false;
counter = 0;
} else {
document.getElementById("song-added").innerHTML =
"Lied spielt in ca. " + queueLength + " min";
Expand All @@ -68,7 +70,8 @@ function setupWebSocket() {
if (messageEvent.data == "forbidden") {
wrongCode = true;
document.getElementById("song-name").innerHTML = "Falscher Code!";
document.getElementById("song-artists").innerHTML = "Seite neuladen um den Code einzugeben."
document.getElementById("song-artists").innerHTML =
"Seite neuladen um den Code einzugeben.";

var code = prompt("Gib den aktuellen Session Code ein:", "");

Expand Down