TheQwertiest / foo_discord_rich

foobar2000 component for integration with Discord Rich Presence
https://theqwertiest.github.io/foo_discord_rich/
MIT License
405 stars 40 forks source link

Periodically refresh text fields #50

Closed bsdinis1 closed 3 weeks ago

bsdinis1 commented 10 months ago

I am using the following for the Top section: [%album artist% - ][%date% - ][%album%][ '['$meta(DISCID)']'][ '['Disc %discnumber%/%totaldiscs%']'] | [%codec%]$if($info(hdcd),' HDCD') [%bitrate%]kbps $if($stricmp($info(encoding),lossless),[%__bitspersample%]bit,) $div(%samplerate%,1000)$replace($insert($right($div(%samplerate%,100),1),.,0),.0,)kHz

This piece of code $if($info(hdcd),' HDCD') only shows "HDCD" when I manually select a track to play, when the track ends and the next one starts playing automatically, "HDCD" is no longer shown until I manually select a track to play.

The same applies to the shown bitdepth $if($stricmp($info(encoding),lossless),[%__bitspersample%]bit,), it shows "24-bit" when track is manually selected, but the tracks that play automatically will only show "16-bit".

incorrect HDCD info image

correct HDCD info when I manually change to that same track image

RadegasTCZ commented 10 months ago

Might be coz it sends data at the beginning and doesn't update it afterwards, the same thing I have with streamed audio when the bitrate is reported only while decoding so doesn't get updated. Auto-update period would likely fix that I think but there isn't any :(

TheQwertiest commented 1 month ago

Auto-update period would likely fix that

I might add auto-update (radio seems to be a valid use-case), but it will be really far from real-time updates, since Discord only allows to update status once per 15 seconds.

RadegasTCZ commented 1 month ago

once/15sec is perfectly fine in my opinion, it could also benefit from some routine when it detects if there are variables, such as bitrate or HDCD, radio station updates song title and whatnot and then have that 15 second delay if that's possible

TheQwertiest commented 1 month ago

Note to self: track name change (e.g. radio) is already handle by on_playback_dynamic_info_track