mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
some messages dont have data
This commit is contained in:
parent
749dd8575c
commit
cf6380ef1f
1 changed files with 11 additions and 5 deletions
|
@ -66,7 +66,6 @@ class WebSocketClient(threading.Thread):
|
|||
|
||||
result = json.loads(message)
|
||||
message_type = result['MessageType']
|
||||
data = result['Data']
|
||||
|
||||
if message_type not in ('NotificationAdded', 'SessionEnded', 'RestartRequired',
|
||||
'PackageInstalling'):
|
||||
|
@ -75,21 +74,26 @@ class WebSocketClient(threading.Thread):
|
|||
|
||||
if message_type == 'Play':
|
||||
# A remote control play command has been sent from the server.
|
||||
data = result['Data']
|
||||
self._play(data)
|
||||
|
||||
elif message_type == 'Playstate':
|
||||
# A remote control update playstate command has been sent from the server.
|
||||
data = result['Data']
|
||||
self._playstate(data)
|
||||
|
||||
elif message_type == "UserDataChanged":
|
||||
# A user changed their personal rating for an item, or their playstate was updated
|
||||
data = result['Data']
|
||||
userdata_list = data['UserDataList']
|
||||
self.library_sync.triage_items("userdata", userdata_list)
|
||||
|
||||
elif message_type == "LibraryChanged":
|
||||
data = result['Data']
|
||||
self._library_changed(data)
|
||||
|
||||
elif message_type == "GeneralCommand":
|
||||
data = result['Data']
|
||||
self._general_commands(data)
|
||||
|
||||
elif message_type == "ServerRestarting":
|
||||
|
@ -97,6 +101,7 @@ class WebSocketClient(threading.Thread):
|
|||
|
||||
elif message_type == "UserConfigurationUpdated":
|
||||
# Update user data set in userclient
|
||||
data = result['Data']
|
||||
userclient.UserClient().get_user(data)
|
||||
self.library_sync.refresh_views = True
|
||||
|
||||
|
@ -149,6 +154,7 @@ class WebSocketClient(threading.Thread):
|
|||
}
|
||||
if command == 'Seek':
|
||||
|
||||
if player.isPlaying():
|
||||
seek_to = data['SeekPositionTicks']
|
||||
seek_time = seek_to / 10000000.0
|
||||
player.seekTime(seek_time)
|
||||
|
|
Loading…
Reference in a new issue