本文整理汇总了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
示例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)