# Problem scanning local flac files

**URL:** <https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823>\
**Category:** Misc\
**Created:** [March 18, 2021, 6:25pm UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823 "2021-03-18T18:25:08Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterWurmsdobler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/peterwurmsdobler/32/1984_2.png) [@PeterWurmsdobler](https://discourse.mopidy.com/u/PeterWurmsdobler)\
**Post date:** [March 18, 2021, 6:25pm UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/1 "2021-03-18T18:25:09Z")

</div>

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):

```auto
[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:

```auto
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](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.

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [March 19, 2021, 12:32am UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/2 "2021-03-19T00:32:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PeterWurmsdobler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/peterwurmsdobler/32/1984_2.png) [@PeterWurmsdobler](https://discourse.mopidy.com/u/PeterWurmsdobler)\
**Post date:** [March 19, 2021, 7:19am UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/3 "2021-03-19T07:19:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PeterWurmsdobler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/peterwurmsdobler/32/1984_2.png) [@PeterWurmsdobler](https://discourse.mopidy.com/u/PeterWurmsdobler)\
**Post date:** [March 19, 2021, 7:54am UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/4 "2021-03-19T07:54:18Z")

</div>

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

```auto
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:

```auto
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:

```auto
mopidy local scan --force

```

The file section in config is:

```auto
[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:

```auto
[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

```

---

<div class="post-metadata">

**Author:** ![PeterWurmsdobler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/peterwurmsdobler/32/1984_2.png) [@PeterWurmsdobler](https://discourse.mopidy.com/u/PeterWurmsdobler)\
**Post date:** [March 19, 2021, 5:08pm UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/5 "2021-03-19T17:08:37Z")

</div>

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.0`so I can connect from laptop. I have renamed my music folder from`/home/pi/music`to`/home/pi/Music`; it contains a sub-folder `bach` with a couple of flac files. Then I set the configuration to:

```auto
[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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![PeterWurmsdobler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/peterwurmsdobler/32/1984_2.png) [@PeterWurmsdobler](https://discourse.mopidy.com/u/PeterWurmsdobler)\
**Post date:** [March 19, 2021, 5:13pm UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/6 "2021-03-19T17:13:09Z")

</div>

Update: if I set:

```auto
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?

---

<div class="post-metadata">

**Author:** ![PeterWurmsdobler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/peterwurmsdobler/32/1984_2.png) [@PeterWurmsdobler](https://discourse.mopidy.com/u/PeterWurmsdobler)\
**Post date:** [March 19, 2021, 5:20pm UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/7 "2021-03-19T17:20:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [March 19, 2021, 7:47pm UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/8 "2021-03-19T19:47:33Z")

</div>

> 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.0`so 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.

---

<div class="post-metadata">

**Author:** ![PeterWurmsdobler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/peterwurmsdobler/32/1984_2.png) [@PeterWurmsdobler](https://discourse.mopidy.com/u/PeterWurmsdobler)\
**Post date:** [March 20, 2021, 10:42am UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/9 "2021-03-20T10:42:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [March 20, 2021, 2:12pm UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/10 "2021-03-20T14:12:12Z")

</div>

I’ve just seen [Browse files is broken in 3.57.0 · Issue #718 · jaedb/Iris · GitHub](https://github.com/jaedb/Iris/issues/718) was filed which looks like it might be related to the problem you see with Iris.

---

<div class="post-metadata">

**Author:** ![PeterWurmsdobler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/peterwurmsdobler/32/1984_2.png) [@PeterWurmsdobler](https://discourse.mopidy.com/u/PeterWurmsdobler)\
**Post date:** [March 20, 2021, 5:57pm UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/11 "2021-03-20T17:57:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/system/32/1_2.png) [@system](https://discourse.mopidy.com/u/system)\
**Post date:** [March 23, 2021, 5:57pm UTC](https://discourse.mopidy.com/t/problem-scanning-local-flac-files/4823/12 "2021-03-23T17:57:41Z")

</div>

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