Skip to content
Permalink
Browse files

monitor: Make skip interval configurable

This is the minimum percent jump in playing video which is required to
send the update to trakt. Helps reduce repeated scrobbles due to short
jumps.

Closes #15
  • Loading branch information...
iamkroot committed Jul 12, 2019
1 parent da46f3d commit a32b77ed6df3bb63b6749e575f8db168bd134b41
Showing with 6 additions and 3 deletions.
  1. +3 −2 sample_config.toml
  2. +3 −1 trakt_scrobbler/player_monitors/monitor.py
@@ -17,8 +17,9 @@ episode = [
'.*/(?P<title>.+?)\s*?(\[[0-9]{3,4}p\])?/(S|Season)\s?(?P<season>\d+)/(?P<episode>\d+).*', # matches "/a/b/Mob Psycho 100/Season 2/01 - Ripped Apart ~Someone Is Watching~.mkv"
]

[players] # list the required players here, decreasing order of priority
monitored = ['mpcbe', 'mpchc', 'mpv', 'vlc']
[players]
monitored = ['mpcbe', 'mpchc', 'mpv', 'vlc'] # list the required players here, decreasing order of priority
skip_interval = 5 # min percent jump to consider for scrobbling to trakt

[players.mpcbe] # enable web interface from options
ip = "localhost"
@@ -20,6 +20,7 @@ def __init__(self, scrobble_queue):
self.is_running = False
self.status = {}
self.prev_state = {}
self.skip_interval = config['players'].get('skip_interval', 5)

def parse_status(self):
if 'filepath' not in self.status or not self.status.get('duration'):
@@ -56,7 +57,8 @@ def scrobble_if_state_changed(self, prev, current):
if not prev or \
(current and (prev['state'] != current['state'] or
prev['media_info'] != current['media_info'] or
current['progress'] - prev['progress'] > 10)):
current['progress'] - prev['progress'] >
self.skip_interval)):
verb = SCROBBLE_VERBS[current['state']]
self.scrobble_queue.put((verb, current))

0 comments on commit a32b77e

Please sign in to comment.
You can’t perform that action at this time.