Skip to content

Commit

Permalink
Temporary fix for missing coverart for seasons from ttvdb.py
Browse files Browse the repository at this point in the history
If ttvdb.py does not return any coverart for specific seasons,
use the global coverart from series and patch the xml output.
  • Loading branch information
rcrdnalor committed Dec 8, 2020
1 parent 8d6eaf2 commit 735802a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mythtv/programs/scripts/metadata/Television/ttvdb.py
Expand Up @@ -2154,6 +2154,18 @@ def displaySeriesXML(tvdb_api, series_season_ep):

tvdbQueryXslt = etree.XSLT(etree.parse(u'%s%s' % (tvdb_api.baseXsltDir, u'tvdbVideo.xsl')))
items = tvdbQueryXslt(allDataElement)

# temporary fix for missing coverart: use global coverart from series
if len(items.xpath("//image[@type='coverart']")) == 0:
for el in allDataElement.iter("series"):
glob_poster = el.find("poster")
if glob_poster is not None:
glob_url = glob_poster.text
glob_thumb = glob_url.replace("posters", "_cache/posters")
glob_coverart = etree.Element("image", type = "coverart", url = glob_url, thumb = glob_thumb)
items.find("item").find("images").append(glob_coverart)
break

if items.getroot() is not None:
if len(items.xpath('//item')):
sys.stdout.write(etree.tostring(items, encoding='UTF-8', method="xml", xml_declaration=True, pretty_print=True, ))
Expand Down

0 comments on commit 735802a

Please sign in to comment.