peer.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:stig 作者: rndusr 项目源码 文件源码
def run(self, TORRENT_FILTER, PEER_FILTER, sort, columns):
        columns = self.cfg['columns.peers'].value if columns is None else columns
        sort = self.cfg['sort.peers'].value if sort is None else sort
        try:
            tfilter = self.select_torrents(TORRENT_FILTER,
                                           allow_no_filter=True,
                                           discover_torrent=True)
            pfilter = self.get_peer_filter(PEER_FILTER)
            sort    = self.get_peer_sorter(sort)
            columns = self.get_peer_columns(columns)
        except ValueError as e:
            log.error(e)
            return False

        # Unless we're listing peers of exactly one torrent, specified by its
        # ID, automatically add the 'torrent' column.
        if 'torrent' not in columns and \
           (not isinstance(tfilter, abc.Sequence) or len(tfilter) != 1):
            columns.append('torrent')

        log.debug('Listing %s peers of %s torrents', pfilter, tfilter)

        if asyncio.iscoroutinefunction(self.make_plist):
            return await self.make_plist(tfilter, pfilter, sort, columns)
        else:
            return self.make_plist(tfilter, pfilter, sort, columns)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号