mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
a few more places we need to check for exceptions
This commit is contained in:
parent
4c9408b640
commit
f793f709ef
4 changed files with 37 additions and 16 deletions
|
@ -114,12 +114,13 @@ class DownloadUtils(object):
|
|||
|
||||
# Attempt at getting sessionId
|
||||
url = "{server}/emby/Sessions?DeviceId=%s&format=json" % device_id
|
||||
result = self.downloadUrl(url)
|
||||
|
||||
try:
|
||||
result = self.downloadUrl(url)
|
||||
session_id = result[0]['Id']
|
||||
|
||||
except (KeyError, TypeError):
|
||||
log.error("Failed to retrieve the session id.")
|
||||
except Exception as error:
|
||||
log.error("Failed to retrieve the session id: " + str(error))
|
||||
|
||||
else:
|
||||
log.info("SessionId: %s", session_id)
|
||||
|
|
|
@ -58,9 +58,13 @@ class Embydb_Functions():
|
|||
def getView_embyId(self, item_id):
|
||||
# Returns ancestors using embyId
|
||||
url = "{server}/emby/Items/%s/Ancestors?UserId={UserId}&format=json" % item_id
|
||||
|
||||
try:
|
||||
view_list = self.download(url)
|
||||
if view_list is None:
|
||||
except Exception as error:
|
||||
log.info("Error getting views: " + str(error))
|
||||
view_list = []
|
||||
|
||||
for view in view_list:
|
||||
|
||||
if view['Type'] == "CollectionFolder":
|
||||
|
|
|
@ -285,9 +285,9 @@ def addUser():
|
|||
|
||||
# Get session
|
||||
url = "{server}/emby/Sessions?DeviceId=%s&format=json" % deviceId
|
||||
result = doUtils.downloadUrl(url)
|
||||
|
||||
try:
|
||||
result = doUtils.downloadUrl(url)
|
||||
sessionId = result[0]['Id']
|
||||
additionalUsers = result[0]['AdditionalUsers']
|
||||
# Add user to session
|
||||
|
@ -365,8 +365,8 @@ def addUser():
|
|||
icon="special://home/addons/plugin.video.emby/icon.png",
|
||||
time=1000)
|
||||
|
||||
except:
|
||||
log.error("Failed to add user to session.")
|
||||
except Exception as error:
|
||||
log.error("Failed to add user to session: " + str(error))
|
||||
dialog.notification(
|
||||
heading=lang(29999),
|
||||
message=lang(33068),
|
||||
|
@ -381,10 +381,11 @@ def addUser():
|
|||
window('EmbyAdditionalUserImage.%s' % i, clear=True)
|
||||
|
||||
url = "{server}/emby/Sessions?DeviceId=%s&format=json" % deviceId
|
||||
result = doUtils.downloadUrl(url)
|
||||
|
||||
try:
|
||||
result = doUtils.downloadUrl(url)
|
||||
additionalUsers = result[0]['AdditionalUsers']
|
||||
except (IndexError, KeyError, TypeError) as error:
|
||||
except Exception as error:
|
||||
log.error(error)
|
||||
additionalUsers = []
|
||||
|
||||
|
@ -692,8 +693,13 @@ def createListItemFromEmbyItem(item,art=artwork.Artwork(),doUtils=downloadutils.
|
|||
#listitem setup for pictures...
|
||||
img_path = allart.get('Primary')
|
||||
li.setProperty("path",img_path)
|
||||
try:
|
||||
picture = doUtils.downloadUrl("{server}/Items/%s/Images" %itemid)
|
||||
if picture:
|
||||
except Exception as error:
|
||||
lof.info("Error getting images from server: " + str(error))
|
||||
picture = None
|
||||
|
||||
if picture is not None:
|
||||
picture = picture[0]
|
||||
if picture.get("Width") > picture.get("Height"):
|
||||
li.setArt( {"fanart": img_path}) #add image as fanart for use with skinhelper auto thumb/backgrund creation
|
||||
|
@ -781,8 +787,13 @@ def BrowseChannels(itemid, folderid=None):
|
|||
else:
|
||||
url = "{server}/emby/Channels/%s/Items?UserId={UserId}&format=json" % itemid
|
||||
|
||||
try:
|
||||
result = doUtils.downloadUrl(url)
|
||||
if result and result.get("Items"):
|
||||
except Exception as error:
|
||||
log.info("Error getting channel: " + str(error))
|
||||
result = None
|
||||
|
||||
if result is not None and result.get("Items"):
|
||||
for item in result.get("Items"):
|
||||
itemid = item['Id']
|
||||
itemtype = item['Type']
|
||||
|
|
|
@ -87,7 +87,12 @@ class LibrarySync(threading.Thread):
|
|||
if settings('serverSync') == "true":
|
||||
# Try to use fast start up
|
||||
url = "{server}/emby/Plugins?format=json"
|
||||
|
||||
try:
|
||||
result = self.doUtils(url)
|
||||
except Exception as error:
|
||||
log.info("Error getting plugin list form server: " + str(error))
|
||||
result = []
|
||||
|
||||
for plugin in result:
|
||||
if plugin['Name'] == "Emby.Kodi Sync Queue":
|
||||
|
|
Loading…
Reference in a new issue