From 7bc8cd1bee3638040ba42acd7808434ea846e561 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 8 Nov 2023 09:18:55 +0100 Subject: [PATCH] log file played --- player/player.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/player/player.py b/player/player.py index f53795f..6a434a1 100755 --- a/player/player.py +++ b/player/player.py @@ -5,6 +5,7 @@ import socket import collections import time from threading import Thread +from datetime import datetime import mpv @@ -33,6 +34,7 @@ class Sync(Thread): ready = False destination = "255.255.255.255" reload_check = None + _pos = None def __init__(self, *args, **kwargs): self.is_main = kwargs.get('mode', 'main') == 'main' @@ -91,6 +93,14 @@ class Sync(Thread): self.send_position_local() elif self.ready: self.adjust_position() + if self._pos != self.mpv.playlist_current_pos: + self._pos = self.mpv.playlist_current_pos + if self._pos != -1: + try: + track = self.mpv.playlist[self._pos] + logger.error("%s %s", datetime.now(), track["filename"]) + except: + pass def reload_playlist(self): if not self.reload_check: