'Look up the NZB name in the history and see if it contains a record for self.nzb_name
:return: A (indexer_id, season, [], quality, version) tuple. The first two may be None if none were found.'

def _history_lookup(self):

    to_return = (None, None, [], None, None)
    if ((not self.nzb_name) and (not self.folder_name)):
        self.in_history = False
        return to_return
    names = []
    if self.nzb_name:
        names.append(self.nzb_name)
        if (u'.' in self.nzb_name):
            names.append(self.nzb_name.rpartition(u'.')[0])
    if self.folder_name:
        names.append(self.folder_name)
    main_db_con = db.DBConnection()
    for curName in names:
        search_name = re.sub(u'[\\.\\-    ]', u'_', curName)
        sql_results = main_db_con.select(u'SELECT    showid,    season,    quality,    version,    resource    FROM    history    WHERE    resource    LIKE    ?    AND    (action    %    100    =    4    OR    action    %    100    =    6)', [search_name])
        if (not sql_results):
            continue
        indexer_id = int(sql_results[0]['showid'])
        season = int(sql_results[0]['season'])
        quality = int(sql_results[0]['quality'])
        version = int(sql_results[0]['version'])
        if (quality == common.Quality.UNKNOWN):
            quality = None
        show = Show.find(sickbeard.showList, indexer_id)
        self.in_history = True
        self.version = version
        to_return = (show, season, [], quality, version)
        qual_str = (common.Quality.qualityStrings[quality] if (quality is not None) else quality)
        self._log(u'Found    result    in    history    for    {0}    -    Season:    {1}    -    Quality:    {2}    -    Version:    {3}'.format((show.name if show else u'UNDEFINED'), season, qual_str, version), logger.DEBUG)
        return to_return
    self.in_history = False
    return to_return
