sailfish-spotify / hutspot

Spotify Controller for SailfishOS. Documentation: https://sailfish-spotify.github.io/hutspot.
MIT License
18 stars 11 forks source link

404 after playing one song #95

Open wosrediinanatour opened 5 years ago

wosrediinanatour commented 5 years ago

Dear all,

After playing a song using Librespot, playing stops (404 error). Then I have to stop and restart Librespot for the next song. (latest versions). Haven't success to start and authorize Librespot manually yet.

By the way: if in the settings automatically start/stop at launch/stop of Hutspot is enabled, I have to restart Librespot manually for success.

wosrediinanatour commented 5 years ago

PS: it semms to work better, when Librespot has been started at console.

wosrediinanatour commented 5 years ago

ok, got the same problem when trying to start a new song. Hutspot writes Error 404, but Librespot doesn't show any reaction, it continues to a play current song without any logging. I guess thats a problem between Hutspot and Librespot.

wdehoog commented 5 years ago

Could you check, when the error occurs, what is shown on the Devices page? Is Librespot still present and active? Does the logs show anything helpfull (devel-su journalctl -af and then start hutspot)?

wosrediinanatour commented 5 years ago

After restarting Hutspot and trying a little bit, Librespot got the error Invalid Session with "code 104, Connection reset by peer".

No, Librespot wasn't present & active (it was grey).

I will check journal again when I can connect by SSH (skimming over the logs at time of last directly use on my device, doesn't show me anything relevant.)

wdehoog commented 5 years ago

Make sure you have only one librespot instance running (ps aux | grep librespot).

You say 'Librespot got the error Invalid Session with "code 104, Connection reset by peer".' what does it mean? How does librespot 'got the error'? The message you give "code 104, Connection reset by peer" does not sound familiar. Google does not give much info as well. Are you sure it originates from librespot?

wosrediinanatour commented 5 years ago

I will.

"code 104, Connection reset by peer" was in the Librespot's output, when started at the console (before I could see that Librespot was streaming the file it played). The message was part of a JSON message, so I guess it was by/from the Spotify server.

wosrediinanatour commented 5 years ago

Next try: It worked for some songs. But then, when changing song, 404 Error is shown in Hutspot and Librespot continue playing (does not show errors). Journal:: `Feb 25 18:54:20 Sailfish [13508]: [D] :201 - number of AlbumTracks: 18

Feb 25 18:54:20 Sailfish [13508]: [D] :244 - number of ArtistAlbums: 32 Feb 25 18:54:23 Sailfish [13508]: [D] :201 - number of AlbumTracks: 18 Feb 25 18:54:30 Sailfish [13508]: [W] unknown:38 - file:///usr/share/hutspot/qml/components/PlaybackState.qml:38: TypeError: Cannot read property 'images' of undefined Feb 25 18:54:30 Sailfish [13508]: [W] unknown:694 - file:///usr/share/hutspot/qml/pages/Playing.qml:694: TypeError: Cannot read property 'name' of undefined Feb 25 18:54:34 Sailfish [13508]: [W] unknown:38 - file:///usr/share/hutspot/qml/components/PlaybackState.qml:38: TypeError: Cannot read property 'images' of undefined Feb 25 18:54:34 Sailfish [13508]: [W] unknown:694 - file:///usr/share/hutspot/qml/pages/Playing.qml:694: TypeError: Cannot read property 'name' of undefined Feb 25 18:54:34 Sailfish [13508]: [W] unknown:38 - file:///usr/share/hutspot/qml/components/PlaybackState.qml:38: TypeError: Cannot read property 'images' of undefined Feb 25 18:54:34 Sailfish [13508]: [W] unknown:694 - file:///usr/share/hutspot/qml/pages/Playing.qml:694: TypeError: Cannot read property 'name' of undefined Feb 25 18:54:35 Sailfish [13508]: [W] unknown:38 - file:///usr/share/hutspot/qml/components/PlaybackState.qml:38: TypeError: Cannot read property 'images' of undefined Feb 25 18:54:35 Sailfish [13508]: [W] unknown:694 - file:///usr/share/hutspot/qml/pages/Playing.qml:694: TypeError: Cannot read property 'name' of undefined Feb 25 18:54:35 Sailfish [13508]: [W] unknown:38 - file:///usr/share/hutspot/qml/components/PlaybackState.qml:38: TypeError: Cannot read property 'images' of undefined Feb 25 18:54:35 Sailfish [13508]: [W] unknown:694 - file:///usr/share/hutspot/qml/pages/Playing.qml:694: TypeError: Cannot read property 'name' of undefined Feb 25 18:54:35 Sailfish [13508]: [W] unknown:38 - file:///usr/share/hutspot/qml/components/PlaybackState.qml:38: TypeError: Cannot read property 'images' of undefined Feb 25 18:54:35 Sailfish [13508]: [W] unknown:694 - file:///usr/share/hutspot/qml/pages/Playing.qml:694: TypeError: Cannot read property 'name' of undefined Feb 25 18:54:37 Sailfish [13508]: [W] unknown:38 - file:///usr/share/hutspot/qml/components/PlaybackState.qml:38: TypeError: Cannot read property 'images' of undefined Feb 25 18:54:37 Sailfish [13508]: [W] unknown:694 - file:///usr/share/hutspot/qml/pages/Playing.qml:694: TypeError: Cannot read property 'name' of undefined Feb 25 18:54:50 Sailfish [13508]: [C] :94 - _performRequest: 404: Device not found Feb 25 18:54:50 Sailfish [13508]: [C] :94 - _performRequest: 404: Device not found Feb 25 18:54:54 Sailfish [13508]: [C] :94 - _performRequest: 404: Device not found Feb 25 18:54:54 Sailfish [13508]: [C] :94 - _performRequest: 404: Device not found Feb 25 18:54:55 Sailfish [13508]: [C] :94 - _performRequest: 404: Device not found Feb 25 18:54:55 Sailfish [13508]: [C] :94 - _performRequest: 404: Device not found`

I attached journal and console output. librespot_console.txt journal.txt

wdehoog commented 5 years ago

The log shows hutspot has restarted. Did you do that? Sorry but I have no idea what is causing hutspot to loose connection with librespot (no current device).

What phone do you use it on? Could you try to test a more recent version? See http://repo.merproject.org/obs/home:/wdehoog:/hutspot/sailfish_latest_armv7hl/armv7hl/

wosrediinanatour commented 5 years ago

I hit CTRL+C...

I am using Sony Xperia X. Thx, I will try.

wosrediinanatour commented 5 years ago

@wdehoog: Maybe I missunderstood you. I think that you mean that Librespot restarted, when the connection got lost. I played around with Hutspot/Librespot and reinstalled the latest versions of Hutspot and Librespot. First it worked quite well, but after about 10 or 15 songs, it happend again: Hutspot/Librespot plays only one song. Then I had to restart Librespot from the settings page, and it worked for the next song only (but the next song is no that one I choose).

Update: It is quite interesting: I wanted to test again connected with SSH and devel-su journalctl -af, but it works . The only difference I see is that the phone does not move...(I usually use/try Hutspot/Librespot in the train or when walking).

Update 2: I found some problems (issues) on Librespots Github site. Maybe it is this: https://github.com/librespot-org/librespot/pull/291

wdehoog commented 5 years ago

Losing network connection is problematic. Hutspot can detect it and quit. Auto reconnect/start or whatever is needed is not implemented. Hutspot would probably need to reregister with Spotify and with the Librespot instance.

wdehoog commented 5 years ago

The issue you refer to is about another problem. The version of Librespot on openrepos.net already contains this fix.

wosrediinanatour commented 5 years ago

Ok, thx

wdehoog commented 5 years ago

Does not look good. Librespot cannot recover from a broken network connection see https://github.com/librespot-org/librespot/issues/134.

I suppose we can't do more then stop the librespot service, wait for a network connection, reconnect to spotify, start Librespot and reregister with it. Which in the end gives not much more then just quit and let the user restart hutspot.

wosrediinanatour commented 5 years ago

That seems to be the root cause, yes. (And maybe even high latency in mobile networks)