예제 #1
0
             $htmlMain .= ' - ' . $torrent . "";
             $htmlMain .= "\n";
             // just 2 sec..
             sleep(2);
         }
     }
     $htmlMain .= '</pre>';
     $htmlMain .= '<hr><br>';
     break;
 case "3":
     // Torrents-Resume
     include_once "ClientHandler.php";
     $htmlTitle = "Torrents-Resume";
     $htmlMain .= '<br><strong>Torrents Resumed :</strong><br>';
     $htmlMain .= '<pre>';
     $torrents = getTorrentListFromDB();
     foreach ($torrents as $torrent) {
         $torrentRunningFlag = isTorrentRunning($torrent);
         if ($torrentRunningFlag == 0) {
             $btclient = getTorrentClient($torrent);
             if ($cfg["enable_file_priority"]) {
                 include_once "setpriority.php";
                 // Process setPriority Request.
                 setPriority($torrent);
             }
             $clientHandler = ClientHandler::getClientHandlerInstance($cfg, $btclient);
             $clientHandler->startTorrentClient($torrent, 0);
             $htmlMain .= ' - ' . $torrent . "";
             $htmlMain .= "\n";
             // just 2 sec..
             sleep(2);
예제 #2
0
function cliResumeTorrents()
{
    global $cfg;
    include_once "ClientHandler.php";
    echo "Resuming all torrents ...\n";
    $torrents = getTorrentListFromDB();
    foreach ($torrents as $torrent) {
        $torrentRunningFlag = isTorrentRunning($torrent);
        if ($torrentRunningFlag == 0) {
            echo " - " . $torrent . "...";
            $cfg["user"] = getOwner($torrent);
            $btclient = getTorrentClient($torrent);
            if ($cfg["enable_file_priority"]) {
                include_once "setpriority.php";
                // Process setPriority Request.
                setPriority($torrent);
            }
            $clientHandler = ClientHandler::getClientHandlerInstance($cfg, $btclient);
            $clientHandler->startTorrentClient($torrent, 0);
            // just 2 sec..
            sleep(2);
            //
            if ($clientHandler->status == 3) {
                // hooray
                echo " done\n";
            } else {
                // start failed
                echo "\n" . $clientHandler->messages;
            }
        }
    }
}