Skip to content

Commit 26c1ebb

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 55adf5e + 0eefc6f commit 26c1ebb

21 files changed

Lines changed: 65 additions & 41 deletions

File tree

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [1.2.0] - 12-01-2020
8+
### Added
9+
- Add CORS headers to API responses (#161)
10+
- Added timeout to Mercury requests to avoid deadlocks (1e8255bfac4c360f61712eca3da76fe90a49be84)
11+
- Added `trackTime` to API events (9a8a515bbebce17a68142c35242f0a9d38c13254)
12+
- Added `metadataAvailable`, `playbackHaltStateChanged`, `sessionCleared`, `sessionChanged`, `inactiveSession` events (5cfae00dfdd3fade92934c4504de6ac5268be1d4, b933939e165f4a76cc9c9cd65fb4f6d9f283d3a6)
13+
- API server is available immediately even for Zeroconf instances (#166, b933939e165f4a76cc9c9cd65fb4f6d9f283d3a6)
14+
15+
### Changed
16+
- Updated client version and type (b4d6476f49c81dc7db8f6d2c22bd7ead0a2a0095)
17+
- Improved download retry strategy (#163, fcd47e2ee0f8774a6adc8da4149339714d498e51)
18+
- Moved API configuration (`api.port` and `api.host`) to file (1c9a221221df0549d45003f96d4ca31297d7746f)
19+
- Modified `player/current` endpoint to include `trackTime` parameter (9a8a515bbebce17a68142c35242f0a9d38c13254)
20+
21+
### Fixed
22+
- Do not shuffle mixed playlists if not allowed (2e35d9bf74f12a417302a9b1ea43ab72c7cd7b1d)
23+
- Fixed NTP UDP socket timeout (4e5c5749039f98346f2f7fa0c4cded84b98d064d)
24+
- Fixed official client not working after disconnecting (#165)
25+
- Update time (`pcm_offset` in Vorbis codec) when seeking (553fa315663279754e0f5d19d1012073dc6d8bd3)
26+
- Fixed pausing state being overridden in some cases (651d6d78e10773103867131660a746669def74ea)
27+
28+
29+
## [1.1.0] - 13-12-2019
30+
### Added
31+
- Websocket API to listen to player events
32+
- Ability to change the API port via `api.port`
33+
- Retry request when Spotify sends 503
34+
35+
### Changed
36+
- Fixed deadlocks
37+
- Fixed synchronization issue

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ To run the newly build jar run `java -jar ./core/target/librespot-core-jar-with-
5656

5757
## Related Projects
5858
- [librespot](https://github.com/librespot-org/librespot)
59-
- [ansible-role-librespot](https://github.com/xMordax/ansible-role-librespot/tree/master) - Ansible role that will build, install and configure Librespot-Java.
59+
- [ansible-role-librespot](https://github.com/xMordax/ansible-role-librespot/tree/master) - Ansible role that will build, install and configure librespot-java.
60+
- [spocon](https://github.com/spocon/spocon) - Install librespot-java from APT
6061

6162
# Special thanks
6263

api/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>xyz.gianlu.librespot</groupId>
77
<artifactId>librespot-java</artifactId>
8-
<version>1.1.0</version>
8+
<version>1.2.0</version>
99
<relativePath>../</relativePath>
1010
</parent>
1111

@@ -54,7 +54,7 @@
5454
<dependency>
5555
<groupId>io.undertow</groupId>
5656
<artifactId>undertow-core</artifactId>
57-
<version>2.0.27.Final</version>
57+
<version>2.0.29.Final</version>
5858
</dependency>
5959
<dependency>
6060
<groupId>com.stijndewitt.undertow.cors</groupId>

api/src/main/java/xyz/gianlu/librespot/api/handlers/PlayerHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private enum Command {
147147
NEXT("next"), PREV("prev"), SET_VOLUME("set-volume"),
148148
VOLUME_UP("volume-up"), VOLUME_DOWN("volume-down"), CURRENT("current");
149149

150-
private String name;
150+
private final String name;
151151

152152
Command(String name) {
153153
this.name = name;

common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>xyz.gianlu.librespot</groupId>
77
<artifactId>librespot-java</artifactId>
8-
<version>1.1.0</version>
8+
<version>1.2.0</version>
99
<relativePath>../</relativePath>
1010
</parent>
1111

core/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>xyz.gianlu.librespot</groupId>
77
<artifactId>librespot-java</artifactId>
8-
<version>1.1.0</version>
8+
<version>1.2.0</version>
99
<relativePath>../</relativePath>
1010
</parent>
1111

@@ -75,21 +75,21 @@
7575
<dependency>
7676
<groupId>com.h2database</groupId>
7777
<artifactId>h2</artifactId>
78-
<version>1.4.199</version>
78+
<version>1.4.200</version>
7979
</dependency>
8080

8181
<!-- HTTP -->
8282
<dependency>
8383
<groupId>com.squareup.okhttp3</groupId>
8484
<artifactId>okhttp</artifactId>
85-
<version>4.0.1</version>
85+
<version>4.3.1</version>
8686
</dependency>
8787

8888
<!-- TOML configuration -->
8989
<dependency>
9090
<groupId>com.electronwill.night-config</groupId>
9191
<artifactId>toml</artifactId>
92-
<version>3.6.0</version>
92+
<version>3.6.2</version>
9393
</dependency>
9494

9595
<!-- Commons Net (NTP) -->

core/src/main/java/xyz/gianlu/librespot/BytesArrayList.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ public int read(@NotNull byte[] b, int off, int len) {
118118

119119
int i = 0;
120120
while (true) {
121-
if (sub >= elementData.length)
122-
return i;
123-
124121
int copy = Math.min(len - i, elementData[sub].length - offset);
125122
System.arraycopy(elementData[sub], offset, b, off + i, copy);
126123
i += copy;

core/src/main/java/xyz/gianlu/librespot/core/ApResolver.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
* @author Gianlu
2323
*/
2424
public class ApResolver {
25-
private static final JsonParser PARSER = new JsonParser();
2625
private static final String BASE_URL = "http://apresolve.spotify.com/";
2726
private static final Map<String, List<String>> pool = new HashMap<>(3);
2827
private static final Logger LOGGER = Logger.getLogger(ApResolver.class);
@@ -54,7 +53,7 @@ private static Map<String, List<String>> request(@NotNull String... types) throw
5453
conn.connect();
5554

5655
try {
57-
JsonObject obj = PARSER.parse(new InputStreamReader(conn.getInputStream())).getAsJsonObject();
56+
JsonObject obj = JsonParser.parseReader(new InputStreamReader(conn.getInputStream())).getAsJsonObject();
5857
HashMap<String, List<String>> map = new HashMap<>();
5958
for (String type : types)
6059
map.put(type, getUrls(obj, type));

core/src/main/java/xyz/gianlu/librespot/core/FacebookAuthenticator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
public class FacebookAuthenticator implements Closeable {
2525
private static final URL LOGIN_SPOTIFY;
26-
private static final JsonParser PARSER = new JsonParser();
2726
private static final Logger LOGGER = Logger.getLogger(FacebookAuthenticator.class);
2827
private static final byte[] EOL = new byte[]{'\r', '\n'};
2928

@@ -44,7 +43,7 @@ public class FacebookAuthenticator implements Closeable {
4443
HttpURLConnection conn = (HttpURLConnection) LOGIN_SPOTIFY.openConnection();
4544
try {
4645
conn.connect();
47-
JsonObject obj = PARSER.parse(new InputStreamReader(conn.getInputStream())).getAsJsonObject();
46+
JsonObject obj = JsonParser.parseReader(new InputStreamReader(conn.getInputStream())).getAsJsonObject();
4847
credentialsUrl = obj.get("credentials_url").getAsString();
4948
String loginUrl = obj.get("login_url").getAsString();
5049
LOGGER.info(String.format("Visit %s in your browser.", loginUrl));
@@ -73,7 +72,7 @@ public void close() throws IOException {
7372
}
7473

7574
private void authData(@NotNull String json) {
76-
JsonObject obj = PARSER.parse(json).getAsJsonObject();
75+
JsonObject obj = JsonParser.parseString(json).getAsJsonObject();
7776
if (!obj.get("error").isJsonNull()) {
7877
LOGGER.fatal("Error during authentication: " + obj.get("error"));
7978
return;

core/src/main/java/xyz/gianlu/librespot/core/SearchManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
public class SearchManager {
1818
private static final String BASE_URL = "hm://searchview/km/v4/search/";
19-
private static final JsonParser PARSER = new JsonParser();
2019
private final Session session;
2120

2221
public SearchManager(@NotNull Session session) {
@@ -34,7 +33,7 @@ public JsonObject request(@NotNull SearchRequest req) throws IOException {
3433

3534
if (resp.statusCode != 200) throw new SearchException(resp.statusCode);
3635

37-
return (JsonObject) PARSER.parse(new InputStreamReader(resp.payload.stream()));
36+
return JsonParser.parseReader(new InputStreamReader(resp.payload.stream())).getAsJsonObject();
3837
}
3938

4039
public static class SearchException extends IOException {

0 commit comments

Comments
 (0)