Mopidy Discourse

MPC doesn't find file

Running Mopidy 3.0.2 as system and have installed Mopidy-Local and Mopidy-MPD. running a mopidyctl local scan shows up the files in the directory however MPC can’t find or add them.
I’ve installed (then removed) MPD and with that installed MPC finds and adds the file.
It’s something obvious I’ve missed, but I’ve been through the docs and tried many variations but can’t seem to resolve this.

Below is the result of the scan and mpc

pi@Lounge:~ $ sudo mopidyctl local scan
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf local scan" as user mopidy
INFO     [MainThread] mopidy.__main__ Starting Mopidy 3.0.2
INFO     [MainThread] mopidy.config Loading config from builtin defaults
INFO     [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf
INFO     [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf
INFO     [MainThread] mopidy.config Loading config from command line options
INFO     [MainThread] mopidy.__main__ Enabled extensions: softwaremixer, m3u, local, musicbox_webclient, stream, iris, file, mpd, ht                                                   tp, spotify
INFO     [MainThread] mopidy.__main__ Disabled extensions: none
INFO     [MainThread] mopidy_local.commands Finding files in file:///home/pi/Music ...
INFO     [MainThread] mopidy_local.commands Found 19 files in file:///home/pi/Music
INFO     [MainThread] mopidy_local.commands Checking 17 tracks from library
INFO     [MainThread] mopidy_local.commands Removing 0 missing tracks
INFO     [MainThread] mopidy_local.commands Found 0 tracks which need to be updated
INFO     [MainThread] mopidy_local.commands Scanning...
INFO     [MainThread] mopidy_local.commands Scanned 0 of 0 files in 0.000s.
INFO     [MainThread] mopidy_local.commands Done scanning
INFO     [MainThread] mopidy_local.storage Cleaning up image directory
pi@Lounge:~ $ mpc add "/home/pi/Music/Graceland 25th Anniversary Edition/05 - Diamonds on the Soles of Her Shoes [Clean].mp3"
error adding /home/pi/Music/Graceland 25th Anniversary Edition/05 - Diamonds on the Soles of Her Shoes [Clean].mp3: directory or file not found

The path
“/home/pi/Music/Graceland 25th Anniversary Edition/05 - Diamonds on the Soles of Her Shoes [Clean].mp3” doesn’t mean anything to Mopidy. You need to give it a path (URI) it can understand, which may or may not have any relation to the path on your filesystem (for Mopidy-Local it currently does but that could change). Use mpc ls to browse the virtual filesystem exposed by Mopidy and find the URI for the track you want, for example:

nick@xps:~$ mpc ls 
Files
Local media
SoundCloud
TuneIn

nick@xps:~$ mpc ls "Local media"
Local media/Albums
Local media/Artists
Local media/Composers
Local media/Genres
Local media/Performers
Local media/Release Years
Local media/Tracks
Local media/Last Week's Updates
Local media/Last Month's Updates

nick@xps:~$ mpc ls "Local media/Tracks"
local:track:Music/song.mp3

mpc add "local:track:Music/song.mp3"

mpd and Mopidy have different URI schemes and expose different virtual filesystems for the same media collection. The path for a given track may therefore also be different and should not be considered interchangeable between these two different programs.

Mopidy-File (bundled with Mopidy) has a different approach and the URIs exposed will always be related to the path on your filesystem, but you still need to specify the file:// prefix so Mopidy can understand e.g.

nick@xps:~$ mpc ls "Files"
Files/Music
Files/Home

nick@xps:~$ mpc ls "Files/Music"
file:///home/nick/Music/song.mp3

So simple when you know - thanks so much for that, I spent ages trying to puzzle it out.

No worries. It’s kind of a general MPD thing rather than a Mopidy thing, you just never notice it when dealing with a mpd’s “simple” database plugin (unless you are also using it’s mount functionality). But I guess you would run into something similar when using mpd’s “proxy” or “upnp” database plugins; or one of it’s more exotic storage plugins.