mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
Merge pull request #98 from TrueTechy/file-default-encoding
Add explicit file encoding to file handlers
This commit is contained in:
commit
1670836c6a
1 changed files with 3 additions and 3 deletions
|
@ -333,7 +333,7 @@ def get_sync():
|
||||||
xbmcvfs.mkdirs(path)
|
xbmcvfs.mkdirs(path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(path, 'sync.json')) as infile:
|
with open(os.path.join(path, 'sync.json'), encoding='utf-8') as infile:
|
||||||
sync = json.load(infile)
|
sync = json.load(infile)
|
||||||
except Exception:
|
except Exception:
|
||||||
sync = {}
|
sync = {}
|
||||||
|
@ -354,7 +354,7 @@ def save_sync(sync):
|
||||||
|
|
||||||
sync['Date'] = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
|
sync['Date'] = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
with open(os.path.join(path, 'sync.json'), 'w') as outfile:
|
with open(os.path.join(path, 'sync.json'), 'w', encoding='utf-8') as outfile:
|
||||||
data = json.dumps(sync, sort_keys=True, indent=4, ensure_ascii=False)
|
data = json.dumps(sync, sort_keys=True, indent=4, ensure_ascii=False)
|
||||||
outfile.write(unicode(data))
|
outfile.write(unicode(data))
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ def get_credentials():
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(path, 'data.txt')) as infile:
|
with open(os.path.join(path, 'data.txt'), encoding='utf-8') as infile:
|
||||||
credentials = json.load(infile)
|
credentials = json.load(infile)
|
||||||
save_credentials(credentials)
|
save_credentials(credentials)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue