support systems using python version less than 2.7 (such as Mac)

This commit is contained in:
im85288 2015-03-21 09:03:43 +00:00
parent 7c7b4b375f
commit 78bc187c1f
1 changed files with 10 additions and 4 deletions

View File

@ -12,8 +12,6 @@ import time
from calendar import timegm from calendar import timegm
from datetime import datetime from datetime import datetime
from xml.etree.ElementTree import Element, SubElement, Comment, tostring from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from xml.etree import ElementTree from xml.etree import ElementTree
from xml.dom import minidom from xml.dom import minidom
@ -24,6 +22,7 @@ from API import API
import Utils as utils import Utils as utils
from ReadEmbyDB import ReadEmbyDB from ReadEmbyDB import ReadEmbyDB
addon = xbmcaddon.Addon(id='plugin.video.mb3sync') addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addondir = xbmc.translatePath(addon.getAddonInfo('profile')) addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
dataPath = os.path.join(addondir,"library") dataPath = os.path.join(addondir,"library")
@ -238,7 +237,14 @@ class CreateFiles():
SubElement(actor_elem, "type").text = utils.convertEncoding(actor.get("Role")) SubElement(actor_elem, "type").text = utils.convertEncoding(actor.get("Role"))
SubElement(actor_elem, "thumb").text = downloadUtils.imageUrl(actor.get("Id"), "Primary", 0, 400, 400) SubElement(actor_elem, "thumb").text = downloadUtils.imageUrl(actor.get("Id"), "Primary", 0, 400, 400)
ET.ElementTree(root).write(nfoFile, xml_declaration=True) # Some devices such as Mac are using an older version of python
try:
# 2.7 and greater
ET.ElementTree(root).write(nfoFile, xml_declaration=True)
except:
# <2.7
ET.ElementTree(root).write(nfoFile)
return changes return changes