# Buggy code
def _get_anidb_exceptions():
    anidb_exceptions = {}

    if should_refresh("anidb"):
        logger.log("Checking for scene exceptions updates from AniDB")

        for show in sickbeard.showList:
            if show.is_anime and show.indexer == 1:
                try:
                    anime = adba.Anime(
                        None,
                        name=show.name,
                        tvdbid=show.indexerid,
                        autoCorrectName=True,
                    )
                except Exception as error:
                    logger.log(
                        "Checking AniDB scene exceptions update failed for {0}. Error: {1}".format(
                            show.name, error
                        ),
                        logger.ERROR,
                    )
                    continue

                if anime and anime.name != show.name:
                    anidb_exceptions[text_type(show.indexerid)] = [
                        {anime.name.decode("utf-8"): -1}
                    ]

        set_last_refresh("anidb")

    return anidb_exceptions


# Traceback (ValueError)
2016-09-13 16:04:43 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] GET URL: http://torrentproject.se/?filter=2101&s=Chuck+S01E02&showmagnets=on&num=150&out=json [Status: 503]
2016-09-13 16:04:43 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Requested url http://torrentproject.se/?filter=2101&s=Chuck+S01E02&showmagnets=on&num=150&out=json returned status code 503: Service Unavailable
2016-09-13 16:04:43 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] No data returned from provider
2016-09-13 16:04:43 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Search mode: Episode
2016-09-13 16:04:43 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Search string: Chuck S01E04
2016-09-13 16:04:43 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] GET URL: http://torrentproject.se/?filter=2101&s=Chuck+S01E04&showmagnets=on&num=150&out=json [Status: 503]
2016-09-13 16:04:43 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] CloudFlare protection detected, trying to bypass it
2016-09-13 16:04:49 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] GET URL: http://torrentproject.se/?filter=2101&s=Chuck+S01E04&showmagnets=on&num=150&out=json [Status: 503]
2016-09-13 16:04:49 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Requested url http://torrentproject.se/?filter=2101&s=Chuck+S01E04&showmagnets=on&num=150&out=json returned status code 503: Service Unavailable
2016-09-13 16:04:49 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] No data returned from provider
2016-09-13 16:04:49 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Fallback season pack search initiate
2016-09-13 16:04:49 INFO     SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Performing season pack search for Chuck
2016-09-13 16:04:49 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Search mode: Season
2016-09-13 16:04:49 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Search string: Chuck S01
2016-09-13 16:04:49 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] GET URL: http://torrentproject.se/?filter=2101&s=Chuck+S01&showmagnets=on&num=150&out=json [Status: 503]
2016-09-13 16:04:49 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] CloudFlare protection detected, trying to bypass it
2016-09-13 16:04:55 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] GET URL: http://torrentproject.se/?filter=2101&s=Chuck+S01&showmagnets=on&num=150&out=json [Status: 503]
2016-09-13 16:04:55 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Requested url http://torrentproject.se/?filter=2101&s=Chuck+S01&showmagnets=on&num=150&out=json returned status code 503: Service Unavailable
2016-09-13 16:04:55 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] No data returned from provider
2016-09-13 16:04:55 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Search mode: Season
2016-09-13 16:04:55 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Search string: Chuck S01
2016-09-13 16:04:55 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] GET URL: http://torrentproject.se/?filter=2101&s=Chuck+S01&showmagnets=on&num=150&out=json [Status: 503]
2016-09-13 16:04:55 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] CloudFlare protection detected, trying to bypass it
2016-09-13 16:05:02 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] GET URL: http://torrentproject.se/?filter=2101&s=Chuck+S01&showmagnets=on&num=150&out=json [Status: 503]
2016-09-13 16:05:02 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Requested url http://torrentproject.se/?filter=2101&s=Chuck+S01&showmagnets=on&num=150&out=json returned status code 503: Service Unavailable
2016-09-13 16:05:02 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] No data returned from provider
2016-09-13 16:05:02 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Search mode: Season
2016-09-13 16:05:02 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Search string: Chuck S01
2016-09-13 16:05:02 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] GET URL: http://torrentproject.se/?filter=2101&s=Chuck+S01&showmagnets=on&num=150&out=json [Status: 503]
2016-09-13 16:05:02 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] CloudFlare protection detected, trying to bypass it
2016-09-13 16:05:08 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] GET URL: http://torrentproject.se/?filter=2101&s=Chuck+S01&showmagnets=on&num=150&out=json [Status: 503]
2016-09-13 16:05:08 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] Requested url http://torrentproject.se/?filter=2101&s=Chuck+S01&showmagnets=on&num=150&out=json returned status code 503: Service Unavailable
2016-09-13 16:05:08 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [TorrentProject] :: [22ed9ae] No data returned from provider
2016-09-13 16:05:08 INFO     SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Performing episode search for Chuck
2016-09-13 16:05:08 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Search mode: Episode
2016-09-13 16:05:08 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Search string: Chuck S01E01
2016-09-13 16:05:08 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] GET URL: http://alpharatio.cc/torrents.php?searchstr=Chuck+S01E01&filter_cat%5B1%5D=1&filter_cat%5B4%5D=1&filter_cat%5B5%5D=1&filter_cat%5B2%5D=1&filter_cat%5B3%5D=1 [Status: 200]
2016-09-13 16:05:09 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Data returned from provider does not contain any torrents
2016-09-13 16:05:09 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Search mode: Episode
2016-09-13 16:05:09 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Search string: Chuck S01E02
2016-09-13 16:05:09 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] GET URL: http://alpharatio.cc/torrents.php?searchstr=Chuck+S01E02&filter_cat%5B1%5D=1&filter_cat%5B4%5D=1&filter_cat%5B5%5D=1&filter_cat%5B2%5D=1&filter_cat%5B3%5D=1 [Status: 200]
2016-09-13 16:05:10 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Data returned from provider does not contain any torrents
2016-09-13 16:05:10 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Search mode: Episode
2016-09-13 16:05:10 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Search string: Chuck S01E04
2016-09-13 16:05:11 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] GET URL: http://alpharatio.cc/torrents.php?searchstr=Chuck+S01E04&filter_cat%5B1%5D=1&filter_cat%5B4%5D=1&filter_cat%5B5%5D=1&filter_cat%5B2%5D=1&filter_cat%5B3%5D=1 [Status: 200]
2016-09-13 16:05:12 DEBUG    SEARCHQUEUE-BACKLOG-80348 :: [AlphaRatio] :: [22ed9ae] Data returned from provider does not contain any torrents
2016-09-13 16:05:12 INFO     SEARCHQUEUE-BACKLOG-80348 :: [22ed9ae] No needed episodes found during backlog search for: [Chuck]
2016-09-13 16:05:13 INFO     SEARCHQUEUE-BACKLOG-276564 :: [22ed9ae] Beginning backlog search for: [The Strain: Noite Absoluta]
2016-09-13 16:05:13 INFO     SEARCHQUEUE-BACKLOG-276564 :: [22ed9ae] Checking for scene exception updates from https://cdn.pymedusa.com/scene_exceptions/scene_exceptions.json
2016-09-13 16:05:15 INFO     SEARCHQUEUE-BACKLOG-276564 :: [22ed9ae] Checking for XEM scene exceptions updates for theTVDB
2016-09-13 16:05:16 INFO     SEARCHQUEUE-BACKLOG-276564 :: [22ed9ae] Checking for scene exceptions updates from AniDB
2016-09-13 16:05:25 ERROR    SEARCHQUEUE-BACKLOG-276564 :: [22ed9ae] Checking AniDB scene exceptions update failed for Billboard Music Awards. Error: 
Traceback (most recent call last):
  File "/home/home/SickRage/sickbeard/scene_exceptions.py", line 336, in _get_anidb_exceptions
    anime = adba.Anime(None, name=show.name, tvdbid=show.indexerid, autoCorrectName=True)
  File "/home/home/SickRage/lib/adba/aniDBAbstracter.py", line 142, in __init__
    raise ValueError
ValueError

# Fixed code
def _get_anidb_exceptions():
    anidb_exceptions = {}

    if should_refresh("anidb"):
        logger.log("Checking for scene exceptions updates from AniDB")

        for show in sickbeard.showList:
            if all([show.name, show.is_anime, show.indexer == 1]):
                try:
                    anime = adba.Anime(
                        None,
                        name=show.name,
                        tvdbid=show.indexerid,
                        autoCorrectName=True,
                    )
                except Exception as error:
                    logger.log(
                        "Checking AniDB scene exceptions update failed for {0}. Error: {1}".format(
                            show.name, error
                        ),
                        logger.ERROR,
                    )
                    continue

                if anime and anime.name != show.name:
                    anidb_exceptions[text_type(show.indexerid)] = [
                        {anime.name.decode("utf-8"): -1}
                    ]

        set_last_refresh("anidb")

    return anidb_exceptions