Exemple #1
0
    print("(I) Add Torrent files.")
    content_folders_path = os.path.abspath(content_folders_path)

    for name in os.listdir(content_folders_path):
        path = os.path.join(content_folders_path, name)
        if os.path.isfile(path) and path.endswith(".torrent"):
            print("(I) Add {}".format(path))
            controller.addTorrentFile(path)


if __name__ == "__main__":
    app = QApplication([])

    cache_path = os.path.abspath("cache/")

    controller = TorrentController(cache_path)
    main_window = MainWindow(controller)
    torrent_view = TorrentView(controller)
    dht_view = DhtView(controller)

    main_window.showDhtAction.triggered.connect(dht_view.show)
    main_window.showDownloadsAction.triggered.connect(torrent_view.show)

    #autoCreateTorrents(controller, cache_path)
    autoAddTorrents(controller, cache_path)

    controller.loadSettings("libtorrent.json")
    '''handler for the SIGINT signal'''
    def sigint_handler(*args):
        print("sigint_handler")
        QApplication.quit()