Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: currentsong.txt is updated too often
#5
(02-19-2024, 11:27 AM)AkelGe Wrote: Here is the patch

in file /var/www/daemon/worker.php, line 1732

replace

PHP Code:
if ($current['title'] != $fileMeta['title'] || $current['album'] != $fileMeta['album'] || $_SESSION['volknob'] != $fileMeta['volume'] || $_SESSION['volmute'] != $fileMeta['mute'] || $current['state'] != $fileMeta['state'] || $fileMeta['outrate'] != $hwParamsFormat $hwParamsCalcrate) { 



with


PHP Code:
if ($current['title'] != $fileMeta['title'] || $current['album'] != $fileMeta['album'] || $_SESSION['volknob'] != $fileMeta['volume'] || $_SESSION['volmute'] != $fileMeta['mute'] || $current['state'] != $fileMeta['state'] || $fileMeta['outrate'] != $current['output'] . $hwParamsCalcrate || $fileMeta['bitrate'] != $current['bitrate']) { 

This way the comparison is exactly identical and we keep in account the bitrate too.

With this the currentsong.txt file is updated ONLY when there are changes and if the status is paused or stopped, there is no update

Although it works (and I have no idea why, TTYTT) it looks to me not the best way (logically) to fix it.

I would check for $current['state'] being 'playing' (or whatever it is while moOde is actually playing (that is, neither PAUSED nor STOPPED).
It's weird, as there is already a check for the ['status'] having to be different for the update to take place, but maybe once stopped the other fields are not getting changed, so to speak, the $current data is set to empty strings, but for some reason the $fileMeta is not, resulting in the fields always being different at the end of the playing queue...
Just wandering in the wild here, not looking at the code; maybe will later today.
Reply


Messages In This Thread
currentsong.txt is updated too often - by AkelGe - 02-19-2024, 09:44 AM
RE: currentsong.txt is updated too often - by Nutul - 02-19-2024, 12:49 PM

Forum Jump: