Open Phaet opened 1 year ago
After giving it a quick thought, I think I would do something like that on a running rdmlcd :
iddleimage.png
iddleimage.png
into /usr/local/etc/rdmlcd/iddleimage.png
processChanges
in /usr/local/etc/rdmlcd/utils/moodelistener.js
: moode_listener.prototype.processChanges = function(key,data){
if( ["title", "artist", "album"].includes(key) ){
this.formatMainString();
this.emit( "trackChange", this.formatedMainString );
if(this.state === "play") this.resetIdleTimeout(); // sinon les webradios sortent l'écran de veille
}
else if(key === "state"){
+ if(data === "stop"){
+ this.data.coverurl = "./iddleimage.png"; // set the iddle default image as the current cover
+ this.emit("coverChange", "./iddleimage.png"); // print the default image on the display
+ this.formatedMainString = ""; // empty the text field for trackname / artist / album
+ this.emit( "trackChange", "" ); // print the empty text field on the display
+ }
+ else{
+ this.formatMainString(); // regenerate text field for trackname / artist / album
+ this.emit( "trackChange", this.formatedMainString ); // print the non-empty text field for trackname / artist / album on the display
+ }
this.state = data;
this.resetIdleTimeout();
this.emit( "stateChange", data );
}
else if( ["song_percent", "time", "elapsed"].includes(key)){
this.seekFormat();
this.emit( "seekChange", this.formatedSeek );
}
else if(key === "bitrate"){
this.emit( "bitRateChange", data );
this.emit( "line2", "Bit Rate : " + data );
}
else if(key === "volume"){
this.resetIdleTimeout();
this.emit( "volumeChange", data );
}
else if(key === "audio_sample_rate"){
this.emit( "sampleRateChange", data );
this.emit( "line0", "Sample Rate : " + data );
}
else if(key === "audio_sample_depth"){
this.emit( "sampleDepthChange", data );
this.emit( "line1", "Sample Depth : " + data );
}
else if(key === "coverurl"){
+ if(this.data.state === "stop"){
+ this.data.coverurl = "./iddleimage.png"; // if playback is stopped, cancel the cover update and reset the default iddle image as current cover
+ return;
+ }
if(data === 'sudo: /var/www/util/upnp_albumart.py: command not found'){
this.getFallbackCoverFromMeta();
return;
}
if ( /http:\/\//.test(data) ){
this.emit( "coverChange",data );
return;
}
if(data[0] !== "/") data = "/"+data;
this.emit( "coverChange","http://"+this.host+data );
}
else if(key === "file"){
this.emit( "file", data );
}
else if(key === "audio_channels"){
this.emit( "channelsChange", data );
this.emit( "line3", "Channels : " + data );
}
else if(key === "encoded"){
let pdata = data.replace(/audio/gi, "");
this.emit( "encodingChange", pdata );
this.emit( "line4", "Track Type : " + pdata );
}
else if(key === "song"){
let pdata = parseInt(data)+1;
this.emit( "songIdChange", pdata );
this.emit( "line5", "Playlist : " + pdata + " / " + this.data.playlistlength );
}
else if(key === "repeat"){
this.emit( "repeatChange", data );
this.emit( "line6", "Repeat : " + data );
}
};
(don't forget to remove the "+" on line starts if you copy-paste)
Obviously I don't have all the possible scenarios in mind and doing this may possibly cause weird behavior with external music services. But that should be a good start.
and of course sudo systemctl restart rdmlcd
after you are done.
Hey great. Thanks for the speed of light reply. This is exactly what I am looking for and should do the trick. I'll drop a note as soon as it is working.
Works smoothly :smiley: Thanks a lot!
Hi, this is not an issue or a bug. I just want to ask a question:
I extended the lirc config so that I can use my RC, mainly to select radio stations from a dedicated playlist by means of the number keys.
I also want to use the stop button (■) mapping it to 'mpc stop'. But then the display still shows the logo of the previously played station.
Could you please give me a hint, where to modify your lcd code to show sort of idle logo?
Thanks in advance.