Mopidy Discourse

Problem scanning local flac files

Hello,

Following excellent instructions on how to install mopidy on a Raspberry PI-4 I got it working nearly straight away. In order to test if mopidy is able to play local files, however, I installed mopidy-local as I thought I would need that in addition to the bundled mopidy-file The distinction is not quite clear to me though. That may be one issue.

Anyway, I created a folder /home/pi/music/bach/ and copied about 20 flac files into that folder. Then I configured ./config/mopidy/mopidy.conf to include (only beginning of section shown):

[file]
enabled = true
media_dirs =
  /home/pi/music | Home
:
[local]
enabled = true
library = json
media_dir = /home/pi/music
:

And ran mopidy local scan assuming that this is the incantation needed to make mopidy learn the metadata of the music collection. Then I started mopidy proper, also having installed mopidy-iris prior to that. So far so good.

On http://192.168.1.123:6680/iris/library/browse/ I can see a “Local Media” folder icon, clicking on it and I see some various folders for Albums, Artists, etc. Clicking on one of those I get an error:

Oops, that link could not be found

With mopidy reporting on the command line:

ERROR    2021-03-18 18:18:45,806 [16267:LocalBackend-6] mopidy_local.library
  Lookup error for local:directory: Invalid lookup URI

I would have expected to being able to browse at least the file system in one way or the other. I have even tried to “Start local scan” in http://192.168.1.123:6680/iris/settings for good measure, but in vain.

What has gone wrong in the installation or configuration of a local media source?

Regards, peter.

Why do you have ‘:’ characters after both media_dirs and media_dir config settings?

Also, remove the space from /home/pi/music | Home so that it’s /home/pi/music|Home.

You should also be seeing a warning that the config option library = json is invalid. Please remove it. You can see all the valid config options if you run mopidy config and you’ll see that one is not there.

Thanks for your response.
As for the : at the end of both media_dir config settings, they are actually not part of my config. I used the : to indicate a continuation not shown.
I will remove the spaces around the | symbol; I assumed that spaces should not make a difference.
The library = json I must have picked up from an older configuration page; will be removed.
Cheers, peter.

Unfortunately, that did not work either. I have dropped the json bit, removed the blank as suggested. Still no luck. modipy says:

WARNING  2021-03-19 07:48:12,265 [993:FileBackend-3] mopidy.file.library
  Failed looking up file:///home/pi/music: gst-resource-error-quark: "/home/pi/music" is a directory. (5)
WARNING  2021-03-19 07:48:27,447 [993:FileBackend-3] mopidy.file.library
  Failed looking up file:///home/pi/music: gst-resource-error-quark: "/home/pi/music" is a directory. (5)
ERROR    2021-03-19 07:48:29,476 [993:LocalBackend-6] mopidy_local.library
  Lookup error for local:directory: Invalid lookup URI

There are flac files in the folder:

pi@raspberrypi:~ $ ls -l /home/pi/music/bach/
total 218172
-rw-r--r-- 1 pi pi 11198295 Mar 18 17:12 '01 - Aria.flac'
-rw-r--r-- 1 pi pi  5758661 Mar 18 17:12 '02 - Variation 1.flac'

And I had done a rescan before starting:

mopidy local scan --force

The file section in config is:

[file]
enabled = true
media_dirs =
  /home/pi/music|Home
excluded_file_extensions =
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .pdf
  .png
  .txt
  .zip
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

The local section is:

[local]
enabled = true
media_dir = /home/pi/music
data_dir = $XDG_DATA_DIR/mopidy/local
playlists_dir = $XDG_DATA_DIR/mopidy/local/playlists
scan_timeout = 1000
scan_flush_threshold = 1000
excluded_file_extensions =
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .png
  .txt

So I have completely removed mopidy and mopidy-iris and installed it all again. No mopidy-local this time. Then left the config mostly as default. I have only changed hostname = 0.0.0.0so I can connect from laptop. I have renamed my music folder from/home/pi/musicto/home/pi/Music; it contains a sub-folder bach` with a couple of flac files. Then I set the configuration to:

[file]
enabled = true
media_dirs = /home/pi/Music

Still not luck being able to browse to the folder using Iris. On the command line I can see:

WARNING  2021-03-19 17:02:37,266 [3529:FileBackend-3] mopidy.file.library
  Failed looking up file:///home/pi/Music: gst-resource-error-quark: "/home/pi/Music" is a directory. (5)

The error is surprising; it seems to complain that the folder defined in media_dirs is a directory.

Given how well the whole codebase seems to be structured, designed and documented, I am surprised that added a single folder with music in there does not work.

Update: if I set:

media_dirs = /home/pi/Music/bach

Then the system can indeed find the flac files.

I had implicitly assumed that mopidy would scan the folder tree from the root node provided. I would not possibly add all 1000 folders, one per CD I had ripped.

Any thoughts on that?

Further observation: the flac files in the bach folder were not listed in the order of the file names, but sorted by title, not even by track number, so for the Goldberg Variations I see:
Aria
Variatio 1
Variatio 10
Variatio 11
|
Variatio 2
Variattio 20

Any sort options in Iris?

So I have completely removed mopidy and mopidy-iris and installed it all again. No mopidy-local this time. Then left the config mostly as default. I have only changed hostname = 0.0.0.0so I can connect from laptop.

Brilliant, keeping the config as small as possible makes life simpler. You don’t need enabled = true either, that is the default for all extensions.

I think the warning (not error) message is a red-herring. It’s a quirk of how Iris works. A web client should not do a Mopidy lookup on a directory, but Iris does. However, it should be harmless because it also does a browse request of the directory and that should succeed. If you were to enable debug logging you would see that happening. I’ve raised this Iris issue before but I can’t find the Github issue now. Bottom line - it can be ignored.

Except, of course, you say you can’t see our music. We obviously can’t ignore that. It does work exactly as you think it should. I am confused why pointing the media_dirs setting one level down makes a difference. Is there any chance the permissions of the entire directory structure are not readable and executable by your user? Are there any other log messages?

I can’t comment on sort options in Iris.

Hello @kingosticks , thanks for taking the time looking into that.

As for the permission, all is fine: all is owned by pi:pi, folders are 755 and files 644. Since I am running mopidy as pi, there should not be any issue with permissions. It may all be an Iris issue then. I will have a look at its source code and potentially file an issue.

Alternatively, I could use a different server side client. This is what I did, tried the mobile one, and muse. All of them display the list of files correctly.

Bottom line: mopidy works fine and I am quite happy with the design, implementation, documentation and extensibility. Only Iris through me off the track.

Cheers, peter.

1 Like

I’ve just seen Browse files is broken in 3.57.0 · Issue #718 · jaedb/Iris · GitHub was filed which looks like it might be related to the problem you see with Iris.

Thanks for letting me know; I should have checked Iris issues before trying out all sorts of things. At least I have learned something about mopidy.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.