From e7335b05a0a63a0509c707862421a13a52ea5945 Mon Sep 17 00:00:00 2001
From: angelblue05 <tamara.angel05@gmail.com>
Date: Thu, 6 Aug 2015 21:30:15 -0500
Subject: [PATCH] Fix error caused when starting from widget

.get to avoid key error. Didn't think about the playback error from
widgets.
---
 resources/lib/Player.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/resources/lib/Player.py b/resources/lib/Player.py
index 81d95a84..0331e719 100644
--- a/resources/lib/Player.py
+++ b/resources/lib/Player.py
@@ -198,8 +198,8 @@ class Player( xbmc.Player ):
                 track_query = '{"jsonrpc": "2.0", "method": "Player.GetProperties",  "params": {"playerid":1,"properties": ["currentsubtitle","currentaudiostream","subtitleenabled"]} , "id": 1}'
                 result = xbmc.executeJSONRPC(track_query)
                 result = json.loads(result)
-                indexAudio = result['result']['currentaudiostream']['index']
-                indexSubs = result['result']['currentsubtitle']['index']
+                indexAudio = result['result']['currentaudiostream'].get('index', "")
+                indexSubs = result['result']['currentsubtitle'].get('index', "")
                 subsEnabled = result['result']['subtitleenabled']
 
                 # Convert back into an Emby index
@@ -320,8 +320,8 @@ class Player( xbmc.Player ):
                 track_query = '{"jsonrpc": "2.0", "method": "Player.GetProperties",  "params": {"playerid": 1,"properties": ["currentsubtitle","currentaudiostream","subtitleenabled"]} , "id": 1}'
                 result = xbmc.executeJSONRPC(track_query)
                 result = json.loads(result)
-                indexAudio = result['result']['currentaudiostream']['index']
-                indexSubs = result['result']['currentsubtitle']['index']
+                indexAudio = result['result']['currentaudiostream'].get('index', "")
+                indexSubs = result['result']['currentsubtitle'].get('index', "")
                 subsEnabled = result['result']['subtitleenabled']
 
                 postdata['AudioStreamIndex'] = indexAudio + 1