Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timestamp of RecentlyPlayed change during rollover
10-02-2024, 23:28
Post: #1
Timestamp of RecentlyPlayed change during rollover
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.
Find all posts by this user
Quote this message in a reply
11-02-2024, 08:28
Post: #2
RE: Timestamp of RecentlyPlayed change during rollover
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.
Find all posts by this user
Quote this message in a reply
12-02-2024, 12:53
Post: #3
RE: Timestamp of RecentlyPlayed change during rollover
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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)