mopidy / mopidy-soundcloud

Mopidy extension for playing music from SoundCloud
https://mopidy.com/ext/soundcloud/
MIT License
184 stars 59 forks source link

Fetching likes list from soundcloud crashes ncmpcpp #45

Closed laur89 closed 8 years ago

laur89 commented 9 years ago

This sound more like ncmpcpp issue really, but can't quite believe it. Fetcing likes list causes ncmpcpp to crash with the following message in console, leaving terminal instance unusable:

ncmpcpp: src/send.c:61: send_check: Assertion 'connection != ((void *)0)' failed.
Connected to localhost!                                                          Aborted

mopidy log looks okay to me. It appears to be successful fetching the tracks. Could it be related to fact the likes list is somewhat largeish, totaling ~370 items? Playing small sets has no issues whatsoever.

#   Mopidy 0.19.5
#   Mopidy-HTTP 0.19.5
#   Mopidy-Local 0.19.5
#   Mopidy-MPD 0.19.5
#   Mopidy-SoftwareMixer 0.19.5
#   Mopidy-SoundCloud 1.2.5
#   Mopidy-Spotify 1.2.0
#   Mopidy-Stream 0.19.5

Note: hand-patched the changes introduced by 461ef6c08be277f3348a13e187a881afd3c9d4c6 and ac137b270a89c097360738ee87d2c66422b23817

full log @ http://pastebin.com/Sicnuw45

On an unrelated note, is it normal that mopidy is detecting connections all over the 48XXX port range? After launching mopidy. it prints information about new mpd connections every second:

[..]
INFO     New MPD connection from [::ffff:127.0.0.1]:48838
INFO     New MPD connection from [::ffff:127.0.0.1]:48840
INFO     New MPD connection from [::ffff:127.0.0.1]:48842
INFO     New MPD connection from [::ffff:127.0.0.1]:48844
INFO     New MPD connection from [::ffff:127.0.0.1]:48846
INFO     New MPD connection from [::ffff:127.0.0.1]:48848
INFO     New MPD connection from [::ffff:127.0.0.1]:48850
INFO     New MPD connection from [::ffff:127.0.0.1]:48852
INFO     New MPD connection from [::ffff:127.0.0.1]:48854
[..]
adamcik commented 9 years ago

Those port numbers are the outgoing ports that ncmcpp is using, which is picked at random within a given range by the kernel as ncmcpp doesn't specify a source port.

laur89 commented 9 years ago

Atm it appears to be related to two different aspects: a) the request limit needs to be brought from 1000 down to ~50; b) soundcloud.py.get_user_liked() should look something like this:

def get_user_liked(self):
    likes = []
    liked = self._get('e1/me/likes.json?limit=50')

    for data in liked:
        track = data['track']
        if track:
            parsed_track = self.parse_track(track)
            pl = data['playlist']

            if parsed_track:
                likes.append(parsed_track)
            if pl:
                likes.append((pl['title'], str(pl['id'])))
    return likes

Otherwise there's good chance that parse_track() returns empty array, thus creating problems, since empty element is pushed to likes. There's also some uri parsing issue for some tracks:

File "/usr/lib/python2.7/dist-packages/mopidy/backend/__init__.py", line 164, in play
    self.change_track(track)
  File "/usr/lib/python2.7/dist-packages/mopidy/backend/__init__.py", line 177, in change_track
    self.audio.set_uri(track.uri).get()
AttributeError: 'list' object has no attribute 'uri'
jodal commented 8 years ago

Parts of this is fixed by #69. If the other parts are still an issue, please open a new issue.