-
-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can choose it in Spotify but it doesn't connect #126
Comments
Hi Kamil i had a similar problem: raspotify showed up in the Spotify connect list, but i could not connect (connecting -> standby). The problem was that i had port 4070 blocked in my firewall. Maybe you have a similar problem? Have a look at the file /var/log/daemon.log . you should see messages like 'Started Raspotify.' 'INFO:librespot_core::session: Connecting to AP "XXX:4070"' (where XXX is some spotify.com address), 'INFO:librespot_core::session: Authenticated as "YYY"' (where YYY is your spotify username - in case you filled it in in the conf-file). i did not see that last line at the start, but after i tried to connect via the spotify connect list there were messages like 'thread 'main' panicked at 'called Opening up port 4070 solved it for me. Hope it helps |
raspotify recently stopped working for me, too. Not sure if this is the issue you're seeing, but looking at
|
I take that back, it seems to be track dependent. It failed when I tried to select my output device immediately upon opening spotify, but when I started a track (playing locally) and then switched to my Raspberry Pi running raspotify, it worked okay. Apologies if this isn't any help (but do check out your log file(s) for any potential issues, as @stefjan suggested). |
I have this problem with a previous and recent version of raspotify on my pi zero with stretch but there are no suspicious entries in my daemon.log. Also systemctl status raspotify shows no errors. After updating i could managed to get a connection but playing a song wasn't possible over the iOS App. A few tries later everything was like before the update and no connection was possible. I also tried the macOS App and numerous daemon restarts. |
Hi! Thanks for the answers! I don't know what happened but yesterday it worked for couple of hours. Now I came back from work and just connected and the music is playing. I guess I have to use it more and see if it will be stable... I hope so :) But when I read the log from yesterday I see this happening in a loop for like 50minutes or so... WOW. Jun 24 14:15:27 raspberrypi librespot[385]: INFO:librespot_core::session: Connecting to AP "gew1-accesspoint-b-mp8m.ap.spotify.com:4070" AND SO ON UNTIL: Jun 24 15:04:02 raspberrypi systemd[1]: raspotify.service: Service hold-off time over, scheduling restart. Any ideas? Now I am listening to 5th song in a row... |
And this is what happened today. Jun 26 01:53:05 raspberrypi systemd[1]: Starting Daily apt download activities... And now I wanted to connect by android phone app but again, I have seen the raspotify on the list but couldn't connect. And now it's not listed on the phone anymore. This is the log from the time I wanted to connect by phone: Jun 26 07:19:27 raspberrypi dbus[315]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' Like nothing from librespot...hmmmm....Oh. And it also disappeared from the desktop spotify device list. |
What tracks is it failing on? |
Well generally as I observe the problem is that I come from work and try to connect and sometimes it connects sometimes not. I reboot the raspberry and after some time it shows up again in spotify list and I can or can't connect. I reboot again and finally it connects and I can listen to the music. I play it and do stuff and generally they are my playlists. While listening to the music I do other stuff so I don't know when it stops playing. I should maybe spaend a day home and test it but it is hard for me to organize such a time ;) |
Ok. So I played couple of playlists and IT was ok. But on the third song of a radio based on one od my playlists IT disconnected and disappeared from the list... |
Thank you very much! I had the same problem that I was not able to connect to my raspberry (click on connect inside e.g. the application on Windows and nothing happens) and this fixed it for me. |
without any warranty but I think this resolved this issue i.e. opened up the port 4070:
|
Pretty sure that...
... is connecting to a remote server on
... is what was intended, however, from my own tests it looks like there's two ports that are listening for Raspotify... netstat -plantu | grep -- '/librespot'
#> tcp 0 0 0.0.0.0:36843 0.0.0.0:* LISTEN 1630/librespot
#> udp 0 0 0.0.0.0:5353 0.0.0.0:* 1630/librespot ... of which only #!/usr/bin/env bash
## Lists listening ports for given service and protocol via `netstat`
## @returns {number|list}
## @param {string} _service_name - Name of service to `grep` for
## @param {string[tcp|udp]} _protocol - Protocol that service communicates through
## @param {number} _sleep_interval - Number of seconds to sleep between checks
## @param {number} _loop_limit - Max number of loops before function returns error code
## @author S0AndS0
## @copyright AGPL-3.0
## @exampe As an array
## _sshd_ports_list=($(await_service_port 'sshd'))
## printf 'SSHD listening port: %s\n' "${_sshd_ports_list[@]}"
## #> SSHD Port: 22
## #> SSHD Port: 2222
## @example As a string
## _sshd_ports_string="$(await_service_port 'sshd')"
## printf 'SSHD listening port(s): %s\n' "${_sshd_ports_string}"
## #> SSH Ports: 22 2222
await_service_port(){
local _service_name="${1:?# Parameter_Error: no service name supplied to ${FUNCNAME}}"
local _protocol="${2:-tcp}"
local _sleep_interval="${3:-1}"
local _loop_limit="${4:-10}"
if [ "${_sleep_interval}" -le '0' ] || [ "${_loop_limit}" -le '0' ]; then
printf 'Parameter_Error: %s requires positive numbers for third and forth parameters\n' "${FUNCNAME[0]}" >&2
return 1
fi
case "${_protocol,,}" in
tcp)
local _netstat_opts='plant'
;;
udp)
local _netstat_opts='planu'
;;
*)
printf '# Parameter_Error: protocol must either be "tcp" or "udp"' >&2
return 1
;;
esac
local _loop_count='0'
local -a _listen_ports
while true; do
local _netstat_service="$(netstat -${_netstat_opts} 2>/dev/null | grep -E -- "/${_service_name}( +)")"
for _port in $(awk '{gsub(":"," "); print $5}' <<<"${_netstat_service}"); do
_listen_ports+=("${_port}")
done
if [ "${#_listen_ports[@]}" -gt '0' ]; then
printf '%s\n' "${_listen_ports[*]}"
break
elif [ "${_loop_count}" -gt "${_loop_limit}" ]; then
break
fi
let _loop_count+='1'
sleep "${_sleep_interval}"
done
[[ "${#_ipv4_addresses[@]}" -gt '0' ]]; return "${?}"
} ... that lists listening ports, even those dynamically assigned at service start, which may be utilized in scripts kind like...
#!/usr/bin/env bash
## Find true directory this script resides in
__SOURCE__="${BASH_SOURCE[0]}"
while [[ -h "${__SOURCE__}" ]]; do
__SOURCE__="$(find "${__SOURCE__}" -type l -ls | sed -n 's@^.* -> \(.*\)@\1@p')"
done
__DIR__="$(cd -P "$(dirname "${__SOURCE__}")" && pwd)"
__NAME__="${__SOURCE__##*/}"
## Source module code within this script
source "${__DIR__}/modules/await-service-port/await-service-port.sh"
start_up(){
iptables --new-chain eth0_input_raspotify
iptables --new-chain eth0_output_raspotify
_raspotify_tcp_ports=($(await_service_port 'librespot' 'tcp' '1' '19'))
for _port in "${_raspotify_tcp_ports[@]}"; do
iptables -A eth0_input_raspotify\
-i eth0\
-s 192.168.0.1/24\
--dport ${_port}\
-p tcp\
-m conntrack --ctstate NEW,ESTABLISHED -m limit --limit 5/second --limit-burst 100 -j ACCEPT
iptables -A eth0_output_raspotify\
-o eth0\
-d 192.168.0.1/24\
--sport ${_port}\
-p tcp\
-m conntrack --ctstate ESTABLISHED -j ACCEPT
done
eth0_input_raspotify
}
stop_down(){
iptables -F eth0_output_raspotify
iptables -X eth0_output_raspotify
iptables -F eth0_input_raspotify
iptables -X eth0_input_raspotify
}
## Parse the start/stop argument
case "${1,,}" in
'start'|'up')
start_up
;;
'stop'|'down')
stop_down
;;
*)
printf '%s cannot do that right now' "${__NAME__}" >&2
exit 1
;;
esac ... although above's incomplete it should provide a starting point for those that don't want to await other related projects to be
... as it holds the morals of what iptables rules are required to have happy clients when Raspotify is on a device with the default output policy set to |
I had the same problem, used google, found the thread, found a better solution and want to write it here for other guys: For this problem there is a much simpler solution. So opening this configured port (tcp) and port tcp/4070 is working well. |
Hi,
I am totally new in this. I have a RPi3 with Hifiberry. Used to use musicbox but it frequently didn't work and today installed Raspbian and Raspotify... Well... It even worked. Once. I decided to switch the RPi off to put it back into the case and now it doesn't work anymore. I have seen one post with the same issue but.... I don't know. I can see the "Malinka" (small raspberry in Polish) listed in Spotify Connect list but wen I click it it says "Connecting" and after couple of seconds it goes "Standby" again...
I've installed the Raspotify with the auto option and edited the conf... Help? :)
All best!
Kamil
The text was updated successfully, but these errors were encountered: