class Main(gobject.MainLoop): def __init__(self): super(Main, self).__init__() self.parse_args() logger.log_event("Download started.") self.pipeline = VideoTorrentPlayer(self.torrent_path, self.use_fake_sink, self.save_path, self.algorithm, self.stream_length, self.buffer_size) self.message_handler = MessageHandler(self, self.pipeline) def parse_args(self): parser = argparse.ArgumentParser( description="BitTorrent video player.") parser.add_argument("torrent_path", help="Torrent file to open") parser.add_argument("-f", dest="fake_sink", action="store_true", help="Produce fake audio/video output") parser.add_argument("--save_path", help="Where to save files", default=".") parser.add_argument("--algorithm", choices=["rarest-first", "sequential", "deadline"], default="rarest-first", help="Piece picking algorithm") parser.add_argument("--stream_length", type=int, default=0, help="Length of the video in milliseconds") parser.add_argument("--buffer_size", type=float, default=4.0, help="Size of playback buffer in MB") args = parser.parse_args() self.torrent_path = args.torrent_path self.use_fake_sink = args.fake_sink self.save_path = args.save_path self.algorithm = args.algorithm self.stream_length = args.stream_length self.buffer_size = args.buffer_size def quit(self): logger.log_event("Stopping...") self.pipeline.close() super(Main, self).quit()
def __init__(self): super(Main, self).__init__() self.parse_args() logger.log_event("Download started.") self.pipeline = VideoTorrentPlayer(self.torrent_path, self.use_fake_sink, self.save_path, self.algorithm, self.stream_length, self.buffer_size) self.message_handler = MessageHandler(self, self.pipeline)
class Main(gobject.MainLoop): def __init__(self): super(Main, self).__init__() self.parse_args() logger.log_event("Download started.") self.pipeline = VideoTorrentPlayer(self.torrent_path, self.use_fake_sink, self.save_path, self.algorithm, self.stream_length, self.buffer_size) self.message_handler = MessageHandler(self, self.pipeline) def parse_args(self): parser = argparse.ArgumentParser(description="BitTorrent video player.") parser.add_argument("torrent_path", help="Torrent file to open") parser.add_argument("-f", dest="fake_sink", action="store_true", help="Produce fake audio/video output") parser.add_argument("--save_path", help="Where to save files", default=".") parser.add_argument("--algorithm", choices=["rarest-first", "sequential", "deadline"], default="rarest-first", help="Piece picking algorithm") parser.add_argument("--stream_length", type=int, default=0, help="Length of the video in milliseconds") parser.add_argument("--buffer_size", type=float, default=4.0, help="Size of playback buffer in MB") args = parser.parse_args() self.torrent_path = args.torrent_path self.use_fake_sink = args.fake_sink self.save_path = args.save_path self.algorithm = args.algorithm self.stream_length = args.stream_length self.buffer_size = args.buffer_size def quit(self): logger.log_event("Stopping...") self.pipeline.close() super(Main, self).quit()
def __init__(self): super(Main, self).__init__() self.parse_args() logger.log_event("Download started.") self.pipeline = VideoTorrentPlayer(self.torrent_path, self.use_fake_sink, self.save_path, self.algorithm, self.stream_length, self.buffer_size) self.message_handler = MessageHandler(self, self.pipeline)