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, PlexMediaServer.metadata(video_section.get('ratingKey')), PlexMediaServer.client(player_section.get('machineIdentifier'))) session.save() return session
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, PlexMediaServer.metadata(video_section.get('ratingKey')), PlexMediaServer.client(player_section.get('machineIdentifier')) ) session.save() return session
def test(cls): # Try enable logging if not PlexMediaServer.set_logging_state(True): Log.Warn('Unable to enable logging') # Test if logging is enabled if not PlexMediaServer.get_logging_state(): Log.Warn('Debug logging not enabled, unable to use logging activity method.') return False if cls.try_read(True): return True return False
def test(cls): if PlexMediaServer.request('status/sessions', catch_exceptions=True) is None: Log.Info("Error while retrieving sessions, assuming WebSocket method isn't available") return False server_info = PlexMediaServer.request(catch_exceptions=True) if not server_info: Log.Info('Error while retrieving server info for testing') return False multi_user = bool(server_info.get('multiuser', 0)) if not multi_user: Log.Info("Server info indicates multi-user support isn't available, WebSocket method not available") return False return True
def test(cls): if PlexMediaServer.request('status/sessions', catch_exceptions=True) is None: Log.Info( "Error while retrieving sessions, assuming WebSocket method isn't available" ) return False server_info = PlexMediaServer.request(catch_exceptions=True) if not server_info: Log.Info('Error while retrieving server info for testing') return False multi_user = bool(server_info.get('multiuser', 0)) if not multi_user: Log.Info( "Server info indicates multi-user support isn't available, WebSocket method not available" ) return False return True
def create_session(self, info): return WatchSession.from_info( info, PlexMediaServer.metadata(info['ratingKey']), PlexMediaServer.client(info.get('client_id')) )
def create_session(self, info): return WatchSession.from_info( info, PlexMediaServer.metadata(info['ratingKey']), PlexMediaServer.client(info.get('client_id')))