Browse Source

Merge branch 'feature/FixKodiMetadataPy3' into develop

pull/1289/head
JackDandy 5 years ago
parent
commit
8e64ab2acd
  1. 1
      CHANGES.md
  2. 10
      lib/sg_helpers.py
  3. 4
      sickbeard/metadata/kodi.py

1
CHANGES.md

@ -137,6 +137,7 @@
* Fix "Update shows on startup" (change update_shows_on_start = 0 in config.ini, restart SG, then update)
* Fix Plex notifier, PY2 urllib2.urlopen has no `with` context manager and six.moves.urllib.request.urlopen does not provide
* Fix hidden items on browse show page with new id system
* Change ensure Kodi metadata is consistently a text string type
### 0.20.18 (2019-12-30 12:15:00 UTC)

10
lib/sg_helpers.py

@ -16,7 +16,7 @@ import traceback
import encodingKludge as ek
from exceptions_helper import ex
from _23 import filter_list, html_unescape, urlparse, urlunparse
from six import iteritems, string_types
from six import iteritems, string_types, text_type
from lib.cachecontrol import CacheControl, caches
from cfscrape import CloudflareScraper
import requests
@ -557,8 +557,12 @@ def write_file(filepath, # type: AnyStr
else:
data.write(fh)
else:
with ek.ek(io.FileIO, filepath, w_mode) as fh:
fh.write(data)
if isinstance(data, text_type):
with ek.ek(io.open, filepath, w_mode, encoding='utf-8') as fh:
fh.write(data)
else:
with ek.ek(io.FileIO, filepath, w_mode) as fh:
fh.write(data)
chmod_as_parent(filepath)

4
sickbeard/metadata/kodi.py

@ -26,7 +26,7 @@ import exceptions_helper
from exceptions_helper import ex
from lxml_etree import etree
from _23 import map_iter
from _23 import decode_str, map_iter
from six import string_types
# noinspection PyUnreachableCode
@ -219,7 +219,7 @@ class KODIMetadata(generic.GenericMetadata):
# output valid xml
# data = etree.ElementTree(tv_node)
# output non valid xml that Kodi accepts
data = etree.tostring(tv_node)
data = decode_str(etree.tostring(tv_node))
parts = data.split('episodeguide')
if 3 == len(parts):
data = 'episodeguide'.join([parts[0], parts[1].replace('"', '"'), parts[2]])

Loading…
Cancel
Save