0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 21:53:54 +01:00

save every play

This commit is contained in:
2025-12-02 16:34:58 +01:00
parent 5e0bc2c99c
commit 75802ccef4

View File

@@ -33,7 +33,7 @@ class Module(PlayerModule):
except Exception as e: self.logger.error(f"Failed to write play counts: {e}") except Exception as e: self.logger.error(f"Failed to write play counts: {e}")
def on_new_track(self, index: int, track: Track, next_track: Track | None) -> None: def on_new_track(self, index: int, track: Track, next_track: Track | None) -> None:
self.counts[track.path.as_posix()] = self.counts.get(track.path.as_posix(), 0) + 1 self.counts[track.path.as_posix()] = self.counts.get(track.path.as_posix(), 0) + 1
if sum(self.counts.values()) % 3 == 0: self._save_counts() self._save_counts()
def shutdown(self): def shutdown(self):
self._save_counts() self._save_counts()