def create_session(self, session_key, state): """ :type session_key: str :type state: str :rtype: WatchSession or None """ Log.Debug("Creating a WatchSession for the current media") video_section = PMS.get_video_session(session_key) if not video_section: return None player_section = video_section.findall("Player") if len(player_section): player_section = player_section[0] session = WatchSession.from_section( video_section, state, PMS.metadata(video_section.get("ratingKey")), PMS.client(player_section.get("machineIdentifier")), ) session.save() return session
def create_session(self, info): client = None if info.get('machineIdentifier'): client = PMS.client(info['machineIdentifier']) else: Log.Info('No machineIdentifier available, client filtering not available') return WatchSession.from_info( info, PMS.metadata(info['ratingKey']), client )