From ec931f516716824eb4b1d364443831b88453eeee Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sat, 25 Apr 2026 09:46:21 +0200 Subject: [PATCH] write only existing files to playcoutner --- modules/play_counter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/play_counter.py b/modules/play_counter.py index c2eb90e..210caa3 100644 --- a/modules/play_counter.py +++ b/modules/play_counter.py @@ -28,7 +28,8 @@ class Module(PlayerModule): try: temp_file = self.file.with_suffix('.tmp') with open(temp_file, 'w') as f: - for k, v in sorted(self.counts.items()): f.write(f"{k}:{v}\n") + for k, v in sorted(self.counts.items()): + if Path(k).exists(): f.write(f"{k}:{v}\n") temp_file.replace(self.file) 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: