Example #1
0
    def test_seed_mode_preset(self):
        seed_mode = lt.high_performance_seed()
        print(seed_mode)

        self.assertTrue('alert_queue_size' in seed_mode)
        self.assertTrue('connection_speed' in seed_mode)
        self.assertTrue('file_pool_size' in seed_mode)
Example #2
0
  def load_preset(self, preset):
    
    log.debug("Set preset")
    
    if preset == 0:
      log.debug("Set High Performance Seed Preset...")
      settings_obj = libtorrent.high_performance_seed()
      
    else:     
      log.debug("Set Minimum Memory Usage Preset...")
      settings_obj = libtorrent.min_memory_usage()

    #self._session.set_settings(settings_obj)
    
    settings = {}
    
    for k in dir(settings_obj):
      if k.startswith("_"):
        continue

      try:
        v = getattr(settings_obj, k)
      except TypeError:
        continue

      val_type = type(v)
      if val_type.__module__ == "libtorrent":
        try:
          v = int(v)
        except ValueError:
          continue

      settings[k] = v
    
    return settings
Example #3
0
    def test_seed_mode_preset(self):
        seed_mode = lt.high_performance_seed()
        print(seed_mode)

        self.assertTrue('alert_queue_size' in seed_mode)
        self.assertTrue('connection_speed' in seed_mode)
        self.assertTrue('file_pool_size' in seed_mode)
Example #4
0
    async def test_settings_base(self) -> None:
        config = lib.create_isolated_config()
        config["session_settings_base"] = "high_performance_seed"
        session_service = session_lib.SessionService(config=config)

        settings = session_service.session.get_settings()

        # Check settings pack was applied as default
        self.assertEqual(
            settings["cache_size"], lt.high_performance_seed()["cache_size"]
        )

        # Check base pack name didn't get overwritten
        self.assertEqual(config["session_settings_base"], "high_performance_seed")
Example #5
0
def get_settings_session_hps():
    return common.struct_to_dict(libtorrent.high_performance_seed())