'periodically check torrents in channel. Will return the torrent data if finished.'

def _check_tor(self):

    def showtorrent(torrent):
        '\n                                                assembly    torrent    data,    call    the    callback\n                                                '
        infohash = torrent.infohash
        if (torrent.get_files() and (infohash in self.unavail_torrent)):
            if (len(self.torrents) >= self.max_torrents):
                self._logger.debug('Max    torrents    in    source    reached.    Not    adding    %s', torrent.infohash)
                del self.unavail_torrent[torrent.infohash]
                return
            self._logger.debug('[ChannelSource]    Got    torrent    %s', hexlify(infohash))
            self.torrents[infohash] = {}
            self.torrents[infohash]['name'] = torrent.get_name()
            self.torrents[infohash]['metainfo'] = torrent
            self.torrents[infohash]['creation_date'] = torrent.get_creation_date()
            self.torrents[infohash]['length'] = torrent.get_length()
            self.torrents[infohash]['num_files'] = len(torrent.get_files())
            self.torrents[infohash]['num_seeders'] = 0
            self.torrents[infohash]['num_leechers'] = 0
            self.torrents[infohash]['enabled'] = self.enabled
            self.torrents[infohash]['last_seeding_stats'] = {}
            del self.unavail_torrent[infohash]
            if self.torrent_insert_callback:
                self.torrent_insert_callback(self.source, infohash, self.torrents[infohash])
            self.database_updated = False
    if (len(self.unavail_torrent) and self.enabled):
        self._logger.debug('Unavailable    #torrents    :    %d    from    %s', len(self.unavail_torrent), hexlify(self.source))
        for torrent in self.unavail_torrent.values():
            self._load_torrent(torrent[2]).addCallback(showtorrent)
