I’m using Volumio 2.201 and I’m having an issue with the Album View not displaying album contents.
I’ve got two examples where I think the problem is that Album View doesn’t convert non-alphanumeric characters into hex codes properly. For example. when I try to look at Back in Black by AC/DC. I can see from the logs that it’s using the non-escaped version of “AC/DC”:
CURURI: albums://AC/DC/Back%20in%20Black
whereas when I look at the album through Artist View, then it uses the properly escaped version:
CURURI: artists://AC%2FDC/Back%20in%20Black
I’ve got another example which I think may be related to the same issue - but this time it happens through both Album and Artist view. I’ve got an album called 12" / 80’s / Dance and it doesn’t show any track listings. Both views just throw an error in the logs:
info: CURURI: albums://Various/12%22%20%2F%2080's%20%2F%20Dance
Error: [5@0] {} Invalid unquoted character
at MpdClient.receive (/volumio/app/plugins/music_service/mpd/lib/mpd.js:63:14)
at Socket.<anonymous> (/volumio/app/plugins/music_service/mpd/lib/mpd.js:43:10)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at Pipe.onread (net.js:548:20)
Could it be the apostrophe in 80’s that’s causing the issue?
EDIT: No, it’s not the apostrophe, because the album 80’s Soul Weekender works fine. Is there a way that I can find out exactly what is causing the “unquoted character” error - presumably it’s something in one of the album tracks? EDIT 2: It’s the quote mark (%22) in the album title - first I removed the spaces in the title (so it became 12%22%2F80’s%2FDance), but that just gave another error (Space expected after closing ‘"’), so then I changed the album title to 12inch/80’s/Dance and it worked fine. It seems that there’s an error in the way that quote marks in album titles (but, curiously, not track titles - all titles on the album contain quote marks) are handled.
I’ve narrowed this down to two things, both in the file /volumio/app/plugins/music_service/mpd/index.js
Firstly, the album/artist names, where they’re encoded, are encoded using nodetools.urlEncode - this doesn’t encode special characters like , / ? : @ & = + $ # because they’re valid parts of a URI. Instead, I’ve changed occurrences of this to encodeURIComponent, which does encode other special characters. Likewise, any occurrences of nodetools.urlDecode were changed to decodeURIComponent.
Secondly, in the function ControllerMpd.prototype.listAlbums, the album name is encoded, but not the artist name. So I added an extra line under “var codedAlbumName” (line 2616) and amended the album variable so it looks like:
var codedAlbumName = encodeURIComponent(albumName);
var codedArtistName = encodeURIComponent(artistName);
var album = {service:'mpd',type: 'folder', title: albumName, artist: artistName, albumart: self.getAlbumArt({artist:artistName,album:albumName}, undefined,'fa-dot-circle-o'), uri: 'albums://' + codedArtistName + '/' + codedAlbumName};
Both of these changes seem to have worked, and I can now browse my beloved AC/DC albums once more!