Пример #1
0
 function download($id)
 {
     if ($torrentf = \model\mysql\Torrentfilm::getFilmDuServeur($id)) {
         \config\Conf::$userscgi = $torrentf->userscgi;
         $req = new \model\xmlrpc\rXMLRPCRequest(\config\Conf::$userscgi, new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "f.frozen_path", array($torrentf->hash . ":f" . $torrentf->numfile)));
         if ($req->success()) {
             $filename = $req->val[0];
             if ($filename == '') {
                 $req = new \model\xmlrpc\rXMLRPCRequest(\config\Conf::$userscgi, array(new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "d.open", $torrentf->hash), new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "f.frozen_path", array($torrentf->hash . ":f" . $torrentf->numfile)), new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "d.close", $torrentf->hash)));
                 if ($req->success()) {
                     $filename = $req->val[1];
                 }
             }
             $mediainfo = json_decode($torrentf->mediainfo, true);
             $compfile = "[";
             $compfile .= strlen($torrentf->complementfichier) > 0 ? $torrentf->complementfichier . "." : "";
             switch ($mediainfo["typequalite"]) {
                 case "SD":
                     $compfile .= $mediainfo["codec"];
                     break;
                 case "HD":
                     $compfile .= $mediainfo["qualite"] . "." . $mediainfo["codec"];
                     break;
             }
             $audios = array();
             foreach ($mediainfo["audios"] as $v) {
                 $res = "";
                 if ($v["type"] !== "MP3") {
                     $res .= $v["type"] . " " . $v["cannal"];
                     if (isset($v["lang"])) {
                         $res .= " " . $v["lang"];
                     }
                 }
                 $audios[] = $res;
             }
             if (count($audios) > 1) {
                 $au = implode(".", $audios);
                 $compfile .= "." . $au . "]";
             } else {
                 $compfile .= "." . $audios[0] . "]";
             }
             $tmp = \model\simple\Download::sendFileName($filename, $torrentf->titre . " " . $compfile);
         }
     } else {
         if ($torrentf = \model\mysql\Torrentfilm::getAdresseServeurFilmUser($id)) {
             //echo ('Location: http'.($_SERVER["SERVER_PORT"] == 80 ? "" : "s") . "://" . $torrentf->hostname."/film/download/".$id."/".\config\Conf::$user["user"]->login."/".\config\Conf::$user["user"]->keyconnexion);
             //die();
             header('Location: http' . ($_SERVER["SERVER_PORT"] == 80 ? "" : "s") . "://" . $torrentf->hostname . "/film/download/" . $id . "/" . \config\Conf::$user["user"]->login . "/" . \config\Conf::$user["user"]->keyconnexion);
             exit;
         } else {
             throw new \Exception("FILE NOT FOUND");
         }
     }
 }
define('DS', DIRECTORY_SEPARATOR);
function __autoload($class_name)
{
    $filename = ROOT . DS . str_replace("\\", DS, $class_name) . ".php";
    if (file_exists($filename)) {
        require_once $filename;
    } else {
    }
}
use model\mysql\Torrentserie as Torrentfilm;
\config\Conf::$debuglocalfile = false;
//retour visuel
$torrentfilm = Torrentfilm::getAll();
foreach ($torrentfilm as $v) {
    //var_dump($v);
    \config\Conf::$userscgi = $v->login;
    $hashtorrentselectionne = $v->hashtorrent;
    $nofile = $v->numfile;
    $mediasinfo = json_decode($v->mediainfo, true);
    $req = new \model\xmlrpc\rXMLRPCRequest(\config\Conf::$userscgi, new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "f.frozen_path", array($hashtorrentselectionne . ":f" . $nofile)));
    if ($req->success()) {
        $filename = $req->val[0];
        if ($filename == '') {
            $req = new \model\xmlrpc\rXMLRPCRequest(\config\Conf::$userscgi, array(new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "d.open", $hashtorrentselectionne), new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "f.frozen_path", array($hashtorrentselectionne . ":f" . $nofile)), new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "d.close", $hashtorrentselectionne)));
            if ($req->success()) {
                $filename = $req->val[1];
            }
        }
        $mediasinfo["taille"] = filesize($filename);
        $mediasinfo["filename"] = $filename;
        \model\simple\Console::println($filename);
Пример #3
0
function __autoload($class_name)
{
    $filename = ROOT . DS . str_replace("\\", DS, $class_name) . ".php";
    if (file_exists($filename)) {
        require_once $filename;
    } else {
    }
}
if (function_exists('ini_set')) {
    ini_set('display_errors', true);
    ini_set('log_errors', false);
}
$taskNo = $argv[1];
$utilisateur = $argv[2];
//$userscgi = $argv[3];
\config\Conf::$userscgi = $utilisateur;
$req = \core\Memcached::value($utilisateur, "task" . $taskNo);
if (!is_null($req)) {
    $request = unserialize($req);
    $announce_list = array();
    $trackers = array();
    $trackersCount = 0;
    if (isset($request['trackers'])) {
        $arr = explode("\r", $request['trackers']);
        foreach ($arr as $key => $value) {
            $value = trim($value);
            if (strlen($value)) {
                $trackers[] = $value;
                $trackersCount = $trackersCount + 1;
            } else {
                if (count($trackers) > 0) {
Пример #4
0
 static function authentificationPourRtorrent($keyconnexion)
 {
     if (!is_null($keyconnexion)) {
         $u = \core\Memcached::value($keyconnexion, "user");
         if (is_null($u)) {
             $u = \model\mysql\Utilisateur::authentifierUtilisateurParKeyConnexion($keyconnexion);
             if ($u) {
                 \core\Memcached::value($u->keyconnexion, "user", $u, 60 * 2);
             }
         } else {
             $u = $u->keyconnexion === $keyconnexion ? $u : false;
             if (is_bool($u)) {
                 $u = \model\mysql\Utilisateur::authentifierUtilisateurParKeyConnexion($keyconnexion);
                 if ($u) {
                     \core\Memcached::value($u->keyconnexion, "user", $u, 60 * 2);
                 }
             } else {
                 \core\Memcached::value($u->keyconnexion, "user", $u, 60 * 2);
             }
         }
         \config\Conf::$user["user"] = $u;
         if ($u && !is_null($u)) {
             setcookie("keyconnexion", $u->keyconnexion, strtotime('+1 days'), "/");
             $userscgi = \model\mysql\Rtorrent::getUserscgiDeUtilisateur($u->login);
             if (!$userscgi) {
                 throw new \Exception("Aucun ports scgi sur " . HOST);
             }
             \config\Conf::$userscgi = $userscgi[0]->userscgi;
         }
     }
 }
Пример #5
0
 function rt($ports)
 {
     \config\Conf::$userscgi = $ports;
     var_dump(\model\xmlrpc\rTorrentSettings::get(\config\Conf::$userscgi, true));
 }