def get_show_year(show_obj, show_info, year_only=True):
        # type: (sickbeard.tv.TVShow, Dict, bool) -> Optional[AnyStr]
        if None is not getattr(show_info, 'firstaired', None):
            try:
                first_aired = datetime.datetime.strptime(show_info['firstaired'], '%Y-%m-%d')
                if first_aired:
                    if year_only:
                        return str(first_aired.year)
                    return str(first_aired.date())
            except (BaseException, Exception):
                pass
        if isinstance(show_obj, sickbeard.tv.TVShow):
            if year_only and show_obj.startyear:
                return '%s' % show_obj.startyear
            if not show_obj.sxe_ep_obj.get(1, {}).get(1, None):
                show_obj.get_all_episodes()
            try:
                first_ep_obj = show_obj.first_aired_regular_episode
            except (BaseException, Exception):
                first_ep_obj = None
            if isinstance(first_ep_obj, sickbeard.tv.TVEpisode) \
                    and isinstance(first_ep_obj.airdate, datetime.date) and 1900 < first_ep_obj.airdate.year:
                return '%s' % (first_ep_obj.airdate.year, first_ep_obj.airdate)[not year_only]