![]() |
[SOLVED] currentsong.txt is updated too often - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7) +--- Thread: [SOLVED] currentsong.txt is updated too often (/showthread.php?tid=6239) Pages:
1
2
|
currentsong.txt is updated too often - AkelGe - 02-19-2024 Hello all, I have just found that on 8.3.8 the file Code: /var/local/www/currentsong.txt is updated also when the player is in pause or stop mode. Dunno when this change was introduced exactly, I was not checking the file in the prev version, but now I started working again on a personal project to drive some peripherals based on the status of moode and I realised that the file is updated every 3 seconds, roughly. I think it is related to the fact that the current bitrate has been added to that file, nice addition, but that should happen only while playing and the file should not be updated when the player is paused or stopped, that's quite useless and can wear out microSD faster. I will try to take a look at the code and see if I can pass a patch here, but in the meantime I would like to hear from developers RE: currentsong.txt is updated too often - AkelGe - 02-19-2024 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 RE: currentsong.txt is updated too often - AkelGe - 02-19-2024 I went a bit further and I created https://github.com/moode-player/moode/pull/655 RE: currentsong.txt is updated too often - Tim Curtis - 02-19-2024 (02-19-2024, 11:50 AM)AkelGe Wrote: I went a bit further and I created https://github.com/moode-player/moode/pull/655 Nice :-) I'll look at it later this morning. RE: currentsong.txt is updated too often - Nutul - 02-19-2024 (02-19-2024, 11:27 AM)AkelGe Wrote: Here is the patch 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. RE: currentsong.txt is updated too often - Nutul - 02-19-2024 Actually, looking at the code right now: the $['outrate'] field is checked against being different from $hwParamsFormat . $hwParamsCalcrate, but then is being assigned ONLY $hwParamsCalcrate, hence it is always different; so just assign the same $hwParamsFormat . $hwParamsCalcrate to it few lines below. RE: currentsong.txt is updated too often - Tim Curtis - 02-19-2024 In looking that code section there appear to be a number of issues. I'll make a commit tomorrow. @AkelGe and @Nutul, Let me know how it works. RE: currentsong.txt is updated too often - grumbleweed - 02-21-2024 As I was bored I manually edited the suggested pull into new 8.3.8 install and started getting random lost mpd output device issues. Using a RME usb dac. I reverted back, no issues hence. RE: currentsong.txt is updated too often - Tim Curtis - 02-21-2024 (02-19-2024, 11:08 PM)Tim Curtis Wrote: In looking that code section there appear to be a number of issues. I'll make a commit tomorrow. Here is the commit https://github.com/moode-player/moode/commit/68ba3f672b8834fdc74a5d8f0b8cb882f06fe5b1 You might also want to look at the other two from today. RE: currentsong.txt is updated too often - AkelGe - 02-25-2024 (02-21-2024, 11:49 PM)Tim Curtis Wrote:(02-19-2024, 11:08 PM)Tim Curtis Wrote: In looking that code section there appear to be a number of issues. I'll make a commit tomorrow. I would really love to test it, do you have suggestions on a quick way to test it? I am on the official code, I am not working on a git clone. |