예제 #1
0
 def parse_torrent_info(torrent):
     up_rate = net.parse_net_speed_value(torrent['upspeed'])
     dn_rate = net.parse_net_speed_value(torrent['dlspeed'])
     size = net.parse_net_speed_value(torrent['size'])
     num_leechers, total_leechers = torrent['num_leechs'].split()
     total_leechers = total_leechers.strip("()")
     num_peers, total_peers = torrent['num_seeds'].split()
     total_peers = total_peers.strip("()")
     completed = size * torrent['progress']
     info = client.ClientTorrentData(
         torrent['hash'],
         torrent['name'],
         torrent['ration'],
         up_rate,
         dn_rate,
         0,
         0,
         size,
         completed,
         num_leechers,
         total_leechers,
         num_peers,
         total_peers,
         torrent['priority'],
         None,
         None,
         torrent['progress']
     )
     return info
예제 #2
0
 def parse_torrent_info(torrent):
     up_rate = net.parse_net_speed_value(torrent["upspeed"])
     dn_rate = net.parse_net_speed_value(torrent["dlspeed"])
     size = net.parse_net_speed_value(torrent["size"])
     num_leechers, total_leechers = torrent["num_leechs"].split()
     total_leechers = total_leechers.strip("()")
     num_peers, total_peers = torrent["num_seeds"].split()
     total_peers = total_peers.strip("()")
     completed = size * torrent["progress"]
     info = client.ClientTorrentData(
         torrent["hash"],
         torrent["name"],
         torrent["ratio"],
         up_rate,
         dn_rate,
         0,
         0,
         size,
         completed,
         num_leechers,
         total_leechers,
         num_peers,
         total_peers,
         torrent["priority"],
         None,
         None,
         torrent["progress"],
     )
     return info
예제 #3
0
 def parse_torrent_info(torrent):
     up_rate = net.parse_net_speed_value(torrent['upspeed'])
     dn_rate = net.parse_net_speed_value(torrent['dlspeed'])
     size = net.parse_net_speed_value(torrent['size'])
     num_leechers, total_leechers = torrent['num_leechs'].split()
     total_leechers = total_leechers.strip("()")
     num_peers, total_peers = torrent['num_seeds'].split()
     total_peers = total_peers.strip("()")
     completed = size * torrent['progress']
     info = client.ClientTorrentData(torrent['hash'], torrent['name'],
                                     torrent['ratio'], up_rate, dn_rate, 0,
                                     0, size, completed, num_leechers,
                                     total_leechers, num_peers, total_peers,
                                     torrent['priority'], None, None,
                                     torrent['progress'])
     return info
예제 #4
0
 def test_parse_net_speed_value(self):
     self.assertEqual(10752.0, net.parse_net_speed_value(u'10.5 KiB/s'))
     self.assertEqual(11010048.0, net.parse_net_speed_value(u'10.5 MiB/s'))
     self.assertEqual(10500000.0, net.parse_net_speed_value(u'10.5 mb/s'))