Skip to content

Commit

Permalink
Make sure we properly account for active users
Browse files Browse the repository at this point in the history
  • Loading branch information
steeve committed Nov 10, 2013
1 parent bb3a94d commit b5251bb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions resources/site-packages/xbmctorrent/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

TORRENT2HTTP_TIMEOUT = 20
TORRENT2HTTP_POLL = 500
PLAYING_EVENT_INTERVAL = 60

WINDOW_FULLSCREEN_VIDEO = 12005

Expand Down Expand Up @@ -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.")

0 comments on commit b5251bb

Please sign in to comment.