# Buggy code
def _parse_images(self, tvmaze_id):
    """Parse Show and Season posters.

    images are retrieved using t['show name]['_banners'], for example:

    >>> t = TVMaze(images = True)
    >>> t['scrubs']['_banners'].keys()
    ['fanart', 'poster', 'series', 'season']
    >>> t['scrubs']['_banners']['poster']['680x1000']['35308']['_bannerpath']
    u'http://theTMDB.com/banners/posters/76156-2.jpg'
    >>>

    Any key starting with an underscore has been processed (not the raw
    data from the XML)

    This interface will be improved in future versions.
    """
    logger.debug("Getting show banners for %s", [tvmaze_id])

    try:
        image_medium = self.shows[tvmaze_id]["image_medium"]
    except Exception:
        logger.debug("Could not parse Poster for showid: %s", [tvmaze_id])
        return False

    # Set the poster (using the original uploaded poster for now, as the medium formated is 210x195
    _images = {
        "poster": {
            "1014x1500": {
                "1": {
                    "rating": 1,
                    "language": "en",
                    "ratingcount": 1,
                    "bannerpath": image_medium.split("/")[-1],
                    "bannertype": "poster",
                    "bannertype2": "210x195",
                    "_bannerpath": image_medium,
                    "id": "1035106",
                }
            }
        }
    }

    season_images = self._parse_season_images(tvmaze_id)
    if season_images:
        _images.update(season_images)

    self._save_images(tvmaze_id, _images)
    self._set_show_data(tvmaze_id, "_banners", _images)


# Traceback (KeyError)
2017-03-24 13:09:12 DEBUG    SHOWQUEUE-UPDATE :: [b4a8a54] Using DVD ordering.
Exception in thread SHOWQUEUE-UPDATE:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner
self.run()
File "C:/Users/fernando/Documents/Medusa\medusa\show_queue.py", line 722, in run
self.show.load_from_indexer()
File "C:/Users/fernando/Documents/Medusa\medusa\tv\series.py", line 1211, in load_from_indexer
indexed_show = self.indexer_api[self.indexerid]
File "C:/Users/fernando/Documents/Medusa\medusa\indexers\indexer_base.py", line 254, in __getitem__
self._get_show_data(key, self.config['language'])
File "C:/Users/fernando/Documents/Medusa\medusa\indexers\tvmaze\tvmaze_api.py", line 432, in _get_show_data
self._get_episodes(tvmaze_id, specials=False, aired_season=None)
File "C:/Users/fernando/Documents/Medusa\medusa\indexers\tvmaze\tvmaze_api.py", line 255, in _get_episodes
use_dvd = cur_ep['dvd_season'] is not None and cur_ep['dvd_episodenumber'] is not None
KeyError: u'dvd_season'

# Fixed code
def _parse_images(self, tvmaze_id):
    """Parse Show and Season posters.

    images are retrieved using t['show name]['_banners'], for example:

    >>> t = TVMaze(images = True)
    >>> t['scrubs']['_banners'].keys()
    ['fanart', 'poster', 'series', 'season']
    >>> t['scrubs']['_banners']['poster']['680x1000']['35308']['_bannerpath']
    u'http://theTMDB.com/banners/posters/76156-2.jpg'
    >>>

    Any key starting with an underscore has been processed (not the raw
    data from the XML)

    This interface will be improved in future versions.
    """
    logger.debug("Getting show banners for %s", tvmaze_id)

    try:
        image_medium = self.shows[tvmaze_id]["image_medium"]
    except Exception:
        logger.debug("Could not parse Poster for showid: %s", tvmaze_id)
        return False

    # Set the poster (using the original uploaded poster for now, as the medium formated is 210x195
    _images = {
        "poster": {
            "1014x1500": {
                "1": {
                    "rating": 1,
                    "language": "en",
                    "ratingcount": 1,
                    "bannerpath": image_medium.split("/")[-1],
                    "bannertype": "poster",
                    "bannertype2": "210x195",
                    "_bannerpath": image_medium,
                    "id": "1035106",
                }
            }
        }
    }

    season_images = self._parse_season_images(tvmaze_id)
    if season_images:
        _images.update(season_images)

    self._save_images(tvmaze_id, _images)
    self._set_show_data(tvmaze_id, "_banners", _images)