Newbee question: uri 'None' - usage in browse() function


#1

Hi there,

I am a total newbee in both, Mopidy.js and javascript development.
Currently, I am simply trying to browse my library through the Chrome console and cannot get any results from mopidy.library.browse(uri).

The docs (https://docs.mopidy.com/en/latest/api/core/#mopidy.core.LibraryController.browse) say

To get the intial root directories for backends pass None as the URI.

Could anyone please give me a working example? I only have the file and local extension installed, and my library contains few albums (I verified with the Iris frontend, that these albums are successfully loaded into the library. I am also seeing results, when I call ’mopidy.library.search({'any': ['a']}, ['local:'])'; ).
I am using the default value callingConvention: “by-position-only”.

I tried…
mopidy.library.browse('None'); // error "Expected a valid URI, not u'None'"
mopidy.library.browse('dummy:None'); // empty result
mopidy.library.browse('local:None'); // empty result
mopidy.library.browse('local:/None'); // empty result
mopidy.library.browse('local://None'); // empty result
mopidy.library.browse('local:'); // empty result
mopidy.library.browse('local:/'); // empty result
mopidy.library.browse('local://'); // empty result

What am I doing wrong?

Thanks and best regards
Stefan


#2

The docs are written for Python. The equivalent of Python’s None in Javascript is null.

There are numerous working examples of other webclients on github, one example is https://github.com/pimusicbox/mopidy-musicbox-webclient/blob/develop/mopidy_musicbox_webclient/static/js/library.js

You should install the API explorer frontend extension for some more examples.

Our documentation warns you don’t use that calling convention.


#3

Hi @kingosticks,

thanks for your reply and the good hints! That helped.

Best regards
Stefan