SoundcloudBackend Raising 500: Internal Server Error


#1

Hey There!,

I’ve just installed Pi Musicbox and i’ve found a small problem.
Every time i try to browse my Soundcloud Playlists and liked tracks (via Browse --> Soundcloud),
i see the following Traceback in the debug log:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pykka/actor.py", line 201, in _actor_loop
    response = self._handle_receive(message)
  File "/usr/local/lib/python2.7/dist-packages/pykka/actor.py", line 295, in _handle_receive
    return callee(*message['args'], **message['kwargs'])
  File "/usr/local/lib/python2.7/dist-packages/mopidy_soundcloud/library.py", line 126, in browse
    return self.list_liked()
  File "/usr/local/lib/python2.7/dist-packages/mopidy_soundcloud/library.py", line 72, in list_liked
    for data in self.backend.remote.get_user_liked():
  File "/usr/local/lib/python2.7/dist-packages/mopidy_soundcloud/soundcloud.py", line 147, in get_user_liked
    liked = self._get('e1/me/likes?limit=1000')
  File "/usr/local/lib/python2.7/dist-packages/mopidy_soundcloud/soundcloud.py", line 205, in _get
    res.raise_for_status()
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 500 Server Error: Internal Server Error for url: https://api.soundcloud.com/e1/me/likes?limit=1000&client_id=<hidden>
2018-10-11 22:52:32,693 ERROR [2489:Core-18] mopidy.core.library: SoundCloudBackend backend caused an exception.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/mopidy/core/library.py", line 19, in _backend_error_handling
    yield
  File "/usr/local/lib/python2.7/dist-packages/mopidy/core/library.py", line 112, in _browse
    result = backend.library.browse(uri).get()
  File "/usr/local/lib/python2.7/dist-packages/pykka/threading.py", line 52, in get
    compat.reraise(*self._data['exc_info'])
  File "/usr/local/lib/python2.7/dist-packages/pykka/compat.py", line 12, in reraise
    exec('raise tp, value, tb')
  File "/usr/local/lib/python2.7/dist-packages/pykka/actor.py", line 201, in _actor_loop
    response = self._handle_receive(message)
  File "/usr/local/lib/python2.7/dist-packages/pykka/actor.py", line 295, in _handle_receive
    return callee(*message['args'], **message['kwargs'])
  File "/usr/local/lib/python2.7/dist-packages/mopidy_soundcloud/library.py", line 126, in browse
    return self.list_liked()
  File "/usr/local/lib/python2.7/dist-packages/mopidy_soundcloud/library.py", line 72, in list_liked
    for data in self.backend.remote.get_user_liked():
  File "/usr/local/lib/python2.7/dist-packages/mopidy_soundcloud/soundcloud.py", line 147, in get_user_liked
    liked = self._get('e1/me/likes?limit=1000')
  File "/usr/local/lib/python2.7/dist-packages/mopidy_soundcloud/soundcloud.py", line 205, in _get
    res.raise_for_status()
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 500 Server Error: Internal Server Error for url: https://api.soundcloud.com/e1/me/likes?limit=1000&client_id=<hidden>
2018-10-11 22:52:32,703 DEBUG [2489:MpdSession-26] mopidy.mpd.session: Response to [::ffff:127.0.0.1]:33354:

(client_id is hidden on purpose)

There is another (smaller) problem:
When playing a song from soundcloud, It sometimes takes 10 seconds or more to start playing. The webinterface shows “(sync)” instead of the current time.
During this time, i get tons of messages like

2018-10-11 22:57:03,081 DEBUG [2489:HttpServer] mopidy.http.handlers: Received WebSocket message from 192.168.1.7: u'{"method":"core.playback.get_time_position","jsonrpc":"2.0","id":351}'
2018-10-11 22:57:03,083 DEBUG [2489:Audio-2] mopidy.audio.actor: Position query failed

in my debug log. Since it mostly finds it after 10-30 seconds, it seems like soundcloud is responding in an unexpected way? Anyways, it prevents the song from playing.

Any idea about what might fix this? Is it a known issue?


#2

Is this the latest image from https://github.com/pimusicbox/pimusicbox/releases/tag/v0.7.0RC6 ?


#3

Yes it is! Installed it just yesterday.


#4

Looks like RC6 came out a really long time ago, how time flies! Since it’s release on 20th of March we did a bunch of fixes for mopidy-soundcloud. Please run:

pip install mopidy-soundcloud==2.1.0

#5

Likes works now! (even though it only shows about 20 songs, is it possible to increase this limit?

Under "Sets" (i suppose these are the Playlists that i created) it still gives me an error though:
    2018-10-12 23:30:04,606 DEBUG [2794:HttpServer] mopidy.http.handlers: Received WebSocket message from 192.168.1.6: u'{"method":"core.library.browse","params":{"uri":"soundcloud:directory:sets"},"jsonrpc":"2.0","id":88}'
    2018-10-12 23:30:05,409 DEBUG [2794:MpdSession-26] mopidy.mpd.session: Request from [::ffff:127.0.0.1]:59470: status
    2018-10-12 23:30:14,655 DEBUG [2794:SoundCloudBackend-14] urllib3.connectionpool: https://api.soundcloud.com:443 "GET /me/playlists?limit=25&client_id=(hiding this right here) HTTP/1.1" 500 None
    2018-10-12 23:30:14,657 DEBUG [2794:SoundCloudBackend-14] mopidy_soundcloud.soundcloud: Requested https://api.soundcloud.com/me/playlists?limit=25&client_id=(hiding this right here)
    2018-10-12 23:30:14,658 ERROR [2794:SoundCloudBackend-14] mopidy_soundcloud.soundcloud: SoundCloud API request failed: 500 Server Error: Internal Server Error for url: https://api.soundcloud.com/me/playlists?limit=25&client_id=(hiding this right here)


This also is still happening, but way less often and it mostly discoveres the correct position afer around 5 seconds:
    2018-10-12 23:37:10,185 DEBUG [2794:HttpServer] mopidy.http.handlers: Received WebSocket message from 192.168.1.6: u'{"method":"core.playback.get_time_position","jsonrpc":"2.0","id":243}'
    2018-10-12 23:37:10,187 DEBUG [2794:Audio-2] mopidy.audio.actor: Position query failed
    2018-10-12 23:37:11,064 DEBUG [2794:MpdSession-26] mopidy.mpd.session: Request from [::ffff:127.0.0.1]:59470: status
    2018-10-12 23:37:11,072 DEBUG [2794:Audio-2] mopidy.audio.actor: Position query failed
    2018-10-12 23:37:11,074 DEBUG [2794:MpdSession-26] mopidy.mpd.session: Response to [::ffff:127.0.0.1]:59470:

Here is something i found interesting. I don't know if this might be related to the problem, but see for yourself:
    2018-10-12 23:37:12,217 DEBUG [2794:HttpServer] mopidy.http.handlers: Received WebSocket message from 192.168.1.6: u'{"method":"core.playback.get_time_position","jsonrpc":"2.0","id":245}'
    2018-10-12 23:37:12,219 DEBUG [2794:Audio-2] mopidy.audio.actor: Position query failed
    2018-10-12 23:37:12,553 DEBUG [2794:MainThread] mopidy.audio.gst: Got buffering message: percent=0%
    2018-10-12 23:37:12,566 WARNING [2794:MainThread] mopidy.audio.gst: Element doesn't implement handling of this stream. Please file a bug.
    2018-10-12 23:37:12,568 DEBUG [2794:MainThread] mopidy.audio.gst: gstplaysink.c(1869): gen_audio_chain (): /GstPlayBin2:playbin20/GstPlaySink:playsink0:
    Volume/mute is not available

i suppose this is nothing that we can fix, but you never know. let me know if you need any more information! :slight_smile: