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)
def mark_all_as_done(self): deluge_dao.update_import_status("done") return {}