Neon: how to add local music?

I have a local music collection available through either NFS or WFW mount.
It seems Neon doesn’t have the MPD installed like the original firmware.

How do I give neon access to my local music collection ?

1 Like

I’m also interested in this.

1 Like

Hi @fromport, @brianread, we aren’t using MPD since one of our goals is to minimize the number of services running on the Mark2. The current skill looks at a local directory, so if you want to mount your network share then the skill can be configured to look at that directory. We don’t yet support network locations for “local media” and likely won’t anytime soon. That said, we’re always open to community development proposals :slight_smile:

I first learned skill-writing by trying a music skill based on Emby/Jellyfin. Then Mycroft moved to mpc/mpd with Dinkum. so I checked it out, and like that much better. It is simple to call mpc to do what you need. The Emby API was much more complex.

After Mycroft went belly-up, I ported the mpc/mpd skill to OVOS in a new repo here: https://github.com/mike99mac/ovos-skill-mpc-mike99mac

Unfortunately, I was not able to get it running on OVOS after a fair amount of trying. :frowning_face: I am no wizard.

Then I learned of minimy (“Mini Mycroft” by Ken Smith) and ported the skill yet again, where I was able to get it running fairly quickly. The code base is way smaller, and I’m a big proponent of the “Less is More” philosophy. So the OVOS skill is on hold for now, but I could well come back to it.

My goal is to get the skill to index libraries (mp3 files, etc.), play Internet radio stations, get music from the Internet (probably YouTube but artist compensation is a dilema), and play at least NPR news. mpc can handle all of them. If one skill can do that, there’s no reason for returning confidence levels and voting and all that. Also, because mpc plays all music/news, you don’t need mpg123, aplay, etc. So that is some simplification.

But I understand trying to simplify the number of daemons required. mpd has been rock solid IMHO. It’s pulseaudio that is both a PITA and a necessary evil.

Hope this helps.

-Mike Mac
1 Like

Any info on that “a local directory” available ?

On Ubuntu Desktop, USB drives are automounted over /media. e.g.:

$ mount | grep media
/dev/sda1 on /media/pi/2F11-AF89 type vfat (rw,nosuid,nodev,relatime,uid=1000...
-Mike Mac

But you can not make a directory in /media and mount a nfs/samba share.
Is there another way around this ?

Why not?

You should be able to do something like: sudo mkdir /media/music , set up a mount over that directory in /etc/fstab. mpc/mpd will find the music files with the mpc update command.

Hope this helps.

-Mike Mac

(venv) neon@neon:/$ sudo mkdir /media/music
mkdir: cannot create directory ‘/media/music’: Permission denied

normally /media/$user/$device_label is automounted as the user logged in.

For some reason you can not manually create subdirs and mount something there.

Would be nice if could manually instruct neon to also look at /mnt/[directory_of_choice] for music

I stand corrected.

Do you need to get music from both the automounted USB drive and a network mount?

I guess you could turn the automounter off and hard code a common directory in /etc/fstab where the USB and network drives get mounted.

If you need music from just the network drive, you can leave the automounter alone and change where mpc/mpd looks for the music. In my __init__.py, I have this (for now at least - it should probably be a /etc/mycroft.conf variable).

  self.mpc_client = MpcClient("/media/")
-Mike Mac
1 Like

That makes sense.
How do I install your GitHub - mike99mac/ovos-skill-mpc-mike99mac: Mycroft music playing skill for mpc/mpd on a neon machine.
I know you said you didn’t get it working, but I would like play around with it a bit.
In the documentation i see nothing that explains how to install your mpc add-on on a machine (eg minimy)

Sorry, you don’t. The code is not soup yet.

I’m developing it on a system less complex than OVOS. Ideally both OVOS and my code will firm up and be able to come back together as described above.

-Mike Mac
2 Likes

that skill is trying to fully manage playback, in ovos you should use OCP

https://openvoiceos.github.io/ovos-technical-manual/OCP

with OCP skills only provide search results, playback is handled by OCP, it will decide how to best handle media

here is an example skill GitHub - OpenVoiceOS/skill-ovos-somafm

so your skill should drop all calls to audio service and such and simply return file results to OCP for showing in the UI and such

if you want to change how audio itself is played, for those you use audio plugins such as

2 Likes

@JarbasAl Thanks for the reply.

I see OCP uses VLC. I look at MPC vs VLC and find one data point:

  • “MPC and VLC are excellent choices for a media player. They have their pros and cons, so it really depends on your needs as to which one you should choose. If you need a lightweight media player, MPC is more suitable. If you need a media player with many features, VLC is better.”
    Source: https://videoconverter.wondershare.com/vlc/mpc-vs-vlc-media-player.html

I’m from the “less is more” school of thought, so MPC wins. At this point it would take a major rewrite of my code to fit into the OVOS model. Not sure I have the cycles, but I’m not saying “never”.

-Mike Mac
1 Like

what i was getting at is that you have 2 different things going on

1 - the skill should only search results and send them to OCP, even if they come from MPC they are just uris and can be played with others players right? with OCP this has many other advantages, such as if you have mycroft-gui running the playback happens there instead (eg, in android)
2 - the playback handling, if you want to use MPC then its just a audio playback plugin, any time a skill wants to play audio it can be told to use MPC instead of VLC

both are independent concepts. “less” is that the skill only gives results and does not reimplement playback itself, vlc vs mpc are easy to change around and do not translate to “less” they translate to “use whatever is already installed without forcing a new dep”, you can use the simple player which will just call mpg123 via subprocess if you really want “less”

1 Like

for now, I have given up on mounting remote server with my music collection.
I have made a USB stick with some essential music.
When I plug it in, the kernel recognizes it:

fdisk -l /dev/sdb

Disk /dev/sdb: 14.32 GiB, 15376318464 bytes, 30031872 sectors
Disk model: SanDisk 3.2Gen1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3a8674a9

But it doesn’t get mounted:

root@neon:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 39G 9.0G 28G 25% /
devtmpfs 738M 0 738M 0% /dev
tmpfs 900M 1.2M 898M 1% /dev/shm
tmpfs 360M 22M 339M 6% /run
tmpfs 5.0M 12K 5.0M 1% /run/lock
tmpfs 20M 0 20M 0% /ramdisk
/dev/sda1 61M 44M 17M 73% /boot/firmware
tmpfs 180M 4.0K 180M 1% /run/user/1004

Any suggestions how to get my usb stick with music recognized ?

You will have to mount it if you don’t have automount.

just make eg /music and then mount the usb stick there ?
I can do that.
But how can I instruct neon to tell to search there for music ?
From the previous part of the conversation, it will only look for music in /media/*
So I need to install automount ?

UPDATE
I searched around and found pmount might be an option:

(venv) neon@neon:~$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 Jan 25 00:17 22e501db-5708-4994-a294-da73cfeaffbc → …/…/sda2
lrwxrwxrwx 1 root root 10 Jan 25 00:17 4FD5-13C6 → …/…/sda1
lrwxrwxrwx 1 root root 10 Jan 25 00:17 7864e7fe-0238-481f-b28c-c22cca627bbe → …/…/sda3
lrwxrwxrwx 1 root root 10 Apr 22 16:28 78DE-A35C → …/…/sdb1
(venv) neon@neon:~$ sudo apt install pmount
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Suggested packages:
cryptsetup
The following NEW packages will be installed:
pmount
0 upgraded, 1 newly installed, 0 to remove and 467 not upgraded.
Need to get 85.7 kB of archives.
After this operation, 514 kB of additional disk space will be used.
Get:1 Index of /debian bookworm/main arm64 pmount arm64 0.9.23-6 [85.7 kB]
Fetched 85.7 kB in 1s (147 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package pmount.
(Reading database … 127653 files and directories currently installed.)
Preparing to unpack …/pmount_0.9.23-6_arm64.deb …
Unpacking pmount (0.9.23-6) …
Setting up pmount (0.9.23-6) …
Processing triggers for man-db (2.11.2-1) …

(venv) neon@neon:~$ sudo pmount /dev/sdb1
Error: could not create directory: Permission denied

I just searched the internet and found this: https://askubuntu.com/questions/1062719/how-do-i-disable-the-auto-mounting-of-internal-drives-in-ubuntu-or-kubuntu-18-04

So maybe something like (but I haven’t tried it):

sudo systemctl stop udisks2.service
sudo systemctl disable udisks2.service
sudo reboot

Then you should be able to make a directory under /media.

Hope this helps.

-Mike Mac
1 Like

new docs page for OCP skill development are up

https://openvoiceos.github.io/community-docs/dev_ocp_skill/

2 Likes