# for mpc compatibility
uri = uri.replace('Files/', 'file:/home/pi/music/')
To be clear, ‘Files’ and ‘Files/foo’ are names and not URIs. A Mopidy URI and it’s form is explained here. It’s a bit confusing if you are coming from using MPD where the difference is hidden from you; where MPD uses names there is usually a mapping to the URI occurring at some point. I wouldn’t try to implement the mapping with string replacements:
And what about nested folders? Looks like they are skipped (after failing).
There’s an argument for handling directory lookups in Mopidy-File backend but I think it’d be quite slow, maybe try implementing the improvement and see what it’s like to use? You’d want to call
browse internally anyway, to filter out all the non-track stuff and make it less slow. And would you always want to be recursive? Requiring the usage of
browse instead, to explicitly first gather the tracks to add, is more work but maybe that simpler interface is better.
I’d rather see
LibraryController.browse handle track URIs better, it currently causes an exception (a bug).