Skip to content
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

Sometimes unable to get track uri #90

Closed
Lahorde opened this issue Jan 24, 2017 · 7 comments
Closed

Sometimes unable to get track uri #90

Lahorde opened this issue Jan 24, 2017 · 7 comments

Comments

@Lahorde
Copy link

Lahorde commented Jan 24, 2017

In some cases I have no issue with mopidy soundcloud. But sometimes, when i'm trying to play a soundlcloud track I have this exception :

janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]: AttributeError: 'list' object has no attribute 'uri'
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]: WARNING  Track is not playable: soundcloud:song/Ghetto Paradise.30238568
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]: ERROR    SoundCloudBackend backend caused an exception.
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]: Traceback (most recent call last):
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:   File "/usr/lib/python2.7/site-packages/mopidy/core/playback.py", line 423, in _change
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:     if not backend.playback.change_track(pending_tl_track.track).get():
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:   File "/usr/lib/python2.7/site-packages/pykka/future.py", line 299, in get
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:     exec('raise exc_info[0], exc_info[1], exc_info[2]')
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:   File "/usr/lib/python2.7/site-packages/pykka/actor.py", line 200, in _actor_loop
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:     response = self._handle_receive(message)
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:   File "/usr/lib/python2.7/site-packages/pykka/actor.py", line 294, in _handle_receive
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:     return callee(*message['args'], **message['kwargs'])
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:   File "/usr/lib/python2.7/site-packages/mopidy/backend.py", line 245, in change_track
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:     uri = self.translate_uri(track.uri)
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:   File "/usr/lib/python2.7/site-packages/mopidy_soundcloud/actor.py", line 35, in translate_uri
janv. 24 09:40:45 a4h-rpi-rel mopidy[15291]:     return track.uri
@caspargross
Copy link

caspargross commented Feb 4, 2017

Same problem here.

2017-02-04 16:46:56,842 ERROR [2432:Core-12] mopidy.core.playback: SoundCloudBackend backend caused an exception.
Traceback (most recent call last):
    exec('raisocal/lib/python2.7/dist-packages/mopidy/core/playback.py", line 423, in _change
  Fiif not backend.playback.change_track(pending_tl_track.track).get():_actor_loopange_track
    response = self._handle_receive(message)   threading.py", line 52, in get
  Ficompat.reraise(*self._data['exc_info'])
    return callee(*message['args'], **messakka/compat.py", line 12, in reraise
  Fiexec('raise tp, value, tb')
    uri = selfib/python2.7/dist-packages/pykka/actor.py", line 201, in _actor_loop
  Firesponse = self._handle_receive(message)idy_soundcloud/actor.py", line 35, in translate_uri
    return track.uri                     pykka/actor.py", line 295, in _handle_receive
AttributeErcallee(*message['args'], **message['kwargs']).playback: SoundCloudBackend backend caused an exception.
  File "/usr/local/lib/python2.7/dist-packages/mopidy/backend.py", line 245, in change_track soundcloud:song/Januarys New Moon Wartemal -Whats the Meaning of Life-.305075526
    uri = self.translate_uri(track.uri)
  File "/usr/lib/python2.7/dist-packages/mopidy_soundcloud/actor.py", line 35, in translate_uri
    return track.uri
AttributeError: 'list' object has no attribute 'uri'
2017-02-04 16:46:56,850 WARNING [2432:Core-12] mopidy.core.tracklist: Track is not playable: soundcloud:song/Januarys New Moon Wartemal -Whats the Meaning of Life-.305075526

Just saw in Changelog:
v2.0.3 (UNRELEASED)

Fix AttributeError: : 'list' object has no attribute 'name' when browsing tracks. (Fixes #43, #45, #59, PR #69)

This might also be the problem here?

@Pixdigit
Copy link

Pixdigit commented Jun 9, 2017

This is because self.backend.remote.get_track returns an empty list instead of None. I will look further into this but I give no guarantee that I will find the error.

@Pixdigit
Copy link

Pixdigit commented Jun 9, 2017

Even though this repo is so easily maintainable I could not figure out what exactly happens. What I can say is that the error is caused by soundcloud.SoundCloudClient.parse_track returning an empty list when the returned json data by the soundcloud API does not include the keyword "streamable". However in actor.py it expects to either receive valid data or None. And since an empty list does not have a uri attribute it leads to the traceback above. However I could not figure out why any songs on soundcloud are returned without streamable set to true. Even worse I somehow got a 401 response suddenly during testing. Maybe some DDoS protection by soundcloud? You can at least prevent it from crashing by changing
if track is None:
to
if track == [].

This is quick and dirty but it stops error messages appearing.

@kingosticks
Copy link
Member

The error handling is improved in #100, I believe this is now fixed.

@stekern
Copy link

stekern commented Feb 18, 2019

EDIT 2: Alright, I assume this is related to #99. Every instance of mopidy-soundcloud uses the same client id. I guess there's not much to do about that seeing as SoundCloud does not allow registration of new apps.

EDIT: I initially installed the extension through apt-get, and the latest version there is v2.0.2-3. I saw from #101 that a newer version exists, so I installed v2.1.0 using pip. I am still having the same issue, but now I am getting an additional warning SoundCloud daily rate limit exceeded. I have, however, not streamed 15 000 SoundCloud tracks during the last 24 hours.

@kingosticks I started receiving the same error today. I've been using mopidy-soundcloud for months, and this is the first time I've encountered this issue. Searching on SoundCloud works fine, and I can add SoundCloud tracks to the tracklist. Playback, however, does not work.

Here is the track object I receive on my frontend:

{
  "track": {
    "album": {
      "images": [
        "https://i1.sndcdn.com/avatars-000312398765-riregv-large.jpg"
      ],
      "__model__": "Album",
      "name": "SoundCloud"
    },
    "comment": "https://soundcloud.com/earmilk/mac-miller-frick-park-market",
    "__model__": "Track",
    "name": "Mac Miller - Frick Park Market",
    "uri": "soundcloud:song/Mac Miller - Frick Park Market.21416472",
    "length": 196149,
    "artists": [
      {
        "__model__": "Artist",
        "name": "EARMILK"
      }
    ]
  },
  "__model__": "TlTrack",
  "tlid": 8
}

And here is the error on the backend:

mopidy_1    | INFO     'Mac Miller - Frick Park Market' can't be streamed from SoundCloud
mopidy_1    | ERROR    SoundCloudBackend backend caused an exception.
mopidy_1    | Traceback (most recent call last):
mopidy_1    |   File "/usr/local/lib/python2.7/dist-packages/mopidy/core/playback.py", line 423, in _change
mopidy_1    |     if not backend.playback.change_track(pending_tl_track.track).get():
mopidy_1    |   File "/usr/lib/python2.7/dist-packages/pykka/threading.py", line 52, in get
mopidy_1    |     compat.reraise(*self._data['exc_info'])
mopidy_1    |   File "/usr/lib/python2.7/dist-packages/pykka/compat.py", line 12, in reraise
mopidy_1    |     exec('raise tp, value, tb')
mopidy_1    |   File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 201, in _actor_loop
mopidy_1    |     response = self._handle_receive(message)
mopidy_1    |   File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 295, in _handle_receive
mopidy_1    |     return callee(*message['args'], **message['kwargs'])
mopidy_1    |   File "/usr/local/lib/python2.7/dist-packages/mopidy/backend.py", line 245, in change_track
mopidy_1    |     uri = self.translate_uri(track.uri)
mopidy_1    |   File "/usr/lib/python2.7/dist-packages/mopidy_soundcloud/actor.py", line 35, in translate_uri
mopidy_1    |     return track.uri
mopidy_1    | AttributeError: 'list' object has no attribute 'uri'
mopidy_1    | WARNING  Track is not playable: soundcloud:song/Mac Miller - Frick Park Market.21416472

@kingosticks
Copy link
Member

Yeh, so it does seem the version from apt.mopidy.com is outdated, thanks for pointing that out. And you are right, we can't do anything about sharing the client_id. But the more people using v2.1.0 the better since that code is better optimised to use fewer credits. So let's see if we can get that sorted out.

@kingosticks
Copy link
Member

v2.1.0 is now available at apt.mopidy.com (thanks @jodal).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants