Spotty-Plugin icon indicating copy to clipboard operation
Spotty-Plugin copied to clipboard

Spotty and Spotfire Family

Open hansherlighed opened this issue 3 years ago • 10 comments

Hi,

First of all, thanks for the great plug-in, have been using it for a long time!

I have a strange problem. We have 3 squeezeboxes connected to LMS 7.9.3(have tried 8.0.0 as well). We also have a Denon receiver with Spotfire Connect. We recently moved to a Spotfire Family subscription, and now we are having problems getting Spotty to work. We have 4 Spotfire accounts under a Family subscription. Let's call them U1, U2, U3, U4

No matter what settings I set for the Spotty plug-in this is what I see:

  • When only adding the Family coordinator account(U1) to Spotty, U1 can see all 3 SB's in the "Connect to device" list in Spotify. Non of the other 3 users can see the 3 SB's, but all can see the Denon receiver.
  • Adding 1 or more of the others users to Spotty, no one can see any of the 3 SB's, but all can still see Denon
  • After adding multiple users to Spotty, I can go to the LMS web interface and go to "Home->My apps->Spotty->USER->Playlist" and the SB chosen will appear in the connect list of the USER chosen in the path(e.g U1).
    • If I switch to another SB and go to the same path, that SB also appears in the list of the chosen USER.
    • If I choose another USER(e.g U2) in the path, then that SB will disappear from the list of U1 and appear in the list of U2

I've tried all I can think of, but it's the same result. Seems Spotify connect can only work for 1 user a a time? As soon as you use the LMS Web interface to browse anything under Spotty, the Spotify connect option disappears from 1 user and appears for the other. Is this as designed, an error, or something in my settings that I'm doing wrong?

I've also tried following this advice: https://forums.slimdevices.com/showthread.php?107683-Spotty-and-Family-Account-Assign-User-toplayer which kind of solves my issue, as I can assign 1 SB to 1 user, but I'd like all 4 users to be able to connect to all 3 SB's, is this possible?

Thanks in advance for any help.

hansherlighed avatar Nov 24 '20 19:11 hansherlighed

I assume Spotfire is autocorrected Spotify? 😂

On what kind of hardware is your LMS running? I think what you're struggling with is the "local announcement" of your Spotify Connect enabled players. This announcement sometimes fails, depending on the environment on which LMS is running. Eg. if there already is a conflicting service running.

I assume you've enabled Connect for all the players in Spotty?

Could you please post a screenshot of the lower part of the Spotty settings (not the accounts)?

michaelherger avatar Nov 25 '20 07:11 michaelherger

Hi Michael,

Thanks for the quick reply.

Here's a screenshot of my current settings. I've tried with 1 account, multiple accounts and any combination of accounts. I've also tried with and without a ClientID, and all combinations of the settings that I can think of. image

I forgot to mention I'm using the official/community LMS Docker image using this RUN command: docker run -it \ -v config:"/config":rw \ -v music:"/music":ro \ -v playlist:"/playlist":ro \ -v "/etc/localtime":"/etc/localtime":ro \ -v "/etc/timezone":"/etc/timezone":ro \ -p 9000:9000/tcp \ -p 9090:9090/tcp \ -p 3483:3483/tcp \ -p 3483:3483/udp \ lmscommunity/logitechmediaserver

Thanks.

hansherlighed avatar Nov 25 '20 08:11 hansherlighed

Oh, Docker! That's actually something I haven't fully tested yet. Please try to map port 5353/UDP, too (-p 5353:5353/udp).

michaelherger avatar Nov 26 '20 05:11 michaelherger

Oh, Docker! That's actually something I haven't fully tested yet. Please try to map port 5353/UDP, too (-p 5353:5353/udp).

I have already forwarded port 5353:5353/udp as well. It gives me the same behaviour as described in my initial post.

I can only get it to work as expected with 1 Spotify account added to LMS, and all SB's being available to all 4 users if I use the "--net host" option in the Docker run command, and also make sure to add these iptable rules: iptables -I INPUT -p tcp -m tcp -s 10.0.1.0/24 --dport 9000 -j ACCEPT iptables -I INPUT -p tcp -m tcp -s 10.0.1.0/24 --dport 3483 -j ACCEPT iptables -I INPUT -p udp -m udp -s 10.0.1.0/24 --dport 3483 -j ACCEPT iptables -I INPUT -p tcp -m tcp -s 10.0.1.0/24 --dport 32768:61000 -j ACCEPT iptables -I INPUT -p udp -m udp -s 10.0.1.0/24 --dport 5353 -j ACCEPT

I have no idea if the UDP port range is too large or too small, I cannot find info on what port range your plugin(or Phillipe44's Shairtune2) uses, and/or how to limit/specify a range to use. While it's theoritically possible to add such a huge port range to the Docker run command using argument -p "32768-61000:32768-61000/udp", it doesn't work in real life, as docker creates 1 iptable rule per port which eats up the resources of the system, and times out the RUN command.

Thanks.

hansherlighed avatar Nov 26 '20 08:11 hansherlighed

I certainly never had to touch iptables... which makes me wonder whether you've overengineered things. Would you have a simple system with no customisations, just Docker, to double-check whether the problem is in some of your tweaks?

michaelherger avatar Nov 27 '20 06:11 michaelherger

I do have a vanilla Docker installation, no tweaks. However, Docker is running on VMWARe's Photon OS on an ESXI server, so perhaps VMWARE has done some tweaks to the default Iptable rules. The default INPUT chain rules only allow traffic on LO(loopback) and incoming on port 22(SSH)

Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           /*only This is set for the LO interface */
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22

So that's why I need to create iptable rules when using the HOST network options.

hansherlighed avatar Nov 27 '20 06:11 hansherlighed

I did some more testing, and it seems that the helper program opens a TCP port per SB device. And also listens on UDP port 5353. If I open these port, then everything is working. Since 5353 is static, I do not have any problem opening that one, but how about the TCP port, is that configurable somehow, so that it can either be static or at least a range of ports?

# ps aux | grep spotty
lms      12287  0.0  0.0  10856  3536 ?        Sl   09:50   0:00 /config/cache/InstalledPlugins/Plugins/Spotty/Bin/i386-linux/spotty-x86_64 -c /config/cache/spotty/0004201e24fc -n Kitchen-Squeeze --disable-audio-cache --bitrate 96 --player-mac 00:04:20:1e:24:fc --lms 10.0.1.5:9000
lms      12290  0.0  0.0  10856  3604 ?        Sl   09:50   0:00 /config/cache/InstalledPlugins/Plugins/Spotty/Bin/i386-linux/spotty-x86_64 -c /config/cache/spotty/0004202dacd9 -n Theas-Squeeze --disable-audio-cache --bitrate 96 --player-mac 00:04:20:2d:ac:d9 --lms 10.0.1.5:9000
lms      12297  0.0  0.0  10856  3536 ?        Sl   09:50   0:00 /config/cache/InstalledPlugins/Plugins/Spotty/Bin/i386-linux/spotty-x86_64 -c /config/cache/spotty/0004202c93af -n Olivers-Squeeze --disable-audio-cache --bitrate 96 --player-mac 00:04:20:2c:93:af --lms 10.0.1.5:9000

# netstat -tulnp | grep spotty
tcp        0      0 0.0.0.0:44261           0.0.0.0:*               LISTEN      12290/spotty-x86_64
tcp        0      0 0.0.0.0:44265           0.0.0.0:*               LISTEN      12287/spotty-x86_64
tcp        0      0 0.0.0.0:34681           0.0.0.0:*               LISTEN      12297/spotty-x86_64
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           12297/spotty-x86_64
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           12290/spotty-x86_64
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           12287/spotty-x86_64

Thx.

hansherlighed avatar Nov 28 '20 09:11 hansherlighed

@michaelherger I see that the "original" librespot has a "zeroconf-port" option that seem to be what I'm looking for: https://github.com/librespot-org/librespot/wiki/Options It seems to specify the port number to be used. I get an error if I try to start your spotty plugin with this option set, so I'm guessing it's not implemented. I do not have the skills to understand how I could build librespot(or if it would work with LMS), so I'm hoping you'll be able to help point me in the right direction.

This is the error I get:

# /cache/InstalledPlugins/Plugins/Spotty/Bin/i386-linux/spotty-x86_64 -c /config/cache/spotty/0004201e24fc -n Squeeze --disable-audio-cache --bitrate 160 --player-mac 00:04:20:2e:24:fc --lms 10.0.0.5:9000 --zeroconf-port 46030

spotty v0.35.0
error: Unrecognized option: 'zeroconf-port'

hansherlighed avatar Nov 30 '20 23:11 hansherlighed

The latest helper version should support the zeroconf-port. That said I've never used it, nor is there support in Spotty (the plugin). You'd probably have to hard-code it into the plugin's custom-convert.conf, or provide your own.

michaelherger avatar Jun 28 '21 06:06 michaelherger

Great Issue; very well documented and helped a lot. I've experienced exactly the same as having a Spotify family account with four users. For me, the solution was to create a docker network with macvlan driver and therefore assigning the container to the main network directly with its own IP and everything. Now everything works again as expected. Interesting enough, that it worked for some time with just exposing some ports.

linus-ha avatar Aug 08 '22 20:08 linus-ha