diff --git a/resources/site-packages/xbmctorrent/player.py b/resources/site-packages/xbmctorrent/player.py index e6c2a36..99bdc76 100644 --- a/resources/site-packages/xbmctorrent/player.py +++ b/resources/site-packages/xbmctorrent/player.py @@ -13,6 +13,7 @@ TORRENT2HTTP_TIMEOUT = 20 TORRENT2HTTP_POLL = 500 +PLAYING_EVENT_INTERVAL = 60 WINDOW_FULLSCREEN_VIDEO = 12005 @@ -212,11 +213,16 @@ def loop(self): # We are now playing plugin.log.info("Now playing torrent...") + last_playing_event = 0 with closing(OverlayText(w=OVERLAY_WIDTH, h=OVERLAY_HEIGHT, alignment=XBFONT_CENTER_X | XBFONT_CENTER_Y)) as overlay: with nested(self.attach(overlay.show, self.on_playback_paused), self.attach(overlay.hide, self.on_playback_resumed, self.on_playback_stopped)): while not xbmc.abortRequested and self.isPlaying(): overlay.text = "\n".join(self._get_status_lines(t2h("status"))) + now = time.time() + if (now - last_playing_event) > PLAYING_EVENT_INTERVAL: + track_event("video", "playing", self.magnet_display_name) + last_playing_event = now xbmc.sleep(TORRENT2HTTP_POLL) plugin.log.info("Closing Torrent player.")