Revert "Fix subtitle languages showing up as unknown"

This reverts commit 345a24f896.
This commit is contained in:
croneter 2017-10-02 17:36:54 +02:00
parent 345a24f896
commit cb285f97e7
2 changed files with 2 additions and 64 deletions

View file

@ -2369,15 +2369,11 @@ class API():
# ext = stream.attrib.get('format') # ext = stream.attrib.get('format')
if key: if key:
# We do know the language - temporarily download # We do know the language - temporarily download
if stream.attrib.get('languageCode') is not None: if stream.attrib.get('language') is not None:
try:
language = v.LANGUAGECODE_TO_LANGUAGE[stream.attrib['languageCode']]
except KeyError:
language = stream.attrib['languageCode']
path = self.download_external_subtitles( path = self.download_external_subtitles(
"{server}%s" % key, "{server}%s" % key,
"subtitle%02d.%s.%s" % (fileindex, "subtitle%02d.%s.%s" % (fileindex,
language, stream.attrib['language'],
stream.attrib['codec'])) stream.attrib['codec']))
fileindex += 1 fileindex += 1
# We don't know the language - no need to download # We don't know the language - no need to download

View file

@ -21,66 +21,8 @@ def tryDecode(string, encoding='utf-8'):
string = string.decode() string = string.decode()
return string return string
# When does Plex mark a video as completely played?
MARK_PLAYED_AT = 0.9 MARK_PLAYED_AT = 0.9
# Matching table for using Plex XML's stream 'languageCode'
LANGUAGECODE_TO_LANGUAGE = {
'afr': 'Afrikaans',
'ara': 'Arabic',
'hye': 'Armenian',
'bul': 'Bulgarian',
'cat': 'Catala',
'chi': 'Mandarin',
'hrv': 'Hrvatski',
'cze': 'Cesky',
'dan': 'Dansk',
'dut': 'Nederlands',
'eng': 'English',
'epo': 'Esperanto',
'fin': 'Suomi',
'fre': 'Francais',
'ger': 'Deutsch',
'geo': 'Georgian',
'gre': 'Greek',
'heb': 'Hebrew',
'hin': 'Hindi',
'hun': 'Magyar',
'ind': 'Bahasa Indonesia',
'gle': 'Gaeilge',
'ice': 'Islenska',
'ita': 'Italiano',
'jpn': 'Japanese',
'kor': 'Korean',
'kur': 'Kurdi',
'lat': 'Latin',
'mac': 'Macedonian',
'may': 'Malay',
'mlt': 'Malti',
'nep': 'Nepali',
'nor': 'Norsk',
'per': 'Persian',
'pol': 'Polszczyzna',
'por': 'Portugues',
'rum': 'Romana',
'rus': 'Russian',
'srp': 'Serbian',
'gla': 'Gaidhlig',
'slo': 'Slovencina',
'slv': 'Slovenski Jezik',
'spa': 'Espanol',
'swe': 'Svenska',
'tam': 'Tamil',
'tha': 'Thai',
'tur': 'Turkish',
'tah': 'Tahitian',
'ukr': 'Ukrainian',
'uzb': 'Ozbek',
'vie': 'Tieng Viet',
'wel': 'Cymraeg',
'yid': 'Yiddish',
}
_ADDON = Addon() _ADDON = Addon()
ADDON_NAME = 'PlexKodiConnect' ADDON_NAME = 'PlexKodiConnect'
ADDON_ID = 'plugin.video.plexkodiconnect' ADDON_ID = 'plugin.video.plexkodiconnect'