Fix KeyError in library sync
This commit is contained in:
parent
fa7bc1285e
commit
5be1e3a24a
3 changed files with 11 additions and 9 deletions
|
@ -396,6 +396,7 @@
|
|||
<string id="39307">Enter PIN for user </string>
|
||||
<string id="39308">Could not log in user </string>
|
||||
<string id="39309">Please try again.</string>
|
||||
<string id="39310">unknown</string>
|
||||
|
||||
<!-- Plex Librarysync.py -->
|
||||
<string id="39400">Library sync thread has crashed. You should restart Kodi now. Please report this on the forum</string>
|
||||
|
|
|
@ -328,6 +328,7 @@
|
|||
<string id="39307">PIN eingeben für Benutzer </string>
|
||||
<string id="39308">Anmeldung fehlgeschlagen für Benutzer </string>
|
||||
<string id="39309">Bitte erneut versuchen.</string>
|
||||
<string id="39310">unbekannt</string>
|
||||
|
||||
<!-- Plex Librarysync.py -->
|
||||
<string id="39400">Die Synchronisierung der Plex Bibliotheken ist abgestürzt. Bitte Kodi neu starten. Danke, wenn Sie sich die Zeit nehmen und im Plex Forum vom Absturz berichten.</string>
|
||||
|
|
|
@ -1428,6 +1428,8 @@ class API():
|
|||
self.part = 0
|
||||
self.clientinfo = clientinfo.ClientInfo()
|
||||
self.clientId = self.clientinfo.getDeviceId()
|
||||
self.__language__ = xbmcaddon.Addon().getLocalizedString
|
||||
|
||||
self.userId = utils.window('emby_currUser')
|
||||
self.server = utils.window('emby_server%s' % self.userId)
|
||||
self.token = utils.window('emby_accessToken%s' % self.userId)
|
||||
|
@ -2007,21 +2009,19 @@ class API():
|
|||
elif mediaType == 2: # Audio streams
|
||||
audiotrack = {}
|
||||
audiotrack['codec'] = mediaStream['codec'].lower()
|
||||
profile = mediaStream['codecID'].lower()
|
||||
profile = mediaStream.get('codecID', '').lower()
|
||||
if "dca" in audiotrack['codec'] and "dts-hd ma" in profile:
|
||||
audiotrack['codec'] = "dtshd_ma"
|
||||
audiotrack['channels'] = mediaStream.get('channels')
|
||||
try:
|
||||
audiotrack['language'] = mediaStream.get('language')
|
||||
except KeyError:
|
||||
audiotrack['language'] = 'unknown'
|
||||
# 'unknown' if we cannot get language
|
||||
audiotrack['language'] = mediaStream.get(
|
||||
'language', self.__language__(39310))
|
||||
audiotracks.append(audiotrack)
|
||||
|
||||
elif mediaType == 3: # Subtitle streams
|
||||
try:
|
||||
subtitlelanguages.append(mediaStream['language'])
|
||||
except:
|
||||
subtitlelanguages.append("Unknown")
|
||||
# 'unknown' if we cannot get language
|
||||
subtitlelanguages.append(
|
||||
mediaStream.get('language', self.__language__(39310)))
|
||||
return {
|
||||
'video': videotracks,
|
||||
'audio': audiotracks,
|
||||
|
|
Loading…
Reference in a new issue