# Create tracklist after local browse

**URL:** <https://discourse.mopidy.com/t/create-tracklist-after-local-browse/1635>\
**Category:** Pi MusicBox (archive)\
**Created:** [May 23, 2017, 9:13am UTC](https://discourse.mopidy.com/t/create-tracklist-after-local-browse/1635 "2017-05-23T09:13:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucio\_Santinelli](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/lucio_santinelli/32/586_2.png) [@Lucio\_Santinelli](https://discourse.mopidy.com/u/Lucio_Santinelli)\
**Post date:** [May 23, 2017, 9:13am UTC](https://discourse.mopidy.com/t/create-tracklist-after-local-browse/1635/1 "2017-05-23T09:13:29Z")

</div>

Hi,  
i’m doing a python script to browse my local media.  
After i do Mopidy.library.browse() i get a list of Ref objects.  
Then i ask for the URL of the Ref i need, but if i do Mopidy.tracklist.add(url) i always get an empty list.  
How can i get the list of tracks after i browse?  
Thanks

---

<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:** [May 23, 2017, 11:32am UTC](https://discourse.mopidy.com/t/create-tracklist-after-local-browse/1635/2 "2017-05-23T11:32:57Z")

</div>

Since the arguments to `TracklistController.add` are all optional, if you don’t specify which one you want then python uses the definition order to decide, in this case that’s the `tracks` argument, which isn’t what you want. You probably meant `Mopidy.tracklist.add(uri=your_track_ref.uri)`.

> [@Lucio\_Santinelli](#):
>
> How can i get the list of tracks after i browse?

By using [LibraryController.lookup(uris=your\_list\_of\_uris)](https://docs.mopidy.com/en/release-1.1/api/core/#mopidy.core.LibraryController.lookup). [TracklistController.add](https://docs.mopidy.com/en/release-1.1/api/core/#mopidy.core.TracklistController.add) does a lookup as part of adding uris to the tracklist (as per the documentation) but that’s more of a by-product. If you just want to get `Track`s from `Ref`s, rather than add stuff to the tracklist, then use `LibraryController.lookup`.

---

<div class="post-metadata">

**Author:** ![Lucio\_Santinelli](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/lucio_santinelli/32/586_2.png) [@Lucio\_Santinelli](https://discourse.mopidy.com/u/Lucio_Santinelli)\
**Post date:** [May 23, 2017, 12:37pm UTC](https://discourse.mopidy.com/t/create-tracklist-after-local-browse/1635/3 "2017-05-23T12:37:39Z")

</div>

I wanted to add tracks in tracklist to playing them. Isn’t this mandatory?

---

<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:** [May 23, 2017, 1:00pm UTC](https://discourse.mopidy.com/t/create-tracklist-after-local-browse/1635/4 "2017-05-23T13:00:30Z")

</div>

Yes it is, but that’s not what you asked. Just ignore the 2nd half of my answer and you should be good.

---

<div class="post-metadata">

**Author:** ![Lucio\_Santinelli](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/lucio_santinelli/32/586_2.png) [@Lucio\_Santinelli](https://discourse.mopidy.com/u/Lucio_Santinelli)\
**Post date:** [May 23, 2017, 1:19pm UTC](https://discourse.mopidy.com/t/create-tracklist-after-local-browse/1635/5 "2017-05-23T13:19:49Z")

</div>

The uri field of Refs i get is “local:directory?type=album” wich don’t seems to be a correct format.  
If i pass this uri to Mopidy.Tracklist.add(uri=uri)  
and then i ask Mopidy.Tracklist.get\_tracks() i get a None list.  
Why? Thanks

---

<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:** [May 23, 2017, 2:42pm UTC](https://discourse.mopidy.com/t/create-tracklist-after-local-browse/1635/6 "2017-05-23T14:42:38Z")

</div>

You should have seen an error in your logs along the lines of “Invalid lookup URI”.

From [mopidy.core — Core API — Mopidy 1.1.2-2-g1c19dd5d documentation](https://docs.mopidy.com/en/release-1.1/api/core/#mopidy.core.LibraryController.browse)

> The Ref objects representing directories have backend specific URIs. These are opaque values, so no one but the backend that created them should try and derive any meaning from them. The only valid exception to this is checking the scheme, as it is used to route browse requests to the correct backend.

Basically you cannot do a `lookup` on a directory ref. You need to `browse` the directory ref(s) until you get down to some track refs. Those can then be added to the tracklist.

---

<div class="post-metadata">

**Author:** ![jodal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/jodal/32/2564_2.png) [@jodal](https://discourse.mopidy.com/u/jodal)\
**Post date:** [February 19, 2026, 11:47am UTC](https://discourse.mopidy.com/t/create-tracklist-after-local-browse/1635/7 "2026-02-19T11:47:20Z")

</div>


