Use network drive for Jukebox Music

ok, found that you have to restart mpd after the mount before running the update:

systemctl restart mpd
mpc update

Takes quite a long time to run the import.

what device are you actually using here ? Just curious as I’m running dinkum which doesn’t seem to install pretty much any apt package.
sudo apt install nfs-utils
Reading package lists… Done
Building dependency tree… Done
E: Unable to locate package nfs-utils
I did check out mpd, the /etc/mpd.conf shows the following basic configs:
music_directory “/media”
playlist_directory “/var/lib/mpd/playlists”
db_file “/var/lib/mpd/tag_cache”
log_file “/var/log/mpd/mpd.log”
The tag_cache file ends up as a gzipped text file of all that it finds. Copied it locally and gunzipped it.
My usb holds about 1200 tracks, which it sucked in very quickly, tho have to remove the media usb at boot, otherwise the machine won’t boot …
Tried adding an m3u playlist (which apparently mpd is normally happy with), but couldn’t get mycroft to play it. Guess thats buried in the skill somewhere.
Would like to be able to install stuff with apt, tho. Are you running core or have you added repositories ?
Thanks. nfs would be the way for me to go as well.

1 Like

Didi you run apt update first?

no, I hadn’t. Assumed any updates were coming automagically from mycroft ?
However, did that. and the apt upgrade. Got some perl stuff etc.
Afterwards (and after a reboot) still got the
E: Unable to locate package nfs-utils
message.
However was able to now install some of my regular favorite tools, file, lsof, locate etc, which were all coming up with similar “unable to locate packages” before.
So many thanks for that.
Am now a little bewildered, either it has the correct repositories, and can find the packages, or it can’t. Did the “apt update” update the repositories ?
thanks again

btw, am running dinkum on the Mark2

I’m running MarkII under Dinkum, straight out of the box.

(.venv) mycroft@localhost:~$ apt list | grep nfs-

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libnfs-dev/focal 4.0.0-1 arm64
libnfs-utils/focal 4.0.0-1 arm64
libyanfs-java/focal 0.0+cvs20070825-4 all
nfs-common/focal-updates,now 1:1.3.4-2.5ubuntu3.4 arm64 [installed]
nfs-ganesha-ceph/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha-doc/focal-updates 3.0.3-0ubuntu3.2 all
nfs-ganesha-gluster/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha-gpfs/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha-mem/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha-mount-9p/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha-nullfs/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha-proxy/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha-rados-grace/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha-vfs/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha-xfs/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-ganesha/focal-updates 3.0.3-0ubuntu3.2 arm64
nfs-kernel-server/focal-updates 1:1.3.4-2.5ubuntu3.4 arm64
python3-nfs-ganesha/focal-updates 3.0.3-0ubuntu3.2 all
unionfs-fuse/focal 1.0-1ubuntu2 arm64
(.venv) mycroft@localhost:~$ 

Looks like you might have to install nfs-common. No idea why nfs-utils worked for me.

Am struggling to get anything played by the skill.

Here’s a dump of the journal shgowing it having found “Something”, but not playing it.

Nov 21 10:32:19 localhost.localdomain python[601]: INFO:homescreen.mark2:Displaying the Home Screen idle screen.
Nov 21 10:32:19 localhost.localdomain python[601]: INFO:mycroft.util.log:Home screen wallpaper set to /opt/mycroft-dinkum/skills/homescreen.mark2/ui/wallpapers/moon.png
Nov 21 10:32:19 localhost.localdomain python[360]: DEBUG:mycroft.util.log:Starting session: 1675f32b-6132-4404-bb08-e8e61d8fd1a8
Nov 21 10:32:19 localhost.localdomain python[360]: DEBUG:mycroft.util.log:Disabled idle timeout
Nov 21 10:32:19 localhost.localdomain python[360]: DEBUG:mycroft.util.log:Completed action for session 1675f32b-6132-4404-bb08-e8e61d8fd1a8: ShowPageAction(namespace='homescreen.mark2.mark_ii_idle.qml', page='file:///opt/mycroft-dinkum/skills/homescreen.mark2/ui/mark_ii_idle.qml', data={'showAlarmIcon': False, 'homeScreenTemperature': 6, 'homeScreenWeatherCondition': 'file:///opt/mycroft-dinkum/skills/weather.mark2/ui/images/partial_clouds_day.svg', 'isMuted': False, 'mycroftContainerBuildDate': '', 'homeScreenTime': '10:32', 'homeScreenDate': 'Monday 21 Nov', 'wallpaperPath': '/opt/mycroft-dinkum/skills/homescreen.mark2/ui/wallpapers/moon.png'})
Nov 21 10:32:19 localhost.localdomain python[641]: DEBUG:enclosure:Idle was handled by homescreen.mark2
Nov 21 10:32:19 localhost.localdomain startx[675]: Arrived mycroft.gui.list.insert, delegateUrls are ("file:///opt/mycroft-dinkum/skills/homescreen.mark2/ui/mark_ii_idle.qml")
Nov 21 10:32:19 localhost.localdomain python[360]: DEBUG:mycroft.util.log:Cleaning up ended session: 1675f32b-6132-4404-bb08-e8e61d8fd1a8
Nov 21 10:32:19 localhost.localdomain startx[675]: Both point size and pixel size set. Using pixel size.
Nov 21 10:32:19 localhost.localdomain startx[675]: Both point size and pixel size set. Using pixel size.
Nov 21 10:32:19 localhost.localdomain startx[675]: Both point size and pixel size set. Using pixel size.
Nov 21 10:32:19 localhost.localdomain startx[675]: Both point size and pixel size set. Using pixel size.
Nov 21 10:32:19 localhost.localdomain startx[675]: Both point size and pixel size set. Using pixel size.
Nov 21 10:32:19 localhost.localdomain startx[675]: Created a new DelegateLoader DelegateLoader(0x55c158fe00) which will load QUrl("file:///opt/mycroft-dinkum/skills/homescreen.mark2/ui/mark_ii_idle.qml") for the skill "homescreen.mark2.mark_ii_idle.qml"
Nov 21 10:32:19 localhost.localdomain startx[675]: QQuickItem::stackBefore: Cannot stack Control_QMLTYPE_12_QML_22(0x55c1844320, parent=0x55c19545d0, geometry=0,0 800x480) before QQuickRepeater(0x55c1443280), which must be a sibling
Nov 21 10:32:32 localhost.localdomain python[11013]: volume: n/a   repeat: off   random: off   single: off   consume: off
Nov 21 10:32:32 localhost.localdomain python[601]: DEBUG:mycroft.util.log:['mpc', '-h', '127.0.0.1', 'search', '--format', '%artist%\t%album%\t%title%\t%time%\t%file%', 'artist', 'something']
Nov 21 10:32:32 localhost.localdomain python[601]: DEBUG:mycroft.util.log:['mpc', '-h', '127.0.0.1', 'search', '--format', '%artist%\t%album%\t%title%\t%time%\t%file%', 'album', 'something']
Nov 21 10:32:32 localhost.localdomain python[601]: DEBUG:mycroft.util.log:['mpc', '-h', '127.0.0.1', 'search', '--format', '%artist%\t%album%\t%title%\t%time%\t%file%', 'title', 'something']
Nov 21 10:32:32 localhost.localdomain python[601]: DEBUG:play-music.mark2:Result: [Song(artist='Scott Joplin', album='The Best of Scott Joplin', title='Something Doing', duration_sec=167, file_path=PosixPath('/media/nfsmusic/files/Scott Joplin/The Best of Scott Joplin/Disc 1 - 20 - Something Doing.ogg')), Song(artist='The Beatles', album='1+', title='Something', duration_sec=181, file_path=PosixPath('/media/nfsmusic/files/The Beatles/1+/1-24 Something.mp3')), Song(artist='The Beatles', album='Abbey Road', title='Something', duration_sec=183, file_path=PosixPath('/media/nfsmusic/files/The Beatles/Abbey Road/02 Something.mp3'))]
Nov 21 10:32:32 localhost.localdomain python[601]: INFO:play.mark2:Reply from play-music.mark2: something (confidence=1.0)
Nov 21 10:32:33 localhost.localdomain su[11322]: (to mycroft) root on none
Nov 21 10:32:33 localhost.localdomain su[11322]: pam_unix(su-l:session): session opened for user mycroft by (uid=0)
Nov 21 10:32:33 localhost.localdomain systemd[1]: Started Session c2 of user mycroft.
Nov 21 10:32:47 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.mycroft.ai:443
Nov 21 10:32:47 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:https://api.mycroft.ai:443 "GET /v1/device/53dfd735-76ce-4b1b-8df5-21db43185eae/skill/settings HTTP/1.1" 304 0
Nov 21 10:32:47 localhost.localdomain python[641]: DEBUG:mycroft.util.log:No skill settings changes since last download
Nov 21 10:32:47 localhost.localdomain python[641]: DEBUG:mycroft.util.log:Scheduling settings download in 60 second(s)
Nov 21 10:33:01 localhost.localdomain python[641]: DEBUG:mycroft.util.log:Downloading remote settings
Nov 21 10:33:01 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.mycroft.ai:443
Nov 21 10:33:01 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:https://api.mycroft.ai:443 "GET /v1/device/53dfd735-76ce-4b1b-8df5-21db43185eae/setting HTTP/1.1" 304 0
Nov 21 10:33:01 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.mycroft.ai:443
Nov 21 10:33:01 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:https://api.mycroft.ai:443 "GET /v1/device/53dfd735-76ce-4b1b-8df5-21db43185eae/location HTTP/1.1" 304 0
Nov 21 10:33:01 localhost.localdomain python[641]: DEBUG:mycroft.util.log:Scheduled download of remote config in 60 second(s)
Nov 21 10:33:47 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.mycroft.ai:443
Nov 21 10:33:47 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:https://api.mycroft.ai:443 "GET /v1/device/53dfd735-76ce-4b1b-8df5-21db43185eae/skill/settings HTTP/1.1" 304 0
Nov 21 10:33:47 localhost.localdomain python[641]: DEBUG:mycroft.util.log:No skill settings changes since last download
Nov 21 10:33:47 localhost.localdomain python[641]: DEBUG:mycroft.util.log:Scheduling settings download in 60 second(s)
Nov 21 10:34:01 localhost.localdomain python[641]: DEBUG:mycroft.util.log:Downloading remote settings
Nov 21 10:34:02 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.mycroft.ai:443
Nov 21 10:34:02 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:https://api.mycroft.ai:443 "GET /v1/device/53dfd735-76ce-4b1b-8df5-21db43185eae/setting HTTP/1.1" 304 0
Nov 21 10:34:02 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.mycroft.ai:443
Nov 21 10:34:03 localhost.localdomain python[641]: DEBUG:urllib3.connectionpool:https://api.mycroft.ai:443 "GET /v1/device/53dfd735-76ce-4b1b-8df5-21db43185eae/location HTTP/1.1" 304 0
Nov 21 10:34:03 localhost.localdomain python[641]: DEBUG:mycroft.util.log:Scheduled download of remote config in 60 second(s)


Found this in the mpd log:

Nov 21 10:32 : client: [46] opened from 127.0.0.1:49824
Nov 21 10:32 : exception: Failed to open /media/nfsmusic/.Trash-1000: Permission denied
Nov 21 10:32 : client: [46] closed

Eliminated the “Failed to Open” error, by extending the mounted file to the actual music directory (so there is no Trash directory seen). However still not getting the tracks played, despite this:

Nov 21 11:12:18 localhost.localdomain startx[675]: Created a new DelegateLoader DelegateLoader(0x55c15bb090) which will load QUrl("file:///opt/mycroft-dinkum/skills/homescreen.mark2/ui/mark_ii_idle.qml") for the skill "homescreen.mark2.mark_ii_idle.qml"
Nov 21 11:12:18 localhost.localdomain startx[675]: QQuickItem::stackBefore: Cannot stack Control_QMLTYPE_12_QML_22(0x55c175d060, parent=0x55c1885840, geometry=0,0 800x480) before QQuickRepeater(0x55c17c01e0), which must be a sibling
Nov 21 11:12:29 localhost.localdomain python[12401]: volume: n/a   repeat: off   random: off   single: off   consume: off
Nov 21 11:12:29 localhost.localdomain python[601]: DEBUG:mycroft.util.log:['mpc', '-h', '127.0.0.1', 'search', '--format', '%artist%\t%album%\t%title%\t%time%\t%file%', 'artist', 'something']
Nov 21 11:12:29 localhost.localdomain python[601]: DEBUG:mycroft.util.log:['mpc', '-h', '127.0.0.1', 'search', '--format', '%artist%\t%album%\t%title%\t%time%\t%file%', 'album', 'something']
Nov 21 11:12:29 localhost.localdomain python[601]: DEBUG:mycroft.util.log:['mpc', '-h', '127.0.0.1', 'search', '--format', '%artist%\t%album%\t%title%\t%time%\t%file%', 'title', 'something']
Nov 21 11:12:29 localhost.localdomain python[601]: DEBUG:play-music.mark2:Result: [Song(artist='Scott Joplin', album='The Best of Scott Joplin', title='Something Doing', duration_sec=167, file_path=PosixPath('/media/nfsmusic/Scott Joplin/The Best of Scott Joplin/Disc 1 - 20 - Something Doing.ogg')), Song(artist='The Beatles', album='1+', title='Something', duration_sec=181, file_path=PosixPath('/media/nfsmusic/The Beatles/1+/1-24 Something.mp3')), Song(artist='The Beatles', album='Abbey Road', title='Something', duration_sec=183, file_path=PosixPath('/media/nfsmusic/The Beatles/Abbey Road/02 Something.mp3'))]
Nov 21 11:12:29 localhost.localdomain python[601]: INFO:play.mark2:Reply from play-music.mark2: something (confidence=1.0)
N

Doing it on the command line:

(.venv) mycroft@localhost:~$ mpc search title Something
nfsmusic/Scott Joplin/The Best of Scott Joplin/Disc 1 - 20 - Something Doing.ogg
nfsmusic/The Beatles/1+/1-24 Something.mp3
nfsmusic/The Beatles/Abbey Road/02 Something.mp3
(.venv) mycroft@localhost:~$ 

Is the Jukebox skill available on mycroft-core? If so, where?

Thanks.

-Mike Mac

nfs-common wasn’t initially installed on my mark2. Did get that on, but still no package nfs-utils to be installed.
Will check in a while to see if I can mount my nfs media. Got distracted by the world cup !
Thanks for all the info tho

I think I must have tried nfs-utils then nfs-common and the latter installed, but then I coped the wrong command on to the posting. Sorry for the confusion.

I’m Keen to hear how you get on with the nfs mount.

Yes, jukebox is the skill that I am trying to use to play my music. It is integrated by MyCroft into the MarkII core, I’ve not found a trigger word for it yet, apart from maybe “music”!

That’s Dinkum, right?

Is the Jukebox skill documented, and is it open source? I can’t seem to find it on the Internet.

Thanks.

-Mike Mac

hey Brian.
Got the nfs mount to work. After installing nfs-common it wouldn’t do the mount, however (on other pi’s) had to install nfs-kernel-server package. After I did that the mount worked fine.
Mounted it at /media/lms then restarted mpd. The logs showed all the tag info being loaded, all looked good. Also checked the
/var/lib/mpd/tag_cache file and again it had all the entries in.
tried a play “brown sugar” but got the sorry I can’t find that message.
Gonna try with a regular usb to see what journalctl messages are different. Also may try mounting it somewhere else and changing the default mpd conf file to another area. But now world cup again …

2 Likes
2 Likes

@goldyfruit Thank you!

-Mike Mac
1 Like

I’ve been playing with the “play jukebox” command, and its been falling over on some .mid files that I have with this:

Nov 26 08:41:06 localhost.localdomain python[625]: ERROR:play-music.mark2:Can't find local music with MPD
Nov 26 08:41:06 localhost.localdomain python[625]: Traceback (most recent call last):
Nov 26 08:41:06 localhost.localdomain python[625]:   File "/opt/mycroft-dinkum/skills/play-music.mark2/__init__.py", line 87, in handle_play_jukebox
Nov 26 08:41:06 localhost.localdomain python[625]:     self._mpd_playlist = list(self.mpd_client.random_play())
Nov 26 08:41:06 localhost.localdomain python[625]:   File "/opt/mycroft-dinkum/skills/play-music.mark2/skill/__init__.py", line 77, in random_play
Nov 26 08:41:06 localhost.localdomain python[625]:     duration_sec=self._time_to_seconds(time_str),
Nov 26 08:41:06 localhost.localdomain python[625]:   File "/opt/mycroft-dinkum/skills/play-music.mark2/skill/__init__.py", line 139, in _time_to_seconds
Nov 26 08:41:06 localhost.localdomain python[625]:     seconds = int(parts[0])
Nov 26 08:41:06 localhost.localdomain python[625]: ValueError: invalid literal for int() with base 10: ''

The problem is that mpd has not analysed those files and posted a time for them. And for some reason it always chose one of those!

I’ve removed those files from my library now and the random play “play jukebox” now seems to work.

Suggest the code checks for a null time_str and sets a default either in the procedure or before. Not sure that mpd can play mid files, so perhaps there ought to be some sort of check for valid file types?

I’m still unable to request a specific track though I’ll try that next.

1 Like

Still not able to get it to play a single track, only the “play jukebox” seems to work.

I can see from the DEBUG messages in the journal that mpc return the correct track.

Only (multiple) Error message is this:

Nov 27 12:46:28 localhost.localdomain startx[690]: Invalid skill_id in mycroft.session.set: "play-music.mark2.audio_player_mark_ii.qml"

It looks the major moving part is found here on: mycroft-dinkum/__init__.py at master · MycroftAI/mycroft-dinkum · GitHub

 def search(self, query: str):
        """Searches by artist, album, then song title.
        """
        command_type = "search"
        for query_type in ["artist", "album", "title"]:
            results = self._search(command_type, query_type, query)
            for artist, album, title, time_str, relative_path in results:
                song_path = self.music_dir / relative_path
                if song_path.is_file():
                    yield Song(
                        artist=artist,
                        album=album,
                        title=title,
                        duration_sec=self._time_to_seconds(time_str),
                        file_path=song_path,
                    )
                else:
                    LOG.warning("Missing file: %s", song_path)

So the code checks if the ${music_name} passed in is the name of an artist, album or track.
But those keywords aren’t parsed out. So if you say “Play album Abbey Road”, I believe the word “album” will also be searched for - if so, not good.

The Emby skill did parse some of those keywords, but not quite so many. I forked it, added more extensive parsing, and wrote much more code for playlists, here: https://github.com/mike99mac/emby-skill-mike99mac

I did a couple of videos too: https://www.youtube.com/watch?v=Crre3LWnQ0Q and https://www.youtube.com/watch?v=udE66fLkNxY

I’m wondering if that skill can be modified to use mpc/mpd rather than Emby (mpc may be easier, and also, Emby is no longer FOSS :frowning_face:).

Thoughts?

-Mike Mac

The code offers the last part of the query string (it strips of the "play or “listen”) to the mpc search routine up to 3 times, once as an artist, once as an album and once as a title. It returns (yields) the result(s) which are valid files. This means that “play the beatles” should return a list of beatles tracks across multiple albums . “Play Abbey Road” should return a set of tracks from that album and “play Silver” should just return one track. You can run mpc from the command line to see that. Also the code higher up logs the Result of the call and shows that it is working thus far. However after that it fails silently and mysteriously to play anything. “play jukebox” on the other hand plays a stream of random selections successfully.

My very first try used a USB key onto which I loaded just a couple of albums. This seemed to work fine, playing individual tracks and also selections from a specific Artist and specific Album. After I loaded all my music onto the USB drive it failed to work. Since then I’ve found that it fails on .mid files (see above) and also zip files containing music files, which probably accounts for why the full USB drive failed to work. I guess I should return to a full USB Drive and see if that works now, which would indicate that the problem is with the NFS drive characteristics and not the skill itself. I’ve done my best to compare the code used to play the “play jukebox” versus “play the beatles” and though I can see that the correct tracks are returned from mpc/mpd in both cases I cannot determine why the not jukebox command does not work!!

Your comments about the emby skill are very relevant and I certainly would like to see those enhancements in this skill. However until I can get it to play in the current mode I think we would be wasting our time enhancing it.

My main reason for paying silly money (inc the extra UK VAT!) for this device was exactly to be able to pull up music tracks to play!

PS - the version of mpd in use is 0.21, a version which is no longer supported by the developers. Another of my plans is to update to 0.23 (available from the debian unstable repo).