Here's a Snippet to Add Browse Files to Queue

Hi,
I just found out about Pi MusicBox and I love it, thank you!! I realized you couldn’t add files to the Queue when browsing, so I messed around with the webclient code and got something that works:

In process_ws.js, line 99, I added an anchor tag to the end of the child in processBrowseDir, when the type = track. Here’s the snippet:

        child += '<li id="browselisttracks-' + resultArr[i].uri + '"><a href="#" class="browsetrack" onclick="return playBrowsedTracks(0, this.id);" id="' + 
	resultArr[i].uri + '"><h1 class="trackname"><i class="' + iconClass + '"></i> ' + resultArr[i].name + '</h1></a>' + 
	'<a href="#" class="moreBtn" onclick="toast(\'Added to Queue\');return mopidy.tracklist.add(null, null, \'' + resultArr[i].uri + '\');"><i class="fa fa-plus"></i></a></li>';

That last anchor tag just does a toast and tells mopidy to add the file to the queue (tracklist)

Any chance we can get this in?

Thanks very much for taking the time to help improve musicbox. This feature was recently added (see https://github.com/woutervanwijk/Mopidy-MusicBox-Webclient/pull/82) so if you upgrade to the latest version of the Webclient you should get it. You can do this by running pip install --upgrade Mopidy-MusicBox-Webclient.

The webclient should be safe to update but don’t update the other parts as most of them require the new 1.0 version of Mopidy which we don’t support in Musicbox (yet).

If you do any more enhancements we’ll be very glad to have them, just have a check on github first. Raising an issue (and then ideally submitting a Pull Request to fix it) on there is the best way to get fixes into the project. Thanks again.

Actually my answer above is wrong. Even the webclient is tricky to update right now as the latest version has some changes that are incompatible with Musicbox. It can be done but I’ll need to check, if you are happy with your current solution maybe best stick with that.

Aw crap I didn’t think to check github first! Thanks for the heads up, I’ll absolutely check that first next time and use it for any enhancements. Thanks!

Just merged that change into my copy of the 0.6RC image… works awesome, thanks!

@kingosticks

Just merged the feature to 0.6 as well. Thanks for providing the commit!

Just curious: in the new web interface, will those controls also be on the higher levels in addition to track level?

That way, you could for example add all songs of a certain album, artist, etc.

This would be especially nice in the folder hierarchy as it would then allow to add all files from a folder somewhere in the hierarchy. This makes sense for albums that have several subfolder (CD1 & CD2) and it would even allow adding ALL files to the tracklist by executing it on root folder level:

Hmm i think that commit is all that’s currently in there with regards to
this. But your idea is a good one, maybe create an issue in the
musicbox-webclient issue tracker?

Ok done:

Add queue management to all hierarchy levels of local files #96