mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 18:26:15 +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)
|
result = json.loads(message)
|
||||||
message_type = result['MessageType']
|
message_type = result['MessageType']
|
||||||
data = result['Data']
|
|
||||||
|
|
||||||
if message_type not in ('NotificationAdded', 'SessionEnded', 'RestartRequired',
|
if message_type not in ('NotificationAdded', 'SessionEnded', 'RestartRequired',
|
||||||
'PackageInstalling'):
|
'PackageInstalling'):
|
||||||
|
@ -75,21 +74,26 @@ class WebSocketClient(threading.Thread):
|
||||||
|
|
||||||
if message_type == 'Play':
|
if message_type == 'Play':
|
||||||
# A remote control play command has been sent from the server.
|
# A remote control play command has been sent from the server.
|
||||||
|
data = result['Data']
|
||||||
self._play(data)
|
self._play(data)
|
||||||
|
|
||||||
elif message_type == 'Playstate':
|
elif message_type == 'Playstate':
|
||||||
# A remote control update playstate command has been sent from the server.
|
# A remote control update playstate command has been sent from the server.
|
||||||
|
data = result['Data']
|
||||||
self._playstate(data)
|
self._playstate(data)
|
||||||
|
|
||||||
elif message_type == "UserDataChanged":
|
elif message_type == "UserDataChanged":
|
||||||
# A user changed their personal rating for an item, or their playstate was updated
|
# A user changed their personal rating for an item, or their playstate was updated
|
||||||
|
data = result['Data']
|
||||||
userdata_list = data['UserDataList']
|
userdata_list = data['UserDataList']
|
||||||
self.library_sync.triage_items("userdata", userdata_list)
|
self.library_sync.triage_items("userdata", userdata_list)
|
||||||
|
|
||||||
elif message_type == "LibraryChanged":
|
elif message_type == "LibraryChanged":
|
||||||
|
data = result['Data']
|
||||||
self._library_changed(data)
|
self._library_changed(data)
|
||||||
|
|
||||||
elif message_type == "GeneralCommand":
|
elif message_type == "GeneralCommand":
|
||||||
|
data = result['Data']
|
||||||
self._general_commands(data)
|
self._general_commands(data)
|
||||||
|
|
||||||
elif message_type == "ServerRestarting":
|
elif message_type == "ServerRestarting":
|
||||||
|
@ -97,6 +101,7 @@ class WebSocketClient(threading.Thread):
|
||||||
|
|
||||||
elif message_type == "UserConfigurationUpdated":
|
elif message_type == "UserConfigurationUpdated":
|
||||||
# Update user data set in userclient
|
# Update user data set in userclient
|
||||||
|
data = result['Data']
|
||||||
userclient.UserClient().get_user(data)
|
userclient.UserClient().get_user(data)
|
||||||
self.library_sync.refresh_views = True
|
self.library_sync.refresh_views = True
|
||||||
|
|
||||||
|
@ -149,10 +154,11 @@ class WebSocketClient(threading.Thread):
|
||||||
}
|
}
|
||||||
if command == 'Seek':
|
if command == 'Seek':
|
||||||
|
|
||||||
seek_to = data['SeekPositionTicks']
|
if player.isPlaying():
|
||||||
seek_time = seek_to / 10000000.0
|
seek_to = data['SeekPositionTicks']
|
||||||
player.seekTime(seek_time)
|
seek_time = seek_to / 10000000.0
|
||||||
log.info("Seek to %s", seek_time)
|
player.seekTime(seek_time)
|
||||||
|
log.info("Seek to %s", seek_time)
|
||||||
|
|
||||||
elif command in actions:
|
elif command in actions:
|
||||||
actions[command]()
|
actions[command]()
|
||||||
|
|
Loading…
Reference in a new issue