rendered paste body<?php $config_ok = true; require_once "intermission/config/config.php"; require_once "intermission/libs/intermission.php"; $intermission = new Intermission($config_sock); $ids_known = json_decode($_GET["ids"]); $torrents = array(); $all_ids = $intermission->helper_get_info_all(array("id")); foreach ($ids_known as $id) { if (!in_array($id, $all_ids)) { $torrent["id"] = $id; $torrent["internal"] = "deleted"; array_push($torrents, $torrent); } } foreach ($all_ids as $id) { $torrent = array(); $torrent["id"] = $id; $status = $intermission->helper_get_status($torrent["id"], array("completed", "state")); $torrent["completed"] = $status["completed"]; $torrent["state"] = $status["state"]; if ($torrent["state"] == "downloading") { $status = $intermission->helper_get_status($torrent["id"], array("eta", "peers-total", "peers-uploading")); $torrent["eta"] = $status["eta"]; $torrent["peers_total"] = $status["peers-total"]; $torrent["peers_uploading"] = $status["peers-uploading"]; } elseif ($torrent["state"] == "seeding") { $status = $intermission->helper_get_status($torrent["id"], array("eta", "peers-downloading", "peers-total")); $torrent["eta"] = $status["eta"]; $torrent["peers_downloading"] = $status["peers-downloading"]; $torrent["peers_total"] = $status["peers-total"]; } if ($ids_known) { if (!in_array($torrent["id"], $ids_known)) { $status = $intermission->helper_get_info($torrent["id"], array("name", "size")); $torrent["internal"] = "new"; $torrent["name"] = $status["name"]; $torrent["size"] = $status["size"]; } else { $torrent["status"] = "old"; } } else { $status = $intermission->helper_get_info($torrent["id"], array("name", "size")); $torrent["internal"] = "new"; $torrent["name"] = $status["name"]; $torrent["size"] = $status["size"]; } array_push($torrents, $torrent); } $intermission->sock_close(); echo json_encode(array("torrents" => $torrents));?>