Example #1
0
 public function run()
 {
     $onRun = $this->onRun;
     $createProcess = function ($cmd, $cwd = NULL, array $envs = array()) {
         $process = new Process($cmd, $cwd, $envs);
         $process->setTimeout(0);
         return $process;
     };
     $onRun($this->targetProject, $createProcess);
 }
Example #2
0
 /**
  * @returns array $result
  */
 public function queryByEmail($email)
 {
     $process = Process::build($this->daemon, array('query-email', $email))->end();
     if (($exitCode = $process->run()) !== 0) {
         throw new \RuntimeException('Cannot Query Daemon: exit(' . $exitCode . ') ' . $process->getErrorOutput() . ' ' . $process->getOutput() . ' Running ' . $process->getCommandLine());
     }
     $json = $process->getOutput();
     $result = JSONConverter::create()->parse($json);
     return $result;
 }
Example #3
0
 public function run()
 {
     $dir = $this->package->getRootDirectory();
     $this->destination->create();
     $gitArchive = sprintf('git archive --format=tar %s | tar xvf - --directory %s', $this->branch, $this->destination->getUnixOrCygwinPath());
     $process = new Process($gitArchive, $dir, $envs = array());
     $process->setTimeout(0);
     $log = NULL;
     $ret = $process->run(function ($type, $buffer) use(&$log) {
         $log .= $buffer;
         //if ('err' === $type) {
         //    echo '[unison-ERR]: '.$buffer;
         //} else {
         //    echo '[unison-OUT]: '.$buffer;
         //}
     });
     if ($ret !== 0) {
         throw new \RuntimeException(sprintf("Cannot git archive the package.\nPackage: %s\nCmd: %s\nLog: %s\n", $this->package, $gitArchive, $log));
     }
 }
Example #4
0
    exit;
}
$reload = isset($_GET['reload']);
$update = isset($_GET['update']);
$scan = isset($_GET['scan']);
$client = new Client($conf['serienLoaderURL']);
$log = NULL;
$episodes = array();
if ($reload) {
    $organizer = new DownloadsOrganizer(new Dir($conf['downloadDir']), new Dir($conf['targetDir']), $client, new JDownloaderRPC($conf['jdownloader']['host'], $conf['jdownloader']['port']), $subtitlesManager = NULL, $log = new BufferLogger());
    $organizer->setHosterPrio($conf['hosterPrio']);
    $episodes = $organizer->organize();
} elseif ($update) {
    $root = Dir::factoryTS(__DIR__)->sub('../../../../')->resolvePath();
    $finder = new \Symfony\Component\Process\ExecutableFinder();
    $process = \Psc\System\Console\Process::build($finder->find('composer'))->addOption('working-dir', mb_substr($root, 0, -1))->addOption('prefer-dist')->addOption('v')->addArgument('update')->end();
    $process->run();
    $log = "Running self-update. \n";
    $log .= "run: " . $process->getCommandline() . "\n";
    $log .= $process->getOutput() . "\n";
    $log .= $process->getErrorOutput() . "\n";
} elseif ($scan) {
    $xbmc = new XBMC($conf['xbmc']['username'], $conf['xbmc']['password'], $conf['xbmc']['port']);
    $log = 'Forcing XBMC to scan. Response: ';
    $log .= $xbmc->scan();
} else {
    $episodes = $client->getEpisodes();
    $log = 'nothing was updated. Hit reload';
}
$episodesJs = array();
foreach ($episodes as $episode) {