Play from genre not working (Raspberry)

Hi all I’m new here and I’m not shure is it a bug or not.
I have installed Volumio 2.861 on a Raspberry 4b.

My music library is very big and exacly tagged with genre and AlbumArtists. So I would use the genre to browse into the library. The problem is, when I press add to que or play on a complete album nothing is doing. When I start from a artist or album all is ok with the same album.

Now i have search a little bit in index.js from mpd and found follow mistakes (I think it’s a mistake):
The genre tag is using with quotation marks around the value but in the function prototype.explodeUri the quotation marks around the genre replaced with escaped quotation marks. The filled variable safeGenreName is used in find string GetMatches. But in this variable also quotation marks exist. So around the genre are escaped quotation marks and regular quotation marks from GetMatches string.
And so nothing is found and nothing is play, genre is not found.
I have change one line in this function and remove the quotation marks and play complete album from genre is now working

Here is the changed part of ControllerMpd.prototype.explodeUri = function (uri)
in /volumio/app/plugins/music_service/mpd/index.js

} else if (uri.startsWith('genres://')) {
    // exploding search
    var splitted = uri.split('/');
    var genreName = decodeURIComponent(splitted[2]);
    var artistName = decodeURIComponent(splitted[3]);
    var albumName = decodeURIComponent(splitted[4]);
    // Escape any " within the strings used to construct the 'find' cmd
	// ------ fix genre quotation marks ----------
	//var safeGenreName = genreName.replace(/"/g, '\\"');
    var safeGenreName = genreName.replace(/"/g, '');
    // ------ fix genre quotation marks end ------
	var safeArtistName = artistName.replace(/"/g, '\\"');
    var safeAlbumName = albumName.replace(/"/g, '\\"');

    if (splitted.length == 4) {
      var GetMatches = 'find genre "' + safeGenreName + '" artist "' + safeArtistName + '"';
    } else if (splitted.length == 5) {
      if (compilation.indexOf(artistName) > -1) { // artist is in compilation array so only find album
        var GetMatches = 'find genre "' + safeGenreName + '" album "' + safeAlbumName + '"';
      } else { // artist is NOT in compilation array so use artist
        var GetMatches = 'find genre "' + safeGenreName + '" albumartist "' + safeArtistName + '" album "' + safeAlbumName + '"';
      }
    } else {
      var GetMatches = 'find genre "' + safeGenreName + '"';
    }

This is my workaround but I think its better you can reproduce this issue and fix in your source.

best regards
2aCD

I am experiencing the same issue: cannot play a track or album from within the genre browser. Version 2.861.

I fixed this by removing the ugly encaps of genre in uri. See my commit on github.com: https://github.com/janbar/Volumio2/commit/f21ef5d1f54ce9cef5b0b0d722bb144321066c51

Thanks guys. Please can you send a Pull Request so we test and merge? Thanks!

Sure !

My PR est #2046

Thanks a lot, for fix it.
I have another little suggestion published here:

genre with albumartist

This allow us to use the albumartist also in genre view, if the albumartist selected in settings.
Important for big libraries :wink:

1 Like

Oki, I add a new commit to include the pointed change/fix about sort by artist/albumartist.

1 Like

Thanks! We’ll test and merge it asap!

Hi guys, the change is completed. It wasn’t as simple than the proposed change, because the uri “genre://” must be exploded with the right rule. but now it works. Enjoy.

Thanks for bringing this up and for your efforts, @2aCD and @janbar. Using Volumio with the current play by genre bug is quite frustrating …

Unfortunately I do not know how to apply the modified code. Work and kids do not really allow for teaching mysel how to. So I am hoping desperately for this to be fixed. (At) volumio, could you please let us know if we can hope for this to be solved in the next release?

THANKS and all the best
Santelmo

Thank your so much @volumio for fixing this in the latest version. Deeply appreciated.

It’s a pleasure!