Ticket #13510: mythtv-13510-Several_TV_metadata_retrievals_are_failing.patch

File mythtv-13510-Several_TV_metadata_retrievals_are_failing.patch, 3.2 KB (added by steveerl, 4 years ago)

Fix for metadata retrieval failure

  • mythtv/bindings/python/MythTV/ttvdb/tvdb_api.py

    diff --git a/mythtv/bindings/python/MythTV/ttvdb/tvdb_api.py b/mythtv/bindings/python/MythTV/ttvdb/tvdb_api.py
    index 5d3a1755a7..a4e158b1bc 100644
    a b class Tvdb: 
    958958        banners = {}
    959959        for cur_banner in bannersEt.keys():
    960960            banners_info = self._getetsrc(self.config['url_seriesBannerInfo'] % (sid, cur_banner))
    961             for banner_info in banners_info:
    962                 bid = banner_info.get('id')
    963                 btype = banner_info.get('keyType')
    964                 btype2 = banner_info.get('resolution')
    965                 if btype is None or btype2 is None:
    966                     continue
    967 
    968                 if btype not in banners:
    969                     banners[btype] = {}
    970                 if btype2 not in banners[btype]:
    971                     banners[btype][btype2] = {}
    972                 if bid not in banners[btype][btype2]:
    973                     banners[btype][btype2][bid] = {}
    974 
    975                 banners[btype][btype2][bid]['bannerpath'] = banner_info['fileName']
    976                 banners[btype][btype2][bid]['resolution'] = banner_info['resolution']
    977                 banners[btype][btype2][bid]['subKey'] = banner_info['subKey']
    978 
    979                 for k, v in list(banners[btype][btype2][bid].items()):
    980                     if k.endswith("path"):
    981                         new_key = "_%s" % k
    982                         log().debug("Transforming %s to %s" % (k, new_key))
    983                         new_url = self.config['url_artworkPrefix'] % v
    984                         banners[btype][btype2][bid][new_key] = new_url
    985 
    986             banners[btype]['raw'] = banners_info
    987             self._setShowData(sid, "_banners", banners)
     961            if banners_info is not None:
     962                for banner_info in banners_info:
     963                    bid = banner_info.get('id')
     964                    btype = banner_info.get('keyType')
     965                    btype2 = banner_info.get('resolution')
     966                    if btype is None or btype2 is None:
     967                        continue
     968
     969                    if btype not in banners:
     970                        banners[btype] = {}
     971                    if btype2 not in banners[btype]:
     972                        banners[btype][btype2] = {}
     973                    if bid not in banners[btype][btype2]:
     974                        banners[btype][btype2][bid] = {}
     975
     976                    banners[btype][btype2][bid]['bannerpath'] = banner_info['fileName']
     977                    banners[btype][btype2][bid]['resolution'] = banner_info['resolution']
     978                    banners[btype][btype2][bid]['subKey'] = banner_info['subKey']
     979
     980                    for k, v in list(banners[btype][btype2][bid].items()):
     981                        if k.endswith("path"):
     982                            new_key = "_%s" % k
     983                            log().debug("Transforming %s to %s" % (k, new_key))
     984                            new_url = self.config['url_artworkPrefix'] % v
     985                            banners[btype][btype2][bid][new_key] = new_url
     986
     987                banners[btype]['raw'] = banners_info
     988                self._setShowData(sid, "_banners", banners)
    988989
    989990    def _parseActors(self, sid):
    990991        """Parsers actors XML, from