Esempio n. 1
0
    def test_connectivity(self):
        try:
            connected = deluge.connect(timeout=5)
        except:
            connected = False

        return {"connected": connected}
Esempio n. 2
0
    def _import_torrent(torrent_id):
        deluge_dao.update_import_status("importing", torrent_id)

        try:
            deluge.connect()
            torrent_files = deluge.import_torrent(torrent_id)

            for torrent_file in torrent_files:
                # update modified time to now, we don't want the one from deluge
                os.utime(torrent_file, None)

            tracks, messages = library_dao.add_files(torrent_files, move=True, remove_dirs=True)

            deluge_dao.update_import_status("imported", torrent_id)
        except Exception:
            log("Failed to import torrent", traceback=True)
            deluge_dao.update_import_status("failed", torrent_id)