Web clients cannot find any local media

I’m running mopidy as a service. Web clients see no local media. Here’s my info. When I run the “scan for media” command, I get some permission error. I tried changing the json library ownernship to mopidy, but no luck.

pi@pynet ~/mopidy/local $ sudo mopidyctl config
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf config" as user mopidy
[logging]
color = true
console_format = %(levelname)-8s %(message)s
debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n  %(message)s
debug_file = mopidy.log
config_file =

[audio]
mixer = software
mixer_volume =
output = alsasink

[proxy]
scheme =
hostname =
port =
username =
password =

[spotify]
enabled = true
username = jason701802
password = ********
bitrate = 160
timeout = 10
cache_dir = /var/cache/mopidy/spotify
settings_dir = /var/lib/mopidy/spotify
toplist_countries =


[soundcloud]
enabled = true
explore_songs = 25
auth_token = ********

[musicbox_webclient]
enabled = true
musicbox = false

[material-webclient]
enabled = true
config_file = /etc/mopidy/mopidy.conf

[mobile]
enabled = true
title = Mopidy Mobile on $hostname
ws_url =

[gmusic]
enabled = false  ; Extension disabled due to config errors.
username =   ; Must be set.
password =   ; Must be set.
deviceid =

[mopify]
enabled = true
debug = false

[youtube]
enabled = true

[alsamixer]
enabled = true
card = 0
control = Master

[moped]
enabled = true

[mpd]
enabled = false  ; Extension disabled by user config.

[http]
enabled = true
hostname = 0.0.0.0
port = 6680
static_dir =
zeroconf =

[stream]
enabled = true
protocols =
  file
  http
  https
  mms
  rtmp
  rtmps
  rtsp
metadata_blacklist =
timeout = 5000

[m3u]
enabled = true
playlists_dir = $XDG_DATA_DIR/mopidy/m3u

[softwaremixer]
enabled = true

[local]
enabled = true
library = json
media_dir = /home/pi/musak/
data_dir = /home/pi/mopidy/local
scan_timeout = 1000
scan_flush_threshold = 1000
scan_follow_symlinks = false
excluded_file_extensions =
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .png
  .txt
  .pkb
  .py
  .configFileFromETC

  
  
  
pi@pynet ~/mopidy/local $ sudo mopidyctl local scan
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf local scan" as user mopidy
INFO     Starting Mopidy 1.0.5
INFO     Loading config from builtin defaults
INFO     Loading config from /usr/share/mopidy/conf.d/spotify.conf
INFO     Loading config from /etc/mopidy/mopidy.conf
INFO     Loading config from command line options
INFO     Enabled extensions: mopify, spotify, alsamixer, http, stream, mobile, m3u, youtube, material-webclient, softwaremixer, moped, musicbox_webclient, local, soundcloud
INFO     Disabled extensions: mpd, gmusic
WARNING  Found gmusic configuration errors, the extension has been automatically disabled:
WARNING    gmusic/username must be set.
WARNING    gmusic/password must be set.
WARNING  Please fix the extension configuration errors or disable the extensions to silence these messages.
INFO     Found 168 files in media_dir.
INFO     Checking 18 tracks from library.
INFO     Removing 0 missing tracks.
INFO     Found 12 tracks which need to be updated.
INFO     Scanning...
WARNING  Failed local:track:example.mp3: Could not determine type of stream.
WARNING  Failed local:track:Google-Translate-TTS/README.md: The stream is of a different type than handled by this element.
WARNING  Failed local:track:mopidy-pandora/LICENSE: The stream is of a different type than handled by this element.
WARNING  Failed local:track:mopidy-pandora/MANIFEST.in: The stream is of a different type than handled by this element.
WARNING  Failed local:track:mopidy-pandora/mopidy_pandora/ext.conf: The stream is of a different type than handled by this element.
WARNING  Failed local:track:mopidy-pandora/README.rst: The stream is of a different type than handled by this element.
WARNING  Failed local:track:mopidy-pandora/setup.cfg: The stream is of a different type than handled by this element.
WARNING  Failed local:track:mopidy-pandora/tox.ini: The stream is of a different type than handled by this element.
WARNING  Failed local:track:sine.wav: Could not determine type of stream.
WARNING  Failed local:track:speech.sh: text/x-matlab decoder (Your GStreamer installation is missing a plug-in.)
WARNING  Failed local:track:youtube-dl.sig: Could not determine type of stream.
WARNING  Failed local:track:youtube2mp3.sh: application/x-shellscript decoder (Your GStreamer installation is missing a plug-in.)
INFO     Scanned 12 of 12 files in 0s.
ERROR    [Errno 13] Permission denied: '/home/pi/mopidy/local/library.json.gz.zrd0rI'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mopidy/__main__.py", line 127, in main
    return args.command.run(args, proxied_config)
  File "/usr/lib/python2.7/dist-packages/mopidy/local/commands.py", line 161, in run
    library.close()
  File "/usr/lib/python2.7/dist-packages/mopidy/local/json.py", line 195, in close
    write_library(self._json_file, {'tracks': self._tracks.values()})
  File "/usr/lib/python2.7/dist-packages/mopidy/local/json.py", line 46, in write_library
    prefix=basename + '.', dir=directory, delete=False)
  File "/usr/lib/python2.7/tempfile.py", line 454, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python2.7/tempfile.py", line 235, in _mkstemp_inner
    fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: '/home/pi/mopidy/local/library.json.gz.zrd0rI'
Traceback (most recent call last):
  File "/usr/bin/mopidy", line 9, in <module>
    load_entry_point('Mopidy==1.0.5', 'console_scripts', 'mopidy')()
  File "/usr/lib/python2.7/dist-packages/mopidy/__main__.py", line 127, in main
    return args.command.run(args, proxied_config)
  File "/usr/lib/python2.7/dist-packages/mopidy/local/commands.py", line 161, in run
    library.close()
  File "/usr/lib/python2.7/dist-packages/mopidy/local/json.py", line 195, in close
    write_library(self._json_file, {'tracks': self._tracks.values()})
  File "/usr/lib/python2.7/dist-packages/mopidy/local/json.py", line 46, in write_library
    prefix=basename + '.', dir=directory, delete=False)
  File "/usr/lib/python2.7/tempfile.py", line 454, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python2.7/tempfile.py", line 235, in _mkstemp_inner
    fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: '/home/pi/mopidy/local/library.json.gz.zrd0rI'





pi@pynet ~/mopidy/local $ ls -la
total 204
drwxr-xr-x 3 pi     pi  4096 Oct 30 00:23 .
drwxr-xr-x 3 pi     pi  4096 Jun 30 00:57 ..
-rw-r--r-- 1 pi     pi 62032 Oct 29 20:47 b2.mp3
-rw-r--r-- 1 pi     pi 54926 Oct 29 20:47 b3.mp3
-rw-r--r-- 1 pi     pi 69555 Oct 29 20:47 b4.mp3
drwxr-xr-x 2 pi     pi  4096 Oct 29 22:32 build
-rw------- 1 mopidy pi   745 Oct 30 00:23 library.json.gz

Revert your change of the local/data_dir config. You shouldn’t need to change it, at least not when running as a service as the defaults from the Debian package should be good enough and point to a directory where the mopidy user has write access, as opposed to /home/pi/mopidy/local.