mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 02:23:38 +00:00
Change storing metadata nfo vars from int to strings to resolve lxml type exceptions that don't occur with etree.
This commit is contained in:
parent
c65d29adeb
commit
62cae67170
2 changed files with 18 additions and 17 deletions
|
@ -52,6 +52,7 @@
|
||||||
* Change adding show processing to be highest priority
|
* Change adding show processing to be highest priority
|
||||||
* Use timezones to check unaired status during show update/adding
|
* Use timezones to check unaired status during show update/adding
|
||||||
* Fix syntax error causing renamer to error out
|
* Fix syntax error causing renamer to error out
|
||||||
|
* Change storing metadata nfo vars from int to strings to resolve lxml type exceptions that don't occur with etree
|
||||||
|
|
||||||
|
|
||||||
### 0.11.11 (2016-04-05 19:20:00 UTC)
|
### 0.11.11 (2016-04-05 19:20:00 UTC)
|
||||||
|
|
|
@ -21,7 +21,7 @@ from __future__ import with_statement
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
import xml.etree.cElementTree as etree
|
import xml.etree.cElementTree as etree
|
||||||
|
@ -32,7 +32,7 @@ import re
|
||||||
|
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
|
||||||
from sickbeard import exceptions, helpers
|
from sickbeard import helpers
|
||||||
from sickbeard.metadata import helpers as metadata_helpers
|
from sickbeard.metadata import helpers as metadata_helpers
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard import encodingKludge as ek
|
from sickbeard import encodingKludge as ek
|
||||||
|
@ -282,40 +282,40 @@ class GenericMetadata():
|
||||||
|
|
||||||
def update_show_indexer_metadata(self, show_obj):
|
def update_show_indexer_metadata(self, show_obj):
|
||||||
if self.show_metadata and show_obj and self._has_show_metadata(show_obj):
|
if self.show_metadata and show_obj and self._has_show_metadata(show_obj):
|
||||||
logger.log(
|
logger.log(u'Metadata provider %s updating show indexer metadata file for %s' % (self.name, show_obj.name),
|
||||||
u"Metadata provider " + self.name + " updating show indexer info metadata file for " + show_obj.name,
|
logger.DEBUG)
|
||||||
logger.DEBUG)
|
|
||||||
|
|
||||||
nfo_file_path = self.get_show_file_path(show_obj)
|
nfo_file_path = self.get_show_file_path(show_obj)
|
||||||
try:
|
try:
|
||||||
with ek.ek(open, nfo_file_path, 'r') as xmlFileObj:
|
with ek.ek(open, nfo_file_path, 'r') as xmlFileObj:
|
||||||
showXML = etree.ElementTree(file=xmlFileObj)
|
show_xml = etree.ElementTree(file=xmlFileObj)
|
||||||
|
|
||||||
indexer = showXML.find('indexer')
|
indexer = show_xml.find('indexer')
|
||||||
indexerid = showXML.find('id')
|
indexerid = show_xml.find('id')
|
||||||
|
|
||||||
root = showXML.getroot()
|
root = show_xml.getroot()
|
||||||
|
show_indexer = str(show_obj.indexer)
|
||||||
if None is not indexer:
|
if None is not indexer:
|
||||||
indexer.text = show_obj.indexer
|
indexer.text = show_indexer
|
||||||
else:
|
else:
|
||||||
etree.SubElement(root, "indexer").text = str(show_obj.indexer)
|
etree.SubElement(root, 'indexer').text = show_indexer
|
||||||
|
|
||||||
|
show_indexerid = str(show_obj.indexerid)
|
||||||
if None is not indexerid:
|
if None is not indexerid:
|
||||||
indexerid.text = show_obj.indexerid
|
indexerid.text = show_indexerid
|
||||||
else:
|
else:
|
||||||
etree.SubElement(root, "id").text = str(show_obj.indexerid)
|
etree.SubElement(root, 'id').text = show_indexerid
|
||||||
|
|
||||||
# Make it purdy
|
# Make it purdy
|
||||||
helpers.indentXML(root)
|
helpers.indentXML(root)
|
||||||
|
|
||||||
showXML.write(nfo_file_path)
|
show_xml.write(nfo_file_path)
|
||||||
helpers.chmodAsParent(nfo_file_path)
|
helpers.chmodAsParent(nfo_file_path)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logger.log(
|
logger.log(u'Unable to write file %s - is the folder writable? %s' % (nfo_file_path, ex(e)),
|
||||||
u"Unable to write file to " + nfo_file_path + " - are you sure the folder is writable? " + ex(e),
|
logger.ERROR)
|
||||||
logger.ERROR)
|
|
||||||
|
|
||||||
def create_fanart(self, show_obj):
|
def create_fanart(self, show_obj):
|
||||||
if self.fanart and show_obj and not self._has_fanart(show_obj):
|
if self.fanart and show_obj and not self._has_fanart(show_obj):
|
||||||
|
|
Loading…
Reference in a new issue