Posts: 8
Threads: 3
Joined: Jun 2024
Reputation:
0
Hi,
I'm searching endlessly...
I have a simple question. How can I add a local folder as music library?
Explaination: I have my Pi booting from SSD. On this SSD I have folders that should contain my music. But how the hell can I tell moode about this folders?
I found /var/lib/mpd/music where some links exist. I added a link to my library folder there et voila, mpd finds them and can index them. But... There must be more
Cover Art is not working.
Thumbnail generator does not know about those folders.
Code: thumb-gen: Scanning: NAS, SDCARD, BOOTFS, rootfs
That's not the links defined in mpd/music. (there I have no SDCARD link any longer for example).
So, long story short. Where do I define the searched folders, so that all components know about them?
Kind regards,
Martin
(Moode 9.0.1 2024-05-30)
Posts: 13,359
Threads: 302
Joined: Mar 2018
Reputation:
538
The symlinks in the MPD music directory point to the moode base directories that will be included in MPD database scan, thumbnail generation and Library cache generation.
Code: pi@sig:~ $ ls -l /var/lib/mpd/music/
total 12
lrwxrwxrwx 1 root root 8 May 10 09:31 NAS -> /mnt/NAS
drwxrwxrwx 2 root root 12288 Jun 10 15:55 RADIO
lrwxrwxrwx 1 root root 11 May 10 09:31 SDCARD -> /mnt/SDCARD
lrwxrwxrwx 1 root root 6 May 10 09:31 USB -> /media
With uSD Card boot media you would place the music collection under /mnt/SDCARD directory.
With SSD boot media you could do same since there is no predefined /mnt/SSD dir although I do have something about adding it in my notes. The only annoyance would be when using Folder view SDCARD would be the top level folder name and not something more meaningful like SSD.
Also note that these directory names are defined in /var/www/inc/constants.php and are referenced in several parts of the code.
Code: const ROOT_DIRECTORIES = array('NAS', 'SDCARD', 'USB');
Also, you definitely don't want bootfs or rootfs to be part of any mpd, thumbgen or libcache scan. I'm not sure how those became listed in your thmgen scan. Were they manually mounted to /media ?
Posts: 8
Threads: 3
Joined: Jun 2024
Reputation:
0
Hi,
sry for late reply, was busy...
Ah, I see, there's no "central" configuration for this items. That makes things worse.
Let me share my findings so far.
The reason for having bootfs & rootfs in the list: don't know. they are part of /media. I didn't put them in there, they are automagically there. My setup: Raspi3B+, moode flashed to SSD (on usb) and on th sdCard there's bootcode.bin for succefsul boots. that's not an ideal setup. my Pi4 is coming in like a month. On Pi 3 it might be better to bot from SD card...
But let me recap what I found so far.
- MPD uses /var/lib/mpd/music to find it's music
- thumb-gen uses:
Code: $mntDirs = str_replace("\n", ', ', shell_exec('ls /mnt'));
$mediaDirs = str_replace("\n", ', ', shell_exec('ls /media'));
aka /mnt and /media to LOG what it is searching for.
in /media it adds a /USB in front of all entries.
if entries are in /mnt and /media, they are duplicated.
Code: Scanning: NAS, SDCARD, VINYL, BOOTFS, rootfs, VINYL
but that's just a log based on thumb-gen.php. the real scanning for folders is then forwarded to list-songfiles.sh which again takes (hardcoded) /mnt and /media for finding posible libraries.
And I think here's a bug. But, please doublecheck :
The original list-songfiles.sh used
Code: find "/mnt/${DIRS[$i]}"
to identify the songfiles on /mnt. this didn't deliver any results on my setup. However, adding a trailing '/' to this find delivers a working list of files/dictionaries and thus a wonderfully created thumbnail.
so, my new / "fixed" code looks like this:
Code: find "/mnt/${DIRS[$i]}/" -depth -mindepth 1 -type f -iregex ".*\.${TYPES_REGEX}" -printf "file: ""${DIRS[$i]}/""%P\n"
The difference between thos two versions is (on my example playground):
Code: Done: 4 folders scanned, 4 thumbs created, 0 already in cache.
vs
Done: 6 folders scanned, 6 thumbs created, 0 already in cache.
Bonus fact: None of this methods uses
Code: const ROOT_DIRECTORIES
from constants.php. So... there's a lot of hardcoded folder/file knowledge that doesn't account to any settings/constants/mpd settings. maybe worth fixing this.
Kind regards,
Martin
Posts: 5,995
Threads: 175
Joined: Apr 2018
Reputation:
233
Quote:The reason for having bootfs & rootfs in the list: don't know. they are part of /media. I didn't put them in there, they are automagically there. My setup: Raspi3B+, moode flashed to SSD (on usb)
Just a note: Your setup explains why the /bootfs and /rootfs partitions on your SSD show up in /media. All USB mass storage devices are assumed to be possible music sources. That's a trait inherited from Raspberry Pi OS and its parent debian. Even my Linux Mint laptop mounts under /media all the partitions of any USB mass storage device I plug in.
Regards,
Kent
Posts: 13,359
Threads: 302
Joined: Mar 2018
Reputation:
538
(06-21-2024, 08:49 PM)TheOldPresbyope Wrote: Quote:The reason for having bootfs & rootfs in the list: don't know. they are part of /media. I didn't put them in there, they are automagically there. My setup: Raspi3B+, moode flashed to SSD (on usb)
Just a note: Your setup explains why the /bootfs and /rootfs partitions on your SSD show up in /media. All USB mass storage devices are assumed to be possible music sources. That's a trait inherited from Raspberry Pi OS and its parent debian. Even my Linux Mint laptop mounts under /media all the partitions of any USB mass storage device I plug in.
Regards,
Kent
When a USB drive is the boot drive, the Linux partition directories bootfs and rootfs don't get auto-mounted. I'm not sure how they showed up in @ schmidtjr system.
A quick test booting from a USB drive. There is no uSD card in this system.
Code: pi@moode9usb:~ $ ls -al /media
total 8
drwxr-xr-x 2 root root 4096 Jun 21 17:40 .
drwxr-xr-x 18 root root 4096 Jun 21 17:10 ..
Posts: 13,359
Threads: 302
Joined: Mar 2018
Reputation:
538
(06-21-2024, 07:28 PM)schmidtjr Wrote: Hi,
sry for late reply, was busy...
Ah, I see, there's no "central" configuration for this items. That makes things worse.
Let me share my findings so far.
The reason for having bootfs & rootfs in the list: don't know. they are part of /media. I didn't put them in there, they are automagically there. My setup: Raspi3B+, moode flashed to SSD (on usb) and on th sdCard there's bootcode.bin for succefsul boots. that's not an ideal setup. my Pi4 is coming in like a month. On Pi 3 it might be better to bot from SD card...
But let me recap what I found so far.
- MPD uses /var/lib/mpd/music to find it's music
- thumb-gen uses:
Code: $mntDirs = str_replace("\n", ', ', shell_exec('ls /mnt'));
$mediaDirs = str_replace("\n", ', ', shell_exec('ls /media'));
aka /mnt and /media to LOG what it is searching for.
in /media it adds a /USB in front of all entries.
if entries are in /mnt and /media, they are duplicated.
Code: Scanning: NAS, SDCARD, VINYL, BOOTFS, rootfs, VINYL
but that's just a log based on thumb-gen.php. the real scanning for folders is then forwarded to list-songfiles.sh which again takes (hardcoded) /mnt and /media for finding posible libraries.
And I think here's a bug. But, please doublecheck :
The original list-songfiles.sh used
Code: find "/mnt/${DIRS[$i]}"
to identify the songfiles on /mnt. this didn't deliver any results on my setup. However, adding a trailing '/' to this find delivers a working list of files/dictionaries and thus a wonderfully created thumbnail.
so, my new / "fixed" code looks like this:
Code: find "/mnt/${DIRS[$i]}/" -depth -mindepth 1 -type f -iregex ".*\.${TYPES_REGEX}" -printf "file: ""${DIRS[$i]}/""%P\n"
The difference between thos two versions is (on my example playground):
Code: Done: 4 folders scanned, 4 thumbs created, 0 already in cache.
vs
Done: 6 folders scanned, 6 thumbs created, 0 already in cache.
Bonus fact: None of this methods uses
Code: const ROOT_DIRECTORIES
from constants.php. So... there's a lot of hardcoded folder/file knowledge that doesn't account to any settings/constants/mpd settings. maybe worth fixing this.
Kind regards,
Martin
I don't see anything that needs fixing. On a fresh, unmodified image all you need to do is put your music collection under /mnt/SDCARD directory.
The name SDCARD is just cosmetic. It only appears in Folder view.
Posts: 8
Threads: 3
Joined: Jun 2024
Reputation:
0
Hi,
So, I've setup a new fresh installation from image_2024-05-30-moode-r901-arm64-lite.
Imaged directly onto SSD. But I have an SD card in the pi, containing bootcode.bin. Otherwise I had bootup issues with ssd. That's only temporary until my pi4 arrives.
Directly after first startup, no config, no modifications, nothing:
Code: pi@moode:~ $ ls -l /media
total 8
drwxr-xr-x 2 root root 4096 Jan 1 1970 BOOTFS
drwxr-xr-x 18 root root 4096 Jun 5 22:54 rootfs
But then, I followed your suggestion. Added the music to /mnt/SDCARD. and... found by MPD and coverart is created. nice. so far so good. That it needs to sit in /mnt/SDCARD is something I need to live with. Those locations are hardcoded in so many places, simplest approach is to use the hardcoded ones.
The "fix" with the trailing "/" is not required now. But maybe (depending on local setup) if one wants, changing it to "find -L" might be a good idea. if the files are symlinked and not directly copied to /mnt/SDCARD.
The issue with BOOTFS and rootfs might be due to the fact, that I have the sdcard with bootimage. I will postpone this for now.
Kind regads,
Martin
Posts: 13,359
Threads: 302
Joined: Mar 2018
Reputation:
538
06-22-2024, 01:14 PM
(This post was last modified: 06-22-2024, 01:16 PM by Tim Curtis.
Edit Reason: eta
)
9.0.2 is latest release
Theres nothing wrong with hard coding specific names. It's done in all software but for sure the name SDCARD is not the ideal folder name when booting from USB drive. Maybe some other name would be better.
Is the bootcode.bin hack needed for certain Pi models?
ETA: Does bootfs and rootfs show up in Folder View?
Posts: 33
Threads: 6
Joined: Nov 2019
Reputation:
3
Hmm,
How about LocalMusic ??
This is also indicated with my Pi 5 NVME HAT
Bob
Posts: 244
Threads: 15
Joined: Apr 2018
Reputation:
9
LocalMusic? Nope, that's a really bad choice.
What if your files are just podcasts and audiobooks?
|