Example #1
0
async def testiz(path):
    tor = Torrent(path)
    print(tor.get_torrent_data())
    print(tor.get_torrent_ind_size())
    print(tor.get_torrent_piece_length())
    print(tor.get_torrent_name().decode())
    for tracker in tor.get_torrent_announce_list():
        test_tracker = Tracker.Tracker_udp(tor, tracker[0])
        try:
            loop.run_until_complete(test_peer_comm(test_tracker))
            break
        except Exception as e:
            print("tracker {0} did not work, exception was: {1}".format(tracker[0], e))
    loop.close()
    print("finishing")
Example #2
0
            loop.run_until_complete(test_peer_comm(test_tracker))
            break
        except Exception as e:
            print("tracker {0} did not work, exception was: {1}".format(tracker[0], e))
    loop.close()
    print("finishing")


if __name__ == '__main__':

    loop = asyncio.get_event_loop()
    # loop.set_debug(True)
    # loop.slow_callback_duration = 0.001
    # tor = Torrent("C:\\temp\\big-buck-bunny.torrent")
    tor = Torrent("C:\\temp\\gimp.torrent")
    print(tor.get_torrent_data())
    print(tor.get_torrent_ind_size())
    print(tor.get_torrent_piece_length())
    print(tor.get_torrent_name().decode())
    for tracker in tor.get_torrent_announce_list():
        test_tracker = Tracker.Tracker_udp(tor, tracker[0])
        try:
            loop.run_until_complete(test_peer_comm(test_tracker))
            break
        except Exception as e:
            print("tracker {0} did not work, exception was: {1}".format(tracker[0], e))
    loop.close()
    print("finishing")

    # class test(Enum):
    #     lol = None