Skip to content

Commit

Permalink
Fixed an issue with session media changes when "buffering" events are…
Browse files Browse the repository at this point in the history
… received
  • Loading branch information
fuzeman committed Mar 14, 2016
1 parent 0298f68 commit 98ed454
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
IGNORED_EVENTS = [
'buffering',
'error',
'play'
]
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
from plugin.scrobbler.core.constants import IGNORED_EVENTS

import logging

log = logging.getLogger(__name__)

IGNORED_EVENTS = [
'buffering',
'error',
'play'
]


class Engine(object):
handlers = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from plugin.managers.action import ActionManager
from plugin.managers.session.s_logging import LSessionManager
from plugin.scrobbler.core import SessionEngine
from plugin.scrobbler.core.constants import IGNORED_EVENTS
from plugin.scrobbler.methods.core.base import Base

from datetime import datetime, timedelta
Expand Down Expand Up @@ -73,6 +74,10 @@ def to_events(cls, session, info):
log.warn('Event has an invalid state %r', state)
return []

if state in IGNORED_EVENTS:
log.debug('Ignored "%s" event: %r', state, info)
return []

# Validate `view_offset`
view_offset = to_integer(info.get('viewOffset'))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from plugin.core.helpers.variable import to_integer
from plugin.managers.action import ActionManager
from plugin.managers.session.s_websocket import WSessionManager
from plugin.scrobbler.core.constants import IGNORED_EVENTS
from plugin.scrobbler.core.engine import SessionEngine
from plugin.scrobbler.methods.core.base import Base

Expand Down Expand Up @@ -76,6 +77,10 @@ def to_events(cls, session, info):
log.warn('Event has an invalid state %r', state)
return []

if state in IGNORED_EVENTS:
log.debug('Ignored "%s" event: %r', state, info)
return []

# Check for session `view_offset` jump
if cls.session_jumped(session, info.get('viewOffset')):
return []
Expand Down

0 comments on commit 98ed454

Please sign in to comment.