Mopidy does not update the database

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Mopidy does not update the database

Post by Sciamano »

Hello, I have a problem with mopidy running on an OrangePi PC.
I've added a few files to my music folder, so I gave the command to update the database:

Code: Select all

mopidyctl local scan
It found the files to be updated but then, after scanning, this is the output:

Code: Select all

INFO     Scanned 327 of 327 files in 33s.
ERROR    [Errno 13] Permission denied: '/mnt/dietpi_userdata/mopidy/dat
/local/library.json.gz.I2W9JU'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mopidy/__main__.py", line 134,
in main
    return args.command.run(args, proxied_config)
  File "/usr/lib/python2.7/dist-packages/mopidy/local/commands.py", lin
 167, in run
    library.close()
  File "/usr/lib/python2.7/dist-packages/mopidy/local/json.py", line 17
, in close
    'tracks': self._tracks.values()
  File "/usr/lib/python2.7/dist-packages/mopidy/internal/storage.py", l
ne 51, in dump
    prefix=basename + '.', dir=directory, delete=False)
  File "/usr/lib/python2.7/tempfile.py", line 462, in NamedTemporaryFil
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python2.7/tempfile.py", line 239, in _mkstemp_inner
    fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: '/mnt/dietpi_userdata/mopidy/dat
/local/library.json.gz.I2W9JU'
Traceback (most recent call last):
  File "/usr/bin/mopidy", line 9, in <module>
    load_entry_point('Mopidy==2.1.0', 'console_scripts', 'mopidy')()
  File "/usr/lib/python2.7/dist-packages/mopidy/__main__.py", line 134,
in main
    return args.command.run(args, proxied_config)
  File "/usr/lib/python2.7/dist-packages/mopidy/local/commands.py", lin
 167, in run
    library.close()
  File "/usr/lib/python2.7/dist-packages/mopidy/local/json.py", line 17
, in close
    'tracks': self._tracks.values()
  File "/usr/lib/python2.7/dist-packages/mopidy/internal/storage.py", l
ne 51, in dump
    prefix=basename + '.', dir=directory, delete=False)
  File "/usr/lib/python2.7/tempfile.py", line 462, in NamedTemporaryFil
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python2.7/tempfile.py", line 239, in _mkstemp_inner
    fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: '/mnt/dietpi_userdata/mopidy/dat
/local/library.json.gz.I2W9JU'
root@OPiHome: #

I then tried with

Code: Select all

mopidyctl local scan --force
but after scanning the files it gave this error:

Code: Select all

INFO     Scanned 9295 of 9295 files in 1152s.
ERROR    [Errno 13] Permission denied: '/mnt/dietpi_userdata/mopidy/dat
/local/library.json.gz.OH0ri5'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mopidy/__main__.py", line 134,
in main
    return args.command.run(args, proxied_config)
  File "/usr/lib/python2.7/dist-packages/mopidy/local/commands.py", lin
 167, in run
    library.close()
  File "/usr/lib/python2.7/dist-packages/mopidy/local/json.py", line 17
, in close
    'tracks': self._tracks.values()
  File "/usr/lib/python2.7/dist-packages/mopidy/internal/storage.py", l
ne 51, in dump
    prefix=basename + '.', dir=directory, delete=False)
  File "/usr/lib/python2.7/tempfile.py", line 462, in NamedTemporaryFil
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python2.7/tempfile.py", line 239, in _mkstemp_inner
    fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: '/mnt/dietpi_userdata/mopidy/dat
/local/library.json.gz.OH0ri5'
Traceback (most recent call last):
  File "/usr/bin/mopidy", line 9, in <module>
    load_entry_point('Mopidy==2.1.0', 'console_scripts', 'mopidy')()
  File "/usr/lib/python2.7/dist-packages/mopidy/__main__.py", line 134,
in main
    return args.command.run(args, proxied_config)
  File "/usr/lib/python2.7/dist-packages/mopidy/local/commands.py", lin
 167, in run
    library.close()
  File "/usr/lib/python2.7/dist-packages/mopidy/local/json.py", line 17
, in close
    'tracks': self._tracks.values()
  File "/usr/lib/python2.7/dist-packages/mopidy/internal/storage.py", l
ne 51, in dump
    prefix=basename + '.', dir=directory, delete=False)
  File "/usr/lib/python2.7/tempfile.py", line 462, in NamedTemporaryFil
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python2.7/tempfile.py", line 239, in _mkstemp_inner
    fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: '/mnt/dietpi_userdata/mopidy/dat
/local/library.json.gz.OH0ri5'
No need to say that the database has not been updated.
Any suggestions? Thanks!
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Mopidy does not update the database

Post by Sciamano »

Ok, it looks like the problem is the file /usr/sbin/mopidyctl and specifically this line:

Code: Select all

DAEMON_USER=“mopidy”
It looks like user mopidy does not have the permissions to write in the /mnt/dietpi_userdata/mopidy/dat
/local directory.

Editing the file into:

Code: Select all

DAEMON_USER=“root”
solved the problem, although I'm not sure this is the correct solution to be implemented.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Mopidy does not update the database

Post by Sciamano »

The programmer of mopidy (who helped me with this issue) asked me to pass the following information:

"ask the people at DietPi what they are trying to do with this config:
github.com
Fourdee/DietPi/blob/master/dietpi/dietpi-software#L8480-L8483*

Code: Select all

library = images
media_dir = $FP_DIETPI_USERDATA_DIRECTORY/Music
enabled = true
library = json
if they want to use local-images then they don’t want line 8483 (library = json) .
And they arguably want to be installing and using local-sqlite since it’s far superior to the json library"

Please, don't shoot the messenger. :D
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: Mopidy does not update the database

Post by Fourdee »

Apologies for the delay and many thanks investigating this.
Sciamano wrote: "ask the people at DietPi what they are trying to do with this config:
Following their install guide on their github page ;) I either missed it, or their documentation lacked to mention this.
if they want to use local-images then they don’t want line 8483 (library = json) .
I've removed this entry for DietPi v155.

Tested fine:

Code: Select all

root@DietPi:~# mopidy local scan
INFO     Starting Mopidy 2.1.0
INFO     Loading config from builtin defaults
INFO     Loading config from /root/.config/mopidy/mopidy.conf
INFO     Loading config from command line options
INFO     Enabled extensions: mpd, http, stream, m3u, local-images, softwaremixer, file, musicbox_webclient, local
INFO     Disabled extensions: none
INFO     Found 22 files in media_dir.
INFO     No local library metadata cache found at /mnt/dietpi_userdata/mopidy/data/local/library.json.gz. Please run `mopidy local scan` to index your local music library. If you do not have a local music collection, you can disable the local backend to hide this message.
INFO     Checking 0 tracks from library.
INFO     Removing 0 missing tracks.
INFO     Found 22 tracks which need to be updated.
INFO     Scanning...
WARNING  Failed local:track:Absolute-Radio-00s.pls: gst-stream-error-quark: Could not determine type of stream. (4)
WARNING  Failed local:track:Absolute-Radio-80s.pls: gst-stream-error-quark: Could not determine type of stream. (4)
WARNING  Failed local:track:Absolute-Radio-90s.pls: gst-stream-error-quark: Could not determine type of stream. (4)
WARNING  Failed local:track:Absolute-Radio.pls: gst-stream-error-quark: This appears to be a text file (5)
INFO     Scanned 22 of 22 files in 0s.
INFO     Cleaning up image directory
INFO     Done scanning.
Please, don't shoot the messenger.
I'd give you a thumbs up, but our PHPBB forum is a little "vintage" with emote offerings, lol.
And they arguably want to be installing and using local-sqlite since it’s far superior to the json library"
And C++ is far more superior than Python (Mopidy) ;) ;)
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Mopidy does not update the database

Post by Sciamano »

Fourdee wrote:Apologies for the delay and many thanks investigating this.
No problem! Always glad to help!
Fourdee wrote:
Please, don't shoot the messenger.
I'd give you a thumbs up, but our PHPBB forum is a little "vintage" with emote offerings, lol.
No problem, again! :)
Fourdee wrote:
And they arguably want to be installing and using local-sqlite since it’s far superior to the json library"
And C++ is far more superior than Python (Mopidy) ;) ;)
Well, I know nothing at all of any of the two! :mrgreen:

Anyway, do I have to do anything on my mopidy installation now?
I mean, you said the issue has been solved now, but do I have to edit the file /usr/sbin/mopidyctl back to its original state or not?
Sorry this is not too clear. :)
Post Reply