# Backend Playlist handeling

**URL:** <https://discourse.mopidy.com/t/backend-playlist-handeling/1448>\
**Category:** Misc\
**Created:** [January 1, 2017, 10:26am UTC](https://discourse.mopidy.com/t/backend-playlist-handeling/1448 "2017-01-01T10:26:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chises](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@chises](https://discourse.mopidy.com/u/chises)\
**Post date:** [January 1, 2017, 10:26am UTC](https://discourse.mopidy.com/t/backend-playlist-handeling/1448/1 "2017-01-01T10:26:08Z")

</div>

Hi all,  
after [this](https://discourse.mopidy.com/t/soundcloud-backend-playlists/1435/3) thread i started to expand the existing soundcloud backend to Support Playlists. I added a Playlist Provider with the as\_list Definition.

This is working quiet well. At the Moment my Playlists from soundcloud backend showing up at mopidy

```
/home/mopidy/mopidy-soundcloud# mpc lsplaylists
MyTest123
test_soundcloud
soundcloud

LOG mopidy:
INFO Get playlists from soundcloud

```

But i am not able to load the Playlist in mopidy.

```
# mpc add test_soundcloud
error adding test_soundcloud: directory or file not found
LOG mopidy:
DEBUG 2017-01-01 11:14:54,927 [26109:MpdSession-11] mopidy.mpd.session
  Response to [::ffff:127.0.0.1]:37644: ACK [50@0] {add} directory or file not found

```

the playlistprovider function “lookup” is not called if the Playlist is loaded.  
can someone tell me what function is required to handle that request?  
What functions Needs to be modified/added.

i were not able to find the informations in [backend api](https://docs.mopidy.com/en/latest/api/backend/)

please assist here with a hint. i am helpless ☹

---

<div class="post-metadata">

**Author:** ![tkem](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/tkem/32/22_2.png) [@tkem](https://discourse.mopidy.com/u/tkem)\
**Post date:** [January 1, 2017, 1:34pm UTC](https://discourse.mopidy.com/t/backend-playlist-handeling/1448/2 "2017-01-01T13:34:27Z")

</div>

Have you tried `mpc load test_soundcloud`?

---

<div class="post-metadata">

**Author:** ![chises](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@chises](https://discourse.mopidy.com/u/chises)\
**Post date:** [January 1, 2017, 2:07pm UTC](https://discourse.mopidy.com/t/backend-playlist-handeling/1448/3 "2017-01-01T14:07:54Z")

</div>

thanks for your Support!  
.  
but the same result

> INFO 2017-01-01 15:01:23,396 [7385:MpdSession-44] mopidy.mpd.session  
> New MPD connection from [::ffff:127.0.0.1]:43150  
> DEBUG 2017-01-01 15:01:23,398 [7385:MpdSession-44] mopidy.mpd.session  
> Request from [::ffff:127.0.0.1]:43150: command\_list\_begin  
> DEBUG 2017-01-01 15:01:23,399 [7385:MpdSession-44] mopidy.mpd.session  
> Request from [::ffff:127.0.0.1]:43150: load “test\_soundcloud”  
> DEBUG 2017-01-01 15:01:23,400 [7385:MpdSession-44] mopidy.mpd.session  
> Request from [::ffff:127.0.0.1]:43150: command\_list\_end  
> DEBUG 2017-01-01 15:01:23,402 [7385:MpdSession-44] mopidy.mpd.session  
> Response to [::ffff:127.0.0.1]:43150: ACK [50@0] {load} No such playlist  
> DEBUG 2017-01-01 15:01:23,405 [7385:MpdSession-44] mopidy.internal.network  
> Client most likely disconnected.

where the mopidy core is checking for Playlists/ what backend functions are executed?

in the soundcloud playlistprovider i added debug Output for the “lookup” and “get\_items” but they are not called/executed in any way ☹

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [January 1, 2017, 7:24pm UTC](https://discourse.mopidy.com/t/backend-playlist-handeling/1448/4 "2017-01-01T19:24:07Z")

</div>

It is `mpc load test_soundcloud` as @tkem says. You need to pass a URI if using `add`, for example, `mpc add soundcloud:some_user:playlists:test_soundcloud` (or however the Soundcloud URIs work). The mpc manual could definitely be clearer.

If your lookup function isn’t being executed then perhaps Mopidy doesn’t know how to route the playlist’s URI to the Soundcloud backend? I suggest you read Mopidy’s source if you have specific questions, just trace what the MPD frontend’s `load` command does. Or look at what other backends do.

---

<div class="post-metadata">

**Author:** ![chises](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@chises](https://discourse.mopidy.com/u/chises)\
**Post date:** [January 2, 2017, 2:13pm UTC](https://discourse.mopidy.com/t/backend-playlist-handeling/1448/5 "2017-01-02T14:13:32Z")

</div>

it took some time, but i found it 🙂

It is not working if the uri for a Playlist is "soundcloud:ID"  
i have to use something like “soundcloud:folder:ID”. in this way my backend lookup function in the Playlist Provider is used to get the Playlist 😌

ty for you Support!

note: why should i use the “Folder” structure? is it “important” or is it possible to use somehting generic like: soundcloud:playlist:ID  
the soundcloud api Returns a unique id for each playlist

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [January 2, 2017, 3:26pm UTC](https://discourse.mopidy.com/t/backend-playlist-handeling/1448/6 "2017-01-02T15:26:17Z")

</div>

There is noting special about using “Folder”, you should be able to do use “playlist” or whatever you want, just as the other backends do. It just needs to be a _Unique_ Resource Identifier that your particular backend can understand.
