当前位置: 首页>>代码示例>>Python>>正文


Python DownloadStartupConfig.set_video_event_callback方法代码示例

本文整理汇总了Python中Tribler.Core.DownloadConfig.DownloadStartupConfig.set_video_event_callback方法的典型用法代码示例。如果您正苦于以下问题:Python DownloadStartupConfig.set_video_event_callback方法的具体用法?Python DownloadStartupConfig.set_video_event_callback怎么用?Python DownloadStartupConfig.set_video_event_callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tribler.Core.DownloadConfig.DownloadStartupConfig的用法示例。


在下文中一共展示了DownloadStartupConfig.set_video_event_callback方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUpPostSession

# 需要导入模块: from Tribler.Core.DownloadConfig import DownloadStartupConfig [as 别名]
# 或者: from Tribler.Core.DownloadConfig.DownloadStartupConfig import set_video_event_callback [as 别名]
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        # Let Tribler start downloading an non-functioning torrent, so
        # we can talk to a normal download engine.
        
        self.torrentfn = os.path.join('extend_hs_dir','dummydata.merkle.torrent')
        tdef = TorrentDef.load(self.torrentfn)

        dscfg = DownloadStartupConfig()
        dscfg.set_dest_dir(self.config_path)
        dscfg.set_video_event_callback(self.vod_ready_callback)
        
        self.d = self.session.start_download(tdef,dscfg)
        
        # This is the infohash of the torrent in test/extend_hs_dir
        self.infohash = '\xccg\x07\xe2\x9e!]\x16\xae{\xb8\x10?\xf9\xa5\xf9\x07\xfdBk'
        self.mylistenport = 4810
开发者ID:nomadsummer,项目名称:cs198mojo,代码行数:21,代码来源:test_g2g.py

示例2: create_torrent

# 需要导入模块: from Tribler.Core.DownloadConfig import DownloadStartupConfig [as 别名]
# 或者: from Tribler.Core.DownloadConfig.DownloadStartupConfig import set_video_event_callback [as 别名]
    def create_torrent(self):
        [srchandle, self.sourcefn] = mkstemp()
        self.content = Rand.rand_bytes(self.contentlen)
        os.write(srchandle, self.content)
        os.close(srchandle)

        self.tdef = TorrentDef()
        self.tdef.add_content(self.sourcefn)
        self.tdef.set_piece_length(self.piecelen)
        self.tdef.set_tracker("http://127.0.0.1:12/announce")
        self.tdef.finalize()

        self.torrentfn = os.path.join(self.session.get_state_dir(), "gen.torrent")
        self.tdef.save(self.torrentfn)

        dscfg = DownloadStartupConfig()
        destdir = os.path.dirname(self.sourcefn)
        dscfg.set_dest_dir(destdir)
        dscfg.set_video_event_callback(self.sesscb_vod_event_callback)

        self.session.set_download_states_callback(self.states_callback)
        self.session.start_download(self.tdef, dscfg)
开发者ID:Anbcorp,项目名称:tribler,代码行数:24,代码来源:test_vod.py


注:本文中的Tribler.Core.DownloadConfig.DownloadStartupConfig.set_video_event_callback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。