spocon / lovspotify

Spotify GUI + Spotify Client for Raspberry PI , Ubuntu and Debian
54 stars 4 forks source link

How to access API from librespot-java #8

Closed slawomirbiernacki closed 4 years ago

slawomirbiernacki commented 4 years ago

Hello!

First of all thanks for this awesome project, this is exactly what I need for my home stereo. I can see that in the config file there's a section for API configuration. I assume this is for the API module provided in librespot-java/api which I want to use. However after starting the service I can see that the port isn't open and I cannot reach it. To make sure I do everything correctly I downloaded api jar from latest librespot-java release and ran it - I can see API is up.

Therefore my question is - do I need to do anything extra to access API when using this project? Or this project is not intended to have it on?

I looked into the build.gradle in your project and it has dependency on librespot-core. My understanding is that API is available in librespot-api which is built on top of librespot-core. Is that why API isn't available? Would that be a hassle to change it? I appreciate I might be missing context here.

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-web') {
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
    }
    implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.0'
    implementation 'com.google.protobuf:protobuf-java-util:3.11.4'
    implementation ('xyz.gianlu.librespot:librespot-core:1.3.1') {
        exclude group: 'log4j'
    }
    implementation'org.apache.logging.log4j:log4j-1.2-api:2.13.2'
    implementation 'org.apache.logging.log4j:log4j-core:2.13.2'
    implementation 'org.apache.logging.log4j:log4j-api:2.13.2'
}
spocon commented 4 years ago

This project doesn't use librespot's api but has its own. I copied the configuration file from librespot tho to make it easier to upgrade librespot-core.

My Api is here:

https://github.com/spocon/lovspotify/blob/master/src/main/java/me/haga/librespot/spotifi/controller/PlayerController.java

if you want only the librespot-api without frontend than i recommend another project of mine. Its just a deb package which includes librespot-api: https://github.com/spocon/spocon

slawomirbiernacki commented 4 years ago

Ah I see, I missed that! Thanks for the response, for my use case I need event api, so I'll switch to spocon to use one provided with librespot-java - I want to turn on my amplifier when I stream from my raspberry.

Thank you👍