Merge remote-tracking branch 'refs/remotes/origin/master' into develop

This commit is contained in:
angelblue05 2016-10-31 06:32:10 -05:00
commit 590c3ef4c3
5 changed files with 14 additions and 10 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.emby" <addon id="plugin.video.emby"
name="Emby" name="Emby"
version="2.3.1" version="2.3.2"
provider-name="Emby.media"> provider-name="Emby.media">
<requires> <requires>
<import addon="xbmc.python" version="2.19.0"/> <import addon="xbmc.python" version="2.19.0"/>

View file

@ -34,12 +34,15 @@ class Credentials(object):
if self.credentials is None: if self.credentials is None:
try: try:
with open(os.path.join(self.path, 'data.txt')) as infile: with open(os.path.join(self.path, 'data.txt')) as infile:
self.credentials = json.load(unicode(infile)) self.credentials = json.load(infile)
if not isinstance(self.credentials, dict):
raise ValueError("invalid credentials format")
except Exception as e: # File is either empty or missing except Exception as e: # File is either empty or missing
log.warn(e) log.warn(e)
self.credentials = {} self.credentials = {}
log.info("credentials initialized with: %s" % self.credentials) log.info("credentials initialized with: %s" % self.credentials)
self.credentials['Servers'] = self.credentials.setdefault('Servers', []) self.credentials['Servers'] = self.credentials.setdefault('Servers', [])
@ -54,7 +57,9 @@ class Credentials(object):
self.credentials = data self.credentials = data
# Set credentials to file # Set credentials to file
with open(os.path.join(self.path, 'data.txt'), 'w') as outfile: with open(os.path.join(self.path, 'data.txt'), 'w') as outfile:
json.dump(unicode(data), outfile, indent=4, ensure_ascii=False) for server in data['Servers']:
server['Name'] = server['Name'].encode('utf-8')
json.dump(data, outfile, ensure_ascii=False)
else: else:
self._clear() self._clear()

View file

@ -372,7 +372,7 @@ def addUser():
result = doUtils.downloadUrl(url) result = doUtils.downloadUrl(url)
try: try:
additionalUsers = result[0]['AdditionalUsers'] additionalUsers = result[0]['AdditionalUsers']
except (KeyError, TypeError) as error: except (IndexError, KeyError, TypeError) as error:
log.error(error) log.error(error)
additionaluser = [] additionaluser = []

View file

@ -490,7 +490,7 @@ class Music(Items):
except TypeError: except TypeError:
# No album found, create a single's album # No album found, create a single's album
log.info("Failed to add album. Creating singles.") log.info("Failed to add album. Creating singles.")
album_id = self.kodi_db.create_entry_album() albumid = self.kodi_db.create_entry_album()
if self.kodi_version == 16: if self.kodi_version == 16:
self.kodi_db.add_single(albumid, genre, year, "single") self.kodi_db.add_single(albumid, genre, year, "single")

View file

@ -276,7 +276,7 @@ class PlaybackUtils():
externalsubs.append(path) externalsubs.append(path)
except Exception as e: except Exception as e:
log.error(e) log.error(e)
continue externalsubs.append(url)
else: else:
externalsubs.append(url) externalsubs.append(url)
@ -298,12 +298,11 @@ class PlaybackUtils():
try: try:
response = requests.get(src, stream=True) response = requests.get(src, stream=True)
response.encoding = 'utf-8'
response.raise_for_status() response.raise_for_status()
except Exception as e: except Exception as e:
del response
raise raise
else: else:
response.encoding = 'utf-8'
with open(path, 'wb') as f: with open(path, 'wb') as f:
f.write(response.content) f.write(response.content)
del response del response