Hey lostmyshape! Thanks for trying it out.
I was trying to do the counter in a “smarter” way and I broke the plugin. I think I’m going to leave it alone for now. I have another working solution but I think it will add overhead and complication to a simple counter. Does everything have to be complicated to work better? Maybe the simple, “global” variable is best? This is one structure I could change it to:
function SimpleCounter() {
var i = 0;
return {
count: function () { return i++; },
reset: function () { i = 0; }
};
}
var self.c = SimpleCounter();
self.c.count();
self.c.count();
self.c.reset(); // new song
self.c.count(); // etc.
It still would be a global counter but would be “safer”. I also toyed with putting the counter in the interval timer (logical place), but I’m unsure on passing the counter value to the pushSongState function. The counter would (could) be called with:
var stateTimer = new StateCounter(pushSongState, [songArray[0]], duration);
In the timer the argument would have to be appended with the counter variable maintained in the timer instance. That is, pushState would then have two arguments, the song argument and the counter argument.
I like thinking about good solutions but maybe it’s just an academic point? I wasn’t a developer by trade; I converted databases (which was never pretty). I would never waste time with this stuff – my applications only supported me and most of them could not be reused again. But trying to do things the right way is never a bad thing.
What seems to be happening is that the control goes to MPD when the player is paused. Before I was force-feeding tags to MPD for album, title and artist, there was only the URL of the song that was playing. No other track information was shown.
Looking at the Volumio code, I see this line and this line but I’m not sure if they apply.
There doesn’t seem to be a tag for the album artwork listed on the mpd website so I can’t force-feed that information like I did for the other data.
To my eyes, it looks like the artwork is not being read from the state. But that would not explain why the album, title, and artist are not read from the state, either (and why I have to force-feed their tags with an mpd command). I took a look at getAlbumArt() but I’m not sure that applies here.
I tried doing the QueueItem hack that Marco used in his plugin but that isn’t working, either. I’ll keep trying things. I have some other stuff going on this weekend but I’ll take another look after that.