From b3f43f956ec25ca93a60b1a6128bdb6823c49b21 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Thu, 13 Oct 2016 21:43:38 -0700 Subject: [PATCH] Add delay to check for valid DLNA session --- plexpy/activity_handler.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plexpy/activity_handler.py b/plexpy/activity_handler.py index 9bc65211..909c3f5a 100644 --- a/plexpy/activity_handler.py +++ b/plexpy/activity_handler.py @@ -71,6 +71,14 @@ class ActivityHandler(object): def on_start(self): if self.is_valid_session() and self.get_live_session(): session = self.get_live_session() + + # Some DLNA clients create a new session temporarily when browsing the library + # Wait and get session again to make sure it is an actual session + if session['platform'] == 'DLNA': + time.sleep(1) + session = self.get_live_session() + if not session: + return logger.debug(u"PlexPy ActivityHandler :: Session %s started by user %s with ratingKey %s." % (str(session['session_key']), str(session['user_id']), str(session['rating_key'])))