librespot-org / librespot

Open Source Spotify client library
MIT License
4.86k stars 616 forks source link

Librespot won't start on a custom port using --ap-port=xxxx #1056

Closed yanover closed 2 years ago

yanover commented 2 years ago

Describe the bug I'm trying to run librespot on a specific port.

To reproduce Steps to reproduce the behavior:

  1. Launch librespot with librespot --ap-port=4070
  2. Test ithe listening port
  3. The process is launch but the target port is a random one
  4. Log

    
    root@librespot-667cb86f5b-z2rj2:/# librespot --ap-port=4070 &
    [2] 584
    root@librespot-667cb86f5b-z2rj2:/# [2022-08-31T15:24:49Z INFO  librespot] librespot 0.4.2 6537c44 (Built on 2022-08-26, Build ID: eUmUV2Pm, Profile: release)

root@librespot-667cb86f5b-z2rj2:/# netstat -tulpn | grep LISTEN tcp 0 0 0.0.0.0:41561 0.0.0.0: LISTEN 18/librespot
tcp 0 0 0.0.0.0:34209 0.0.0.0:
LISTEN 584/librespot
tcp 0 0 0.0.0.0:44523 0.0.0.0:* LISTEN 580/librespot



**Host (what you are running `librespot` on):**
- OS: Debian GNU/Linux 11 (bullseye)"
- Platform: inside a k3s pod
kingosticks commented 2 years ago
  | ap-port | Connect to an AP with a specified port. If no AP with that port is present a fallback AP will be used. Available ports are usually 80, 443 and 4070. -- | -- | --

That is the port of Spotify's Access Point you want to connect to, not the port librespot listens on.

I'm trying to run librespot on a specific port.

You can't do this. Librespot doesn't listen on any ports (other than for zeroconf). It connects to a Spotify Access Point server and communicates with other clients via this server.

EDIT: Actually, I can't' remember if this is true. Someone else can correct me here please.

eladyn commented 2 years ago

There's --zeroconf-port, which sets the port that librespot listens on for zeroconf, which is probably what @yanover tries to do?

yanover commented 2 years ago

Yes this is the option I was looking for, I missed it in the documentation, thank you !

What is not clear to me is which port my Spotify client will listen on.

If I create a service that listens on my pod's port 4070, which port(s) should be exposed outside of the cluster to my client ?

I found in different place that spotify-connect listen on port TCP and UDP port 57621, is that correct ?

roderickvd commented 2 years ago

Not a bug. Feel free to chat on https://gitter.im/librespot-org/spotify-connect-resources.