MinimServer Forum
Timestamp of RecentlyPlayed change during rollover - Printable Version

+- MinimServer Forum (https://forum.minimserver.com)
+-- Forum: MinimServer (/forumdisplay.php?fid=1)
+--- Forum: Support (/forumdisplay.php?fid=4)
+--- Thread: Timestamp of RecentlyPlayed change during rollover (/showthread.php?tid=7168)



Timestamp of RecentlyPlayed change during rollover - simbun - 10-02-2024 23:28

Hi @simoncn,

I'm using played-files.txt to keep a history of everything that's played, which is generally working well except that when the log rolls over (based on the recentPlayed= option) the timestamp of previously played tracks changes, that throws of my diff logic.

In the following example I had set recentPlayed to 5 to speed up testing.
Code:
...
2024-02-10 21:52:03.486 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.02.flac
2024-02-10 21:55:10.859 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.03.flac
2024-02-10 21:55:56.297 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.04.flac
2024-02-10 21:56:19.734 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.05.flac
2024-02-10 21:59:23.108 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.06.flac
## LOGROTATE HERE
2024-02-10 21:55:11.049 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.03.flac
2024-02-10 21:55:56.489 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.04.flac
2024-02-10 21:56:19.929 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.05.flac
2024-02-10 21:59:23.297 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.06.flac
2024-02-10 21:59:46.442 /media/music/flac/Lady Gaga/2018 - A Star Is Born/CD01/01.07.flac
You can see that the rotated played-files.txt contains the 4 previous tracks as well as the new one, and that the timestamps of the previous tracks have changed slightly.

It's a strange one.


RE: Timestamp of RecentlyPlayed change during rollover - simoncn - 11-02-2024 08:28

This might be caused by multiple reads of the same file by the renderer in a short space of time. For example, some renderers read the file and then immediately close it and read it again. In this case, MinimServer writes the time of the first read when it happens and also stores this time in memory. When the second read happens, MinimServer updates the last played time in memory but does not write a second entry to the played-files.txt file.

If something then happens to cause MinimServer to completely rewrite the played-files.txt file, the time of the second read will be written. As the purpose of this file is to enable recently played files to be sorted in the order of playing, a small difference in the timestamps doesn't matter.


RE: Timestamp of RecentlyPlayed change during rollover - simbun - 12-02-2024 12:53

Ok that makes sense.
In real-world use removing the time element for diff purposes should suffice - although annoyingly it's trivial to create scenarios (looping the same tracks over and over) where the logic would break down without the addition of extra, messy checks.

Thanks Simon.