Use existing device status objects #221
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #220
Reduce the amount of boilerplate code and make it easier to work with responses by breaking the various objects out.
Example original format
{ "0dc845e291374610b86d0d3ff62eedf8": { "info": { "name": "Receiver", "ip_address": "192.168.1.232", "locale": "en-US", "mac_address": "00:09:B0:3A:78:73", "ssid": "", "timezone": "America/Los_Angeles", "uptime": 2653424.930453, "ssdp_udn": "0dc845e2-9137-4610-b86d-0d3ff62eedf8" }, "app_id": "2DB7CC49", "display_name": "YouTube Music", "is_idle_screen": false, "status_text": "YouTube Music", "player_state": "PLAYING", "current_time": 24.241, "idle_reason": "", "current_item_id": 0, "loading_item_id": 0, "content_id": "p4lN2Jvl9RM", "content_type": "x-youtube/video", "stream_type": "BUFFERED", "duration": 212.861, "artist": "No Resolve", "title": "Surface Pressure", "subtitle": "", "volume_level": 0.48, "volume_muted": false, "media_volume_level": 0.48, "media_volume_muted": false, "session_id": "f8c0390f-f46a-4c08-895d-d15e93ab635b", "transport_id": "f8c0390f-f46a-4c08-895d-d15e93ab635b", "media_session_id": 1414705539, "player_state_id": 1 } }New output
{ "0dc845e291374610b86d0d3ff62eedf8": { "info": { "name": "Receiver", "ip_address": "192.168.1.232", "locale": "en-US", "mac_address": "00:09:B0:3A:78:73", "ssid": "", "timezone": "America/Los_Angeles", "uptime": 2654169.557301, "ssdp_udn": "0dc845e2-9137-4610-b86d-0d3ff62eedf8" }, "app": { "appId": "2DB7CC49", "displayName": "YouTube Music", "isIdleScreen": false, "sessionId": "f8c0390f-f46a-4c08-895d-d15e93ab635b", "statusText": "YouTube Music", "transportId": "f8c0390f-f46a-4c08-895d-d15e93ab635b" }, "media": { "mediaSessionId": 1414705539, "playerState": "PLAYING", "currentTime": 97.643, "idleReason": "", "volume": { "level": 0.48, "muted": false }, "currentItemId": 0, "loadingItemId": 0, "customData": { "playerState": 1 }, "media": { "contentId": "_E2V0OGEArU", "contentType": "x-youtube/video", "streamType": "BUFFERED", "duration": 210.701, "metadata": { "metadataType": 3, "artist": "Lauren Babic", "title": "Chandelier", "subtitle": "", "images": [ { "url": "https://lh3.googleusercontent.com/jfp2Z_W8p_hnjij4JmEDn2VkCiacneTK3fUvBWfk54ntywd9sR5SGzvfqPTIDA8bJWxR3Dw4nPB1_Ei9=w544-h544-l90-rj", "height": 544, "width": 544 }, { "url": "https://lh3.googleusercontent.com/jfp2Z_W8p_hnjij4JmEDn2VkCiacneTK3fUvBWfk54ntywd9sR5SGzvfqPTIDA8bJWxR3Dw4nPB1_Ei9=w302-h302-l90-rj", "height": 302, "width": 302 }, { "url": "https://lh3.googleusercontent.com/jfp2Z_W8p_hnjij4JmEDn2VkCiacneTK3fUvBWfk54ntywd9sR5SGzvfqPTIDA8bJWxR3Dw4nPB1_Ei9=w180-h180-l90-rj", "height": 180, "width": 180 }, { "url": "https://lh3.googleusercontent.com/jfp2Z_W8p_hnjij4JmEDn2VkCiacneTK3fUvBWfk54ntywd9sR5SGzvfqPTIDA8bJWxR3Dw4nPB1_Ei9=w120-h120-l90-rj", "height": 120, "width": 120 }, { "url": "https://lh3.googleusercontent.com/jfp2Z_W8p_hnjij4JmEDn2VkCiacneTK3fUvBWfk54ntywd9sR5SGzvfqPTIDA8bJWxR3Dw4nPB1_Ei9=w60-h60-l90-rj", "height": 60, "width": 60 } ], "releaseDate": "" } } }, "volume": { "level": 0.48, "muted": false } } }